refactor: remove fallbackCode from terminal review types and related logic
This commit is contained in:
1 parent
8b3428c43c
commit
cb43b2871b
4 files changed
+6
-23
No files matched your search
@@ -132,7 +132,7 @@ append-only 伙伴消息转录;模型上下文、UI、resume 均由此投影
|
||||
| `compaction_checkpoint` | `{ compactBlockId, throughSeq, sourceMessageCount, summary }` | 压缩书签 + 摘要正文;`seq <= historyFloorSeq` 的原文不再进 brain;发给主模型时再合成 Compact User |
|
||||
| `finalizing_started` | `{}` | 投影时**清空** plan |
|
||||
| `human_interaction_resolved` | `{ interactionId, kind, result }` | UI Activity:在对应工具行下按顺序展示问题答案或审批结果 |
|
||||
| `terminal_review_resolved` | `{ reviewId, decisions: [{ commandId, decision }], fallbackCode? }` | `terminal_run` 副作用命中后的 AI 审核结论;命令编号对应 hand 批次中的 toolCallId;格式或调用失败时记录 fallbackCode |
|
||||
| `terminal_review_resolved` | `{ reviewId, decisions: [{ commandId, decision }] }` | `terminal_run` 副作用命中后的 AI 审核结论;命令编号对应 hand 批次中的 toolCallId |
|
||||
|
||||
#### `entry_json` 示例
|
||||
|
||||
|
||||
@@ -18,7 +18,6 @@ export type TerminalReviewDecision = {
|
||||
|
||||
export type TerminalReviewResult = {
|
||||
decisions: TerminalReviewDecision[]
|
||||
fallbackCode?: 'invalid_output' | 'review_unavailable'
|
||||
}
|
||||
|
||||
const MAX_OUTPUT_RETRIES = 3
|
||||
@@ -36,15 +35,11 @@ const reviewSchema = z
|
||||
})
|
||||
.strict()
|
||||
|
||||
const humanFallback = (
|
||||
commands: readonly TerminalReviewCandidate[],
|
||||
fallbackCode: TerminalReviewResult['fallbackCode']
|
||||
): TerminalReviewResult => ({
|
||||
const humanFallback = (commands: readonly TerminalReviewCandidate[]): TerminalReviewResult => ({
|
||||
decisions: commands.map((command) => ({
|
||||
commandId: command.commandId,
|
||||
decision: 'needs_human_review'
|
||||
})),
|
||||
...(fallbackCode ? { fallbackCode } : {})
|
||||
}))
|
||||
})
|
||||
|
||||
const matchDecisions = (
|
||||
@@ -103,12 +98,12 @@ export const reviewTerminalCommands = async (input: {
|
||||
if (isCancelledError(error)) throw error
|
||||
input.ctx.checkCancelled()
|
||||
if (!isLlmOutputError(error)) {
|
||||
return humanFallback(input.commands, 'review_unavailable')
|
||||
return humanFallback(input.commands)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return humanFallback(input.commands, 'invalid_output')
|
||||
return humanFallback(input.commands)
|
||||
}
|
||||
|
||||
export const buildTerminalReviewAnnotation = (input: {
|
||||
@@ -119,7 +114,6 @@ export const buildTerminalReviewAnnotation = (input: {
|
||||
eventType: 'terminal_review_resolved',
|
||||
payload: {
|
||||
reviewId: input.reviewId,
|
||||
decisions: input.result.decisions,
|
||||
...(input.result.fallbackCode ? { fallbackCode: input.result.fallbackCode } : {})
|
||||
decisions: input.result.decisions
|
||||
}
|
||||
})
|
||||
@@ -2016,7 +2016,6 @@ export type ChatMessageLogAnnotationEntry =
|
||||
commandId: string
|
||||
decision: 'auto_approve' | 'needs_human_review'
|
||||
}>
|
||||
fallbackCode?: 'invalid_output' | 'review_unavailable'
|
||||
}
|
||||
}
|
||||
| {
|
||||
|
||||
@@ -315,17 +315,9 @@ describe('ai tool hand terminal review', () => {
|
||||
}
|
||||
})
|
||||
const output = await runner.run({ taskId: runtime.taskId, userInput: '请处理目录。' })
|
||||
const records = await runner.ctx.loadMessageLog()
|
||||
const fallbackCodes = records.flatMap((record) => {
|
||||
const { entry } = record
|
||||
return entry.kind === 'annotation' && entry.eventType === 'terminal_review_resolved'
|
||||
? [entry.payload.fallbackCode]
|
||||
: []
|
||||
})
|
||||
return {
|
||||
output,
|
||||
reviewCallCount,
|
||||
fallbackCodes,
|
||||
exists: await fs
|
||||
.stat(target)
|
||||
.then(() => true)
|
||||
@@ -337,8 +329,6 @@ describe('ai tool hand terminal review', () => {
|
||||
runtime.assertThat(
|
||||
result.output.status === 'completed' &&
|
||||
result.reviewCallCount === 4 &&
|
||||
result.fallbackCodes.length === 1 &&
|
||||
result.fallbackCodes[0] === 'invalid_output' &&
|
||||
!result.exists &&
|
||||
filterAiRunEventsByType(result.events, 'approval_batch_required').length === 1 &&
|
||||
filterAiRunEventsByType(result.events, 'terminal_step_started').length === 0,
|
||||
|
||||
Reference in new issue
Block a user