Repository navigation
Conversation
Reserve collector FIFO before asynchronous requester lookup, retaining worker-backed reads and existing reservation cleanup. Preserve ordinary requester identity, cancellation, and error behavior. Add controlled lookup-order, failure, and cancellation regressions.
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: blocked before merge. Reviewed September 26, 2026, 8:52 PM ET / September 27, 2026, 00:52 UTC (Revision 2). ClawSweeper reviewWhat this changesThe branch moves collector requester-session lookup after FIFO reservation and adds ordering, lookup-failure, and cancellation regression tests. Regression provenancePossible regression — probable (reviewed change; failure trace). No predecessor PR is attributed. Merge readiness⛔ Blocked before merge - 4 items remain Current main fixes the collector ordering race, but this PR still contains distinct early-cancellation behavior worth considering. The branch conflicts with main and would record a replacement requester session if the spawn-effects callback rotates the completion owner. It needs a narrow maintainer disposition, not an automatic closure or merge. Priority: P2 Review scores
Verification
How this fits togetherOpenClaw's subagent spawn path accepts collector requests and passes them to a per-group scheduler. It captures the requesting session, reserves a queue position, and eventually records and launches a child run. flowchart LR
A[Collector request] --> B[Validate requester]
B --> C[Reserve group position]
C --> D[Capture requester session]
D --> E[Prepare child run]
E --> F[Launch or release reservation]
Decision needed
Why: The central race is fixed on main, but this branch contains a narrow remaining behavior change and cannot merge cleanly as submitted. Before merge
Findings
Agent review detailsSecurityNone. PR surfaceSource +39, Tests +114. Total +153 across 3 files. View PR surface stats
Review metricsNone. Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Keep main's scheduler-owned hold and capture-before-effects order; port the distinct already-cancelled collector error behavior and any nonduplicated cancellation coverage in a narrow update. Do we have a high-confidence way to reproduce the issue? No current-main reproduction of the original FIFO race is expected: main reserves and holds before requester lookup and has a forced-order test. The branch's requester-identity regression and main's early-cancellation error gap are source-reproducible; this read-only review did not execute them. Is this the best way to solve the issue? No. Main's existing scheduler hold is the narrower FIFO owner; the useful cancellation behavior should be retained without moving requester capture past the effects callback. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 44465b447252. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (1 earlier review cycle)
|
|
Heads-up: #159272, #159273, and #159274 all target the same failure. Before landing, please merge |
|
Closing as superseded by 5cf18de ( |
What Problem This Solves
Concurrent collector spawns can launch out of submission order when the later request's asynchronous requester-session lookup finishes first.
User Impact
Collector launches retain the documented FIFO order under the group's concurrency limit. Failed or cancelled requester lookups release their reserved position so later collectors can proceed. Ordinary child cancellation, requester identity, and private completion behavior are preserved.
Why This Change Was Made
The requester-worker change in #159135 placed an await ahead of the existing collector FIFO reservation. The scripts sweep in #159199 exposed the race through the Gateway queued-collector suite on its CI merge tree.
Collectors now reserve their position before their first await and capture the requester after the executor holds that reservation. The existing executor cleanup withdraws and releases the reservation on lookup failure or cancellation. Ordinary spawns keep their previous capture and admission order. Both paths use one requester-read helper, retain worker-backed SQLite access and authority checks, and preserve the established error result for already-cancelled calls. There is no additional queue, configuration, schema, or protocol.
Evidence
Independent Codex review of the complete candidate is scoped-clean through P2. Validation ran on Blacksmith Testbox run 36276852584, lease
tbx_01m3fxtnhhmxefc0rman8xk4fb, with Node 24.19.0 and pnpm 12.4.2. The lease is stopped. It verifies all changed source hashes after synchronization against base547bb312f4098cd0f28f71cc45a7e351e944b1ff.pnpm test src/agents/subagents/spawn/subagent-spawn.requester-incarnation.test.ts --maxWorkers=1, 28.347s wall (includes worker preparation).node scripts/check-changed.mjs --base 547bb312f4098cd0f28f71cc45a7e351e944b1ff --timedpasses in 468.380s, including all 25 core-test type graphs, lint, dead exports, cycles, and storage/security guards.pnpm buildpasses in 406.349s. The final wrapper returnsexitCode: 0/runStatus: succeeded.The original CI failure was in
session-utils.queued-collector.test-support.ts:222on merge treeb014d5fc4348a0ccc7b4c5d9b0694ab93c82fc00. A replay of the exact 18-file group on that unmodified tree passed, demonstrating why a passing retry is not a fix. The new controlled lookup inversion supplies the original-red/candidate-green proof without sleeps, retries, weaker assertions, or serialized spawn submissions.The entry-point composition is necessary: the scheduler’s existing FIFO unit coverage passes while the original requester lookup can reorder calls before they reach it. These tests use explicit promise gates and the existing isolated state fixture, with no model or network calls.
Superseded by main:
5cf18de3d103a6bea797cbfe52fa8f51dce8c596independently landed the FIFO repair while this PR was completing CI. The landed owner retains the exact reservation hold through requester acquisition and transfers it into execution, with requester-incarnation and failed-read coverage. Fresh Blacksmith Testbox verification of the landedsrc/gateway/session-utils.queued-collector.test.tspasses all 35 cases in 62.905s on the main-containing scripts candidateecd179ea0355eabe424743c38497acb13d7bbcab. Closing this duplicate unmerged so there is one canonical implementation. The earlier independent proof and successful CI remain recorded above.