BUG-659 moved compare tool_failed fingerprints into failReceipt; keep the source lock on the shared helper so the staging gate still requires a redacted engine_message. Co-authored-by: Cursor <cursoragent@cursor.com>
4.0 KiB
4.0 KiB
进度 · 记完经历后 set-focus 连续 tool_failed(2026-09-12)
范围
- 分支:
codex/rectification-set-focus-tool-failed-20260912(基于origin/staging@fb18f72f,任务书基线529fcc09) - 任务单:
docs/tasks/TASK-rectification-set-focus-tool-failed-20260912.md - BUG-659:失败可诊断 + 同 id 幂等 +
targetKind忽略 kind_hint - BUG-660:宿主兜底 recap 去重日期
- 不改引擎、决策门、Skill、DB 迁移
T0 取证
本地夹具复现 §1 第二轮(batch 已落 collect:invite:more,再调 set-focus 同 id):
| 假设 | 入参 / 条件 | 旧回执码(529fcc09 源码) | 本分支 |
|---|---|---|---|
| (a) schema 身份冲突 | 同 questionId;RPC set_agentic_rectification_conversation_focus 抛 focus_idempotency_conflict |
该码在已知列表,不应显示为 tool_failed;若走到 RPC 会是 focus_idempotency_conflict |
同 id 在 RPC 前返回 idempotent=true,无失败回执;RPC 抛错也被吞掉 |
(b) targetKind=invite_more |
Zod evidenceKindSchema |
execute 前进不了,流映射 tool_call_rejected,与事故回执 tool_failed 不符 |
schema 接受字符串;服务端忽略 hint,活动焦点 target_kind=null |
| (c) 工具内抛错 | assertCaseRef / invalid_domain |
码不在已知列表 → tool_failed;10ms、无 DB,与事故形态最像 |
invalid_case_id / invalid_domain 回执可辨,失败指纹含脱敏 engine_message,并打 rectification_tool_failed |
事故六次失败、每次约 10ms、界面只见 tool_failed,与 (c) 或「未知 throw 被压成兜底码」一致;(a)(b) 单独都不能解释成 tool_failed。T1 之后即使再失败也能从回执和日志分开这三类。
Staging 容器日志(deploy@118.26.111.127,密钥 ~/.ssh/jyotisha-staging):docker compose logs --since 2026-09-12T05:05:00Z --until 2026-09-12T05:10:00Z web 中 rectification_tool_failed|rectification-set-focus 匹配 0 行。与 §2.2 一致:当时没有把原始错误打进日志。不以容器原文锁定根因。
完成
- T1
failReceipt:resultFingerprint = {safe_error_code, engine_message};console.warnJSON{event:rectification_tool_failed, tool, case_id, code, message}。engineMessageForReceipt打码 UUID/邮箱。safeToolErrorCode与SAFE_TOOL_ACTIVITY_CODES加入invalid_case_id/invalid_domain/invalid_event_kind/invalid_focus/tool_call_rejected;未知 tool-error 活动带code=tool_failed。 - T2 活动焦点
questionId相同则返回已有焦点;spoken_prompt 合法时尝试更新 schema,RPC 失败仍成功返回。targetKind不再走证据种类 Zod;新焦点 persist 仍targetKind: null。 - T3
recapLine:短语含\d{4}年或以标签开头时只用短语。 - T4 本文件、BUG-659/660、CHANGELOG、任务板改为待验收。
验收(本机,未部署)
frontend./node_modules/.bin/tsc --noEmit --incremental false:0 错(约 5 分钟)- eslint 变更文件 0 error / 27 warning(
rectification-v9-tools.ts既有 unused-import,未在本单清扫) - 相关套件
tsx --test八个文件(新合同测试、host-fallback、stream、status-security、v10 tool-contract、server-focus、v9-agent、collect-prompt):138 pass / 0 fail - 新文件
rectification-set-focus-tool-failed-20260912.test.ts:4 / 4 - 未跑
next build/ 首屏 gzip - 未部署 staging 真机走查
门禁跟进
- Independent Staging Quality Gate run 2573 (
073a45b7) validate 失败:npm testfail 1 / 3136 - 失败项:
compare failure copy and receipt detail stay user-visible without PII仍锁 compare catch 内联engine_message: engineMessageForReceipt;BUG-659 已抽到failReceipt - 源码锁改为断言 helper 写
engine_message且 compare catch 调用failReceipt
未做
- 未 push、未部署。真机:开场说两件学业,本轮不得出现
tool_failed;兜底或模型正文日期不重复。