Repository navigation
fix(gateway): report worker errors returned before launch - #124387
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: needs maintainer review before merge. Reviewed August 16, 2026, 1:08 AM ET / 05:08 UTC. ClawSweeper reviewWhat this changesThe PR makes Gateway chat dispatch treat a returned worker error as the terminal result even when the worker rejects before an agent run starts. Merge readinessThe narrowed PR remains necessary: current main still ignores returned error payloads unless an agent run started, while this branch records and broadcasts those pre-launch errors. The earlier prewarm findings no longer apply after the split; no new blocking defect was found. Priority: P1 Review scores
Verification
How this fits togetherGateway chat dispatch sends a request into the agent runtime, captures returned reply payloads, then broadcasts and deduplicates the terminal outcome. This change corrects the branch that classifies a pre-launch returned error as a normal reply instead of an error. flowchart LR
A[Chat request] --> B[Gateway chat dispatch]
B --> C[Agent runtime]
C --> D[Returned reply payload]
D --> E{Error payload?}
E -->|Yes| F[Persist terminal error]
F --> G[Broadcast error to waiting clients]
E -->|No| H[Normal reply finalization]
Before merge
Agent review detailsSecurityNone. PR surfaceSource -1, Tests +6. Total +5 across 2 files. View PR surface stats
Review metrics
Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Land the focused terminalization repair once exact-head checks are green, retaining the single error broadcast and dedupe path for both launch states. Do we have a high-confidence way to reproduce the issue? Yes—current main source excludes pre-launch returned errors at src/gateway/server-methods/chat-send-agent-dispatch.ts:398, and the PR’s focused Gateway fixture isolates that same path. Is this the best way to solve the issue? Yes—the dispatch terminalization boundary already owns broadcasts and dedupe entries; changing its classification avoids falsely declaring an agent run started or adding a parallel error path. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 203aafc4156c. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (1 earlier review cycle)
|
7d1d6eb to
f9583ad
Compare
|
Split applied as requested.
The thin head is |
|
Merged via squash.
|
What Problem This Solves
Fixes an issue where a delegated worker rejection returned before the agent-run-start boundary could be delivered internally but recorded as a successful or missing terminal outcome, leaving wait and dedupe clients without the actual error.
Why This Change Was Made
Chat dispatch now treats returned error payloads as authoritative for normal turns whether the worker failed before launch or after the agent run started. Internal text slash commands retain their existing non-agent reply behavior.
User Impact
Waiting clients receive and retain the real worker error when launch is rejected, instead of an ambiguous success or a missing completion.
Evidence
node scripts/run-vitest.mjs src/gateway/server-methods/chat.directive-tags.test.ts— 199 passed on the rebased two-file head.Split From The Original PR
The Node bundle prewarm work was removed from this PR. It is parked on
steipete/bundle-prewarm-negotiatedfor a separate draft that requires mixed-version capability negotiation and abort propagation before it can be considered for merge.