fix(consult): a stored smalltalk reply is not a prior answer; summary counts as one (acceptance fix for BUG-1071)
Independent Staging Quality Gate / validate (push) Successful in 14m58s
Independent Staging Quality Gate / publish (push) Successful in 3m40s

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0199rbQDTsUbCVw84wc8BTFe
This commit is contained in:
Jesse_Chen
2026-09-27 23:43:57 +08:00
co-authored by Claude Fable 5.1
parent 2b435f11d0
commit 9d01757f27
11 changed files with 83 additions and 15 deletions
+2 -2
View File
@@ -14395,8 +14395,8 @@
- 现象:会话里第二个问题起(「那我爸呢」「我妈是不是不太在意我」),回答仍是口语开场加四个二级标题的完整解读,重述上一轮已经写过的宫位;用户感受是「太宽泛」。
- 触发条件:同一会话已有一轮本命解读后的任何追问。
- 根因:`jyotishInstructions`「Call run-jyotish-consultation before answering every turn, including short follow-ups」、`natalSpokenReportContract` 末句「One natal … question still uses the opener-plus-skeleton above」、每轮用户轮的 `natalAnswerShapeInstruction()`「一次写完这四个二级标题」三处都不区分首轮与追问轮。
- 修复:`consultation-thinking-plan.ts` 新增 `followUpAnswerShapeInstruction()`(≤ 200 字、第一句答问的那句、是非题先答是 / 不是、最多三处盘面事实、不写二级标题、不写行动清单、不重述上一轮、不解释用户为什么问;明确换领域或要求完整看才回首轮形状)、`hasPriorAssistantAnswer(history)`(存量历史里已有非空 assistant 正文即追问轮,不看问句字面)与 `natalUserTurnShape()`(daily 不变 / 追问 / 首轮);`route.ts` 用户轮按它切指令,grounded 兜底同样切换(同一份 `legacyNatalInstruction`);思考栏与工具上下文带 `followUpTurn`。合同末句改为「首轮用开场 + 骨架,追问轮按用户轮里的指令」。工具仍每轮调用,扣点与结算不变(D7)。
- 验证:新文件 `frontend/tests/consult-answer-the-question-20260927.test.ts`:真实 Agent + 记录提示词的假模型 + 公开盘 golden,追问轮 → 写作步的提示词含「这是追问轮 / 不超过 200 字」、不含三标题指令,工具跑 1 次、模型 2 次,无标题短正文(< 160 字)整段放出并结算扣点 1 次;首轮对照用例保持开场 + 三标题。`consultation-thinking-plan.test.ts` 覆盖 `hasPriorAssistantAnswer` / `natalUserTurnShape` 四种情况(空历史、只有用户轮、空白 assistant、有回答;daily 不受历史影响)。
- 修复:`consultation-thinking-plan.ts` 新增 `followUpAnswerShapeInstruction()`(≤ 200 字、第一句答问的那句、是非题先答是 / 不是、最多三处盘面事实、不写二级标题、不写行动清单、不重述上一轮、不解释用户为什么问;明确换领域或要求完整看才回首轮形状)、`hasPriorAssistantAnswer(history, { summaryText })`(存量历史里已有非空、且不是寒暄回复(`responseKind: "smalltalk"`)的 assistant 正文即追问轮,会话摘要存在也算;不看问句字面。Claude 验收补修:子代理首版只看 role,「你好」的寒暄回复也存成 assistant 消息,会把其后第一个正式问题当追问;历史窗口现在把 `responseKind` 透传到 tail)与 `natalUserTurnShape()`(daily 不变 / 追问 / 首轮);`route.ts` 用户轮按它切指令,grounded 兜底同样切换(同一份 `legacyNatalInstruction`);思考栏与工具上下文带 `followUpTurn`。合同末句改为「首轮用开场 + 骨架,追问轮按用户轮里的指令」。工具仍每轮调用,扣点与结算不变(D7)。
- 验证:新文件 `frontend/tests/consult-answer-the-question-20260927.test.ts`:真实 Agent + 记录提示词的假模型 + 公开盘 golden,追问轮 → 写作步的提示词含「这是追问轮 / 不超过 200 字」、不含三标题指令,工具跑 1 次、模型 2 次,无标题短正文(< 160 字)整段放出并结算扣点 1 次;首轮对照用例保持开场 + 三标题。`consultation-thinking-plan.test.ts` 覆盖 `hasPriorAssistantAnswer` / `natalUserTurnShape` 四种情况(空历史、只有用户轮、空白 assistant、有回答;daily 不受历史影响)。验收补修加:寒暄回复后仍是首轮形状、摘要存在即追问、空白摘要不算;`consultation-session-history.test.ts` 加 `responseKind` 透传用例。
- 防复发:D6 硬红线——追问判定只用历史事实,禁正则识别意图(沿用 BUG-976/977);route 合同测试断言 `natalUserTurnShape({ entrypoint: consultEntrypoint, history })` 与 `followUpTurn` 的接线。
- 相关记录:BUG-1070、BUG-1073、BUG-1053(答案由看过工具结果的步写)、BUG-976/977(禁正则)。
- 复发自:无
@@ -74,3 +74,22 @@
- `next build` 默认 Turbopack 对软链的 `node_modules` 报 `Symlink … points out of the filesystem root`(与 `PROGRESS-consult-gender-optional-20260927` 同一现象),改用 `next build --webpack` 量 `/` 状态与首屏 gzip;数字口径与该记录一致(rootMainFiles,gzip level 9)。
- lint 有 127 条既有 warning(0 error),不在本单范围,未动。
- 真实模型输出未验(无凭据):见 `docs/testing/consult-answer-the-question-20260927.md`。
## Claude 验收补修(2026-09-27 晚)
- 发现:`hasPriorAssistantAnswer` 只看 `role === "assistant"`,而寒暄快路(BUG-976/977)的回复也以 `responseKind: "smalltalk"` 存成 assistant 消息(`route.ts` `p_response_message`),历史窗口又把 `responseKind` 丢掉。后果:用户先说「你好」再问第一个正式问题,会被当成追问轮(≤ 200 字、无骨架)。会话摘要把早先轮次折掉后 tail 里可能没有 assistant,则反过来误判为首轮。
- 修:`consultation-session-history.ts` 的 `StoredTurn` / `ConsultationHistoryMessage` 带可选 `responseKind`,窗口 tail 透传;`hasPriorAssistantAnswer(history, { summaryText })` 忽略寒暄回复、摘要存在即追问;`natalUserTurnShape` 与 `route.ts` 两处调用带 `historyWindow.summaryText`。`product-voice.ts` Never 段一句改措辞(原句第二个分句读成也被禁止)。
- 断言三栏:`consult-single-pass-answer-20260927.test.ts`(route 源码匹配:原值不带 summaryText / 新值带 / 原因如上)、`consultation-voice-contract.test.ts`(Never 句:原值分号并列 / 新值拆两句 / 原因措辞)。新增用例见 `consultation-thinking-plan.test.ts`、`consultation-session-history.test.ts`。
- 复跑门禁数字见下方「Claude 验收」。
## Claude 验收(2026-09-27 晚,Node 22.14,本工作树,含补修)
| 项 | 结果 |
| --- | --- |
| `tsc --noEmit` | 0 错 |
| `npm run lint` | 0 error(既有 warning 未动) |
| `npm test` | 4197(基线 4192,+5);pass 4143 / fail 24 / skipped 30;24 条失败按名称与基线逐条一致(无 Docker 的 DB / 部署套件) |
| `next build --webpack` | exit 0;`/`、`/chart`、`/ephemeris`、`/people` 仍 ○ Static;首屏 gzip 以执行方实测 130,933 B(=基线)为准,补修只改服务端与 lib 类型 |
| 真机 | 未做(无登录态、无模型凭据),见 `docs/testing/consult-answer-the-question-20260927.md` 8 条 |
结论:T1–T6 通过;补修一处(寒暄回复误判追问)已并入本分支。推 staging 后核对 `/api/health` 的 `deployment.gitCommit`。
@@ -13,5 +13,6 @@
| 5 | 第 1~4 步过程中看步骤栏 | 第一节标题是「先回答你问的这件事」;首轮它的步骤是「用盘上的反差回答这个问题」,第 2、3 步是「直接回答这句话」;没有「先抓住你真正在问的事」;写作行不出现「正在写先回答你的问题」 | |
| 6 | 第 2 步的回答完成后,看用量 / 后台 | 仍然计一次排盘、扣一次点(追问轮照常调用排盘工具) | |
| 7 | 换无出生分钟的星盘问「今天适合做什么」 | 开场结尾仍有一到三条短行动(无骨架模式行动留在开场);不出现本命结构 | |
| 8 | 新会话先发「你好」,收到一句寒暄回复后再问「我和父母的关系怎么看」 | 仍是第 1 步的首轮形状(口语开场 + 三个二级标题),不是 200 字追问形状(寒暄回复不算上一轮解读) | |
任一条不符,按 BUG-1070~1073 追加记录,附问句句式与回答的**结构描述**(标题、字数、第一句是不是是 / 不是),不贴回答原文。