Repository navigation
Conversation
|
Codex review: needs real behavior proof before merge. Reviewed July 9, 2026, 11:26 AM ET / 15:26 UTC. Summary PR surface: Source +10, Tests +15. Total +25 across 2 files. Reproducibility: yes. Source inspection shows current main stores the queued entry and only rejects already-aborted signals; aborting the controller after registration has no current-main listener that deletes the map entry. Review metrics: none identified. Root-cause cluster Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Rank-up moves:
Proof guidance:
Risk before merge
Maintainer options:
Next step before merge
Security Review detailsBest possible solution: Land this focused helper-level cleanup after the contributor adds real gateway behavior proof and maintainers refresh exact-head CI; keep #102914 as the canonical issue until merge. Do we have a high-confidence way to reproduce the issue? Yes. Source inspection shows current main stores the queued entry and only rejects already-aborted signals; aborting the controller after registration has no current-main listener that deletes the map entry. Is this the best way to solve the issue? Yes. Adding cleanup at AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 436ed5f3085b. Label changesLabel changes:
Label justifications:
Evidence reviewedPR surface: Source +10, Tests +15. Total +25 across 2 files. View PR surface stats
What I checked:
Likely related people:
What the crustacean ranks mean
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics. How this review workflow works
|
4d085bf to
b3efa7b
Compare
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. |
|
Superseded by #103194, landed as The landed owner-layer fix includes the abort listener plus exact controller/entry guards for completion, collect retirement, and synchronous replacement during single/bulk abort cleanup. Those identity checks are required to prevent a delayed callback from deleting a newer queued turn that reused the same run ID. Exact-head hosted CI, 160 focused Gateway tests, live TUI cancellation/collect scenarios, and post-merge current-main gates are green. Closing this narrower duplicate in favor of the canonical implementation. |
What Problem This Solves
Fixes #102914 —
registerQueuedChatTurndid not register an abort listener on the AbortSignal. If a client disconnected and the followup never reached the queue drainer, the entry would leak inchatQueuedTurnsuntil gateway restart.Why This Change Was Made
The drain path (
drain.ts) normally callscompleteQueuedChatTurnvia the lifecycle callback when it detects an aborted signal. However, there is a window between registration and drain admission where a direct client-disconnect abort can fire without anyone checking the map. Registering a{ once: true }abort listener on the controller ensures the entry is cleaned up regardless of the drain state. The listener guards against removing retired collect identities (abortable: false) so idempotency protection is preserved.The pattern matches existing defensive abort-listener usage elsewhere in the codebase (
command-queue.ts:350,process/exec.ts:614,channel-lifecycle.core.ts:116).User Impact
Prevents a slow memory leak in the gateway when clients disconnect while queued chat turns are pending, without breaking idempotency for retired collect-mode entries.
Evidence
Real Gateway queue behavior proof
Run against the production
src/gateway/chat-queued-turns.tsmodule:The proof script (src/gateway/chat-queued-turns.proof.ts) exercises the production module:
Unit test results
40 tests pass across 4 gateway configs (gateway-core, gateway-server, gateway-client, gateway-methods), including the new tests: