Files
Jyotisha/docs/tasks/PROGRESS-rectification-set-focus-tool-failed-20260912.md
T
Jesse_ChenandCursor 073a45b73e
Independent Staging Quality Gate / validate (push) Failing after 13m36s
Independent Staging Quality Gate / publish (push) Skipped
fix(rectification): keep set-focus idempotent and record tool failures (BUG-659/660)
Same-id focus returns instead of making the model retry; kind_hint targetKind is ignored. Failed receipts keep a redacted original error and known codes. Host fallback recap no longer duplicates dates.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 00:23:11 +08:00

44 lines
3.6 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# 进度 · 记完经历后 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 身份冲突 | 同 questionIdRPC `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.warn` JSON `{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 真机走查
## 未做
- 未 push、未部署。真机:开场说两件学业,本轮不得出现 `tool_failed`;兜底或模型正文日期不重复。