fix(api): always propagate invocationId in callback broadcasts (#454)#455
fix(api): always propagate invocationId in callback broadcasts (#454)#455
Conversation
Three callback broadcast paths omitted invocationId from system_info payloads, forcing the frontend to rely on heuristic matching for rich_block events. This made late callbacks across invocation boundaries produce duplicate bubbles. - post_message rich_block SSE: add invocationId - create-rich-block broadcast: add invocationId - post_message text: make invocationId unconditional (always present via callback auth) - callback-document-routes file block: add invocationId [宪宪/Opus-46🐾]
Covers the P2 from gpt52 review — the /api/callbacks/generate-document path now has a dedicated test asserting its broadcast includes invocationId. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
@codex review Please review latest commit 1d61a23 for P1/P2 only. 规则:任何 P1/P2 必须给"可执行复现":
审查标准(详见 AGENTS.md "Review guidelines" section):
|
|
Codex Review: Didn't find any major issues. Breezy! ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
|
Hi @mindfn — summarizing the maintainer view from both reviews:
We don't have additional P1/P2 concerns from the maintainer side. From our side, this is the version worth merging. Thanks for pivoting quickly from the heuristic mitigation to the protocol fix — that's exactly the kind of course correction we hope to see in community contributions. — 砚砚 / GPT-5.4 |
…#455) * fix(api): always propagate invocationId in callback broadcasts (#454) Three callback broadcast paths omitted invocationId from system_info payloads, forcing the frontend to rely on heuristic matching for rich_block events. This made late callbacks across invocation boundaries produce duplicate bubbles. - post_message rich_block SSE: add invocationId - create-rich-block broadcast: add invocationId - post_message text: make invocationId unconditional (always present via callback auth) - callback-document-routes file block: add invocationId [宪宪/Opus-46🐾] * test(#454): add generate-document invocationId broadcast regression test Covers the P2 from gpt52 review — the /api/callbacks/generate-document path now has a dedicated test asserting its broadcast includes invocationId. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
What
callbacks.ts: unconditionally propagateinvocationIdin text broadcast, rich_block system_info broadcast (post-message), and create-rich-block broadcastcallback-document-routes.ts: addinvocationIdto generate-document file block broadcastcallback-routes.test.js: 4 regression tests covering all callback broadcast pathsWhy
Callback-origin websocket payloads were missing
invocationId, forcing the frontend into heuristic content-matching to deduplicate late-arriving callback bubbles. Since every callback route already hasinvocationIdin scope (required for auth), propagating it is zero-cost and gives the frontend an exact-match key.Closes #454
Original Requirements
Plan / ADR
Tradeoff
放弃了 PR #410 的客户端 heuristic 方案(time+content fence),选择协议层修复。原因:铲屎官明确要求根治而非缓解,且 invocationId 已在 callback auth scope 内,零新增字段。
Test Evidence
node --test packages/api/test/callback-routes.test.js # 80 passed, 0 failed
pnpm check # green
pnpm lint # green (only pre-existing web warnings)
pnpm -r --if-present run build # success
Open Questions
本地 Review: [x] gpt52 已 review 并放行(两轮,P2 已修复)
云端 Review: [ ] PR 创建后在 comment 中触发(见下方模板)