Repository navigation
Conversation
Serialize requester acquisition through FIFO reservation per collector group. Keep requester capture before effects and authority checks before admission; child preparation and execution remain outside the request queue. Extend the existing queued session projection case with a requester lookup that completes out of submission order. It fails against the original product with the same launched-run mismatch reported in CI; retain the FIFO assertions. Blacksmith Testbox proof: deterministic baseline 1 failed / 33 passed; fixed file 30 clean runs / 1020 tests; seven owner and sibling files / 173 tests; three original 15-file shard replays / 396 tests each; check-changed passed; independent review clean through P2. Single-worker file command: 62.43s wall. An earlier extra shard replay failed workspace temp-ancestor permission admission. The exact offending ancestor was not captured before that lease finished. The unchanged candidate passed three replays on a fresh lease with the normal temp environment; no permission policy or fixture was weakened.
|
🦞👀 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: needs maintainer review before merge. Reviewed September 26, 2026, 8:21 PM ET / September 27, 2026, 00:21 UTC. ClawSweeper reviewWhat this changesSerializes collector spawn request resolution per Swarm group through FIFO reservation and adds a Gateway regression case with out-of-order requester reads. Merge readiness✅ Ready for maintainer review Current main still permits concurrent requester reads to reverse the documented collector submission order. The proposed repair addresses that race, and the review found no blocking defect. Priority: P2 Review scores
Verification
How this fits togetherOpenClaw’s subagent spawn path receives collector requests from agent tools, reads the requester session, reserves a Swarm group slot, and then prepares and launches child runs. flowchart LR
A[Collector requests] --> B[Swarm group identity]
B --> C[Per-group request queue]
C --> D[Requester session read]
D --> E[FIFO reservation]
E --> F[Child preparation and launch]
Before mergeNone. Agent review detailsSecurityNone. PR surfaceSource +10, Tests +17. Total +27 across 2 files. View PR surface stats
Review metricsNone. Technical reviewBest possible solution: Keep the Swarm scheduler as the FIFO owner while ordering same-group requester reads before reservation and preserving authority checks before child effects. Do we have a high-confidence way to reproduce the issue? Yes. Concurrent same-group collector spawns with the first requester read delayed expose the read-before-reservation race on current main; the PR reports a failing baseline, though this review did not execute it. Is this the best way to solve the issue? Yes. The repair orders only same-group request resolution through reservation, using the existing queue helper and leaving child preparation with the existing spawn and scheduler owners. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against e68cfe26f13a. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
|
|
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
collectsubagent spawn requests in the same swarm group could launch out of submission order. The collector admits children FIFO, so the first-submitted request should reserve and launch first; instead, whichever request finished an earlier async step first won. This surfaced as an intermittent CI failure insrc/gateway/session-utils.queued-collector.test.ts(shardagentic-gateway-server-isolated-hosted-19), hitting two unrelated PRs (#159173, #159185) on the same day withexpected [ <run A> ] to deeply equal [ <run B> ].Why This Change Was Made
resolveSubagentSpawnRequest(src/agents/subagents/spawn/subagent-spawn-request.ts) awaited the requester session lookup (capturing the requester window so a reset cannot redirect child results) before reserving the request's FIFO slot. Under load a later request's lookup could resolve first, so it reserved and launched first. The test was asserting a real ordering guarantee; the product violated it.The group key (
[requesterAgentId, requesterInternalKey, swarmGroupId]) is now derived synchronously, and for collector requests the whole resolution, requester capture through FIFO reservation, runs in a per-groupKeyedAsyncQueue(the same helper ACP and meeting-bot already use in core). Submission order is therefore reservation order within a group. Non-collector requests bypass the queue, other groups stay concurrent, and child preparation and execution remain outside the critical section. The queue isolates rejections and drops a key once its tail settles.User Impact
Collected (swarm) subagents launch in the order they were requested, and the recurring
queued-collectorCI failure goes away.Evidence
session-utils.queued-collector.test.ts: fails onmain(1 failed, 33 passed) with the observed run-id mismatch; passes with the fix.node scripts/check-changed.mjspassed.src/plugin-sdk/keyed-async-queue.ts.Production LOC: +196 / −186 (net +10; whitespace-insensitive: +23 / −15 — the body moved into a closure). Tests: +18 / −1.