Repository navigation
fix(codex): avoid duplicate subagents after yielded fanout - #118644
Conversation
d364260 to
e33d8bb
Compare
|
Codex review: needs maintainer review before merge. Reviewed August 3, 2026, 7:42 AM ET / 11:42 UTC. ClawSweeper reviewWhat this changesThe branch records accepted Merge readinessKeep this PR open for maintainer handling. The source-level path and focused tests are coherent, but OpenClaw policy requires direct inspection of the sibling Codex source before any Codex verdict, proof-sufficiency claim, or merge recommendation; Priority: P1 Review scores
Verification
How this fits togetherThe Codex extension bridges Codex app-server tool calls into OpenClaw tools, applies result middleware, and projects the outcome into the embedded-agent run result. When a parent turn yields after launching child sessions, that result determines whether OpenClaw waits for those children or may replay the parent turn. flowchart LR
A[Codex parent turn] --> B[OpenClaw dynamic tools]
B --> C[Result middleware]
C --> D[Codex event projector]
D --> E[Embedded run result]
E --> F{Yielded turn}
F --> G[Wait for child sessions]
F --> H[Replay only when safe]
Decision needed
Why: The repository policy explicitly prohibits a Codex verdict, proof-sufficiency claim, or merge recommendation without that direct source inspection; the review environment lacks Before merge
Agent review detailsSecurityNone. PR surfaceSource +28, Tests +58. Total +86 across 4 files. View PR surface stats
Review metrics
Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Verify the active-turn and yielded-continuation protocol directly against sibling Codex source, then retain this narrow telemetry-preservation fix if that contract confirms OpenClaw must wait rather than replay the parent turn. Do we have a high-confidence way to reproduce the issue? No high-confidence local runtime reproduction was run. The source and focused branch tests establish the suspected middleware-stripping path, but direct Codex protocol confirmation is unavailable in this environment. Is this the best way to solve the issue? Unclear. Capturing accepted spawn evidence before presentation middleware is the narrow owner-boundary repair suggested by the source, but repository policy requires direct Codex-source validation before it can be judged the best solution. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 757d22020362. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
|
|
Maintainer decision: proceed with this owner-boundary fix. I completed the required direct sibling Codex inspection against
That contract confirms the replay-safety boundary: once OpenClaw has accepted child launches and yielded the parent turn, it must preserve those launch facts and settle through the existing requester-continuation path. Replaying the parent prompt is not a valid substitute for steering the completed/yielded turn and causes the duplicate launches reproduced by the QA scenario. ClawSweeper rank-up moves:
No additional code change is warranted. The patch already passed the OpenClaw/Codex fanout runtime pair, 149 focused tests, |
|
Merged via squash.
|
What Problem This Solves
Fixes an issue where Codex app-server users could launch duplicate subagents and time out when a turn spawned children and yielded for their completion.
The accepted child launches were visible in the tool result, but result middleware could remove those structured details before the run attempt recorded continuation evidence. The yielded turn was then treated as replay-safe and the parent prompt ran again.
Why This Change Was Made
Record accepted
sessions_spawnevidence from the sanitized execution result before presentation middleware runs, then carry it through the Codex event projector into the normal subagent continuation and replay-safety paths.This keeps the fix inside the Codex app-server bridge while matching the existing embedded-agent runtime contract.
User Impact
Codex turns that yield after spawning subagents now wait for the accepted children and resume with their results instead of replaying the parent prompt and launching duplicates.
Evidence
Before: the exact
subagent-fanout-synthesisCodex cell timed out after 90 seconds with six tool calls and duplicate alpha/beta launches.After: Blacksmith Testbox
tbx_01kz3nngvx2st4cjwdd7ks9ggy, run https://github.com/openclaw/openclaw/actions/runs/30809157173:pnpm check:changedpassed forextensions,extensionTests, anddocsFresh autoreview: no accepted/actionable findings; overall correctness 0.98.
Direct Codex contract checked:
turn/steeraccepts input only for the matching active turn, so OpenClaw must preserve accepted child-launch evidence and wait rather than replaying the parent prompt.AI-assisted; I reviewed and understand the implementation and proof.