[codex] fix gateway chat.abort send race#84274
Conversation
|
Thanks for the context here. I swept through the related work, and this is now duplicate or superseded. Close this PR as superseded: it targets a valid Gateway abort race, but #84306 is the open canonical fix for the same issue with live Gateway proof plus additional cleanup/error handling that this branch is missing. Canonical path: Use #84306 as the canonical review and landing path for the Gateway abort race, and close this duplicate branch to avoid splitting review across two similar fixes. So I’m closing this here and keeping the remaining discussion on #84306. Review detailsBest possible solution: Use #84306 as the canonical review and landing path for the Gateway abort race, and close this duplicate branch to avoid splitting review across two similar fixes. Do we have a high-confidence way to reproduce the issue? Yes from source inspection: current main awaits attachment/model preparation before registering the abort controller, and Is this the best way to solve the issue? No for this branch as-is: early registration is the right direction, but the canonical sibling is the safer solution because it also handles aborted prep failures, cleans pre-dispatch media, and supplies live Gateway proof. Security review: Security review cleared: The diff only touches Gateway TypeScript behavior and tests, with no concrete security or supply-chain concern found. What I checked:
Likely related people:
Codex review notes: model gpt-5.5, reasoning high; reviewed against 6048cd43a5ab. |
|
ClawSweeper applied the proposed close for this PR.
|
Summary
chat.sendruns inchatAbortControllersbefore awaited attachment/model preparation so immediatechat.abortcalls can still find the active rundispatchInboundMessageRoot Cause
chat.sendonly registered its abort controller after awaited attachment preparation finished, whilechat.abortreturnsaborted: falseimmediately when therunIdis absent. An immediate abort during image/file preparation could therefore miss the in-flight run window.Verification
node scripts/run-vitest.mjs src/gateway/server.chat.gateway-server-chat-b.test.ts src/gateway/server-methods/chat.abort-authorization.test.ts src/gateway/chat-abort.test.tsReal behavior proof
Behavior addressed:
chat.abortno longer misses an activechat.sendrun when the abort arrives during attachment preparation.Real environment tested: Local Gateway Vitest harness on rebased
upstream/main.Exact steps or command run after this patch:
node scripts/run-vitest.mjs src/gateway/server.chat.gateway-server-chat-b.test.ts src/gateway/server-methods/chat.abort-authorization.test.ts src/gateway/chat-abort.test.tsEvidence after fix: Added a regression in
src/gateway/server.chat.gateway-server-chat-b.test.tsthat startschat.sendwith an image attachment, blocks attachment preparation on model-catalog resolution, issueschat.abortimmediately, and assertsaborted: true, active-run cleanup, and no downstream dispatch.Observed result after fix: The immediate abort succeeds during attachment preparation and the targeted Gateway suite passes on latest
upstream/main.What was not tested: No live gateway/manual UI repro, no broad
pnpm check*, and no Crabbox/Testbox run.Fixes #84176