fix(web): accept unknown stream payload when binding spoken prompts
Independent Staging Quality Gate / validate (push) Successful in 21m40s
Independent Staging Quality Gate / publish (push) Successful in 11m12s

Publish next build failed because the spoken-bind helper required result/output
on chunk payload, which the runner stream type does not have.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Jesse_Chen
2026-08-26 00:27:49 +08:00
parent 97b02aef5d
commit 9326b7d0a4
4 changed files with 28 additions and 4 deletions
+16
View File
@@ -5643,6 +5643,22 @@
- 复发自:BUG-351(一件带日期事件后冲突探针插队,早于采用门)
- 修复版本:待发布
## BUG-387 | staging publish 的 next build 被口语绑定 chunk 类型挡住
- 状态:resolved
- 首次发现:2026-08-26
- 最近更新:2026-08-26
- 影响面:`openQuestionPromptFromToolResult``runV9AgentTurn``deploy/railway-web.Dockerfile``RUN npm run build`
- 用户现象:向 `staging` 推送 `97b02aef` 后 quality gate run `2080` 的 validate 通过,publish 在 web 镜像 `next build` 失败。没有 dispatch `Deploy staging`。公网仍为上一成功 SHA。
- 触发条件:staging push 的 publish 镜像构建跑 `next build`。validate 对 staging push 跳过 production build。
- 根因:运行器把流式 chunk 传给 `openQuestionPromptFromToolResult`,函数把 `payload` 收成 `{ result?: unknown; output?: unknown }`。流式 chunk 的 payload 是 `toolName` / `text` / `args`TypeScript 判为 TS2345。日志末尾 Import traces 只是动态文件访问警告。
- 修复:函数改收 `payload?: unknown`,再从 result/output/object 读已盖戳题干。不改 Skill `10.0.11`
- 验证:`npx tsc --noEmit` 不得再报 `agent-run.ts` 的 TS2345`frontend/tests/rectification-v9-stream.test.ts`
- 防复发:改 `runV9AgentTurn` 流式 chunk 形状后必须跑 `npx tsc --noEmit` 或等价的 `next build`。staging push 的类型回归仍只在 publish Docker 暴露。
- 相关记录:BUG-309、BUG-365、BUG-371、BUG-384
- 复发自:BUG-309validate 跳过 `next build`,publish 才暴露类型错误);BUG-384 口语绑定收窄了 payload
- 修复版本:待发布
## BUG-379 | 生时纠正已记入学后仍编造高考年并再问入学
- 状态:resolved
@@ -48,12 +48,15 @@ export function readOpenQuestionPrompt(value: unknown): string | null {
export function openQuestionPromptFromToolResult(chunk: {
type?: string;
payload?: { result?: unknown; output?: unknown };
payload?: unknown;
object?: unknown;
}): string | null {
if (chunk.type !== "tool-result") return null;
return readOpenQuestionPrompt(chunk.payload?.result)
?? readOpenQuestionPrompt(chunk.payload?.output)
const payload = chunk.payload && typeof chunk.payload === "object" && !Array.isArray(chunk.payload)
? chunk.payload as Record<string, unknown>
: null;
return readOpenQuestionPrompt(payload?.result)
?? readOpenQuestionPrompt(payload?.output)
?? readOpenQuestionPrompt(chunk.object)
?? readOpenQuestionPrompt(chunk.payload);
}
@@ -245,6 +245,11 @@ test("usage completes or releases without hiding settlement failures", () => {
assert.match(run, /if \(!answerText\.trim\(\)\) \{[\s\S]*composeRectificationTurnNarration/);
assert.match(run, /bindSpokenToOpenQuestion/);
assert.match(run, /openQuestionPromptFromToolResult/);
const narration = readFileSync(
new URL("../src/lib/rectification-agentic/v9/turn-narration.ts", import.meta.url),
"utf8",
);
assert.match(narration, /payload\?: unknown/);
assert.doesNotMatch(run, /splitRectificationSpokenAndThinking/);
assert.match(run, /emit\(event: PublicStreamEvent\): Promise<void> \| void;/);
assert.match(run, /agentGenerationSettings\(options\.generationModel, \{[\s\S]*thinking: "enabled"/);
@@ -1371,7 +1371,7 @@ test("persisted choice prompt replaces a competing model follow-up without a top
);
assert.equal(openQuestionPromptFromToolResult({
type: "tool-result",
payload: { result: { open_question: { prompt } } },
payload: { toolName: "rectification-record-evidence-batch", result: { open_question: { prompt } } },
}), prompt);
const { options, emitted } = runOptions({