Repository navigation
fix(agent-chat): avoid duplicate Claude child close - #15909
Conversation
Add a regression for two parallel Claude spawn-tool children. The second child must remain running after the first child's PostToolUse and duplicate SubagentStop events. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude brackets child runs with the spawn tool's PostToolUse, and its SubagentStop hook arrives as a second close without a request id. Skip that duplicate event only for Claude so the existing FIFO fallback and SubagentStart/SubagentStop behavior for Codex, pi, and OMP remain unchanged. This source-specific guard is smaller and safer than adding deduplication state to closeChild. Correct the custom sidebar documentation to describe FIFO closing and the request id field the code actually decodes. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
|
All contributors have signed the CLA ✍️ ✅ |
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 8 minutes. View limit detailsLimit details: You’ve used all 10 included reviews currently available. Review configuration: ⚙️ Run configurationConfiguration used: Repository: manaflow-ai/cmux/.coderabbit.yaml Review profile: ASSERTIVE Plan: Advanced Run ID: 📒 Files selected for processing (3)
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository: manaflow-ai/cmux/.coderabbit.yaml Review profile: ASSERTIVE Plan: Advanced Run ID: 📒 Files selected for processing (3)
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 0 remain after this review. 📝 WalkthroughWalkthroughThe registry ignores Claude-sourced ChangesChild run stop handling
Priority: ⬇️ Low Estimated code review effort: 2 (Simple) | ~10 minutes Change: Bug fix · Severity of issue fixed: Low Suggested reviewers: Merge Risk: ⚪ Minimal · up to Claude Task/Agent children still close through PostToolUse, and the telemetry stop event no longer risks closing a sibling. No merge-blocking regression is established. Security Architecture ReviewSecurity architecture risk: 🔵 Low · up to The change prevents duplicate completion events from marking another child finished, without adding access or privileges. Remaining uncertainty concerns child-status accuracy when completion events are missing; parent completion still clears open children. Retained concerns Security review detailsSecurity Blast Radius
Trust Boundaries and Controls
Resilience and Maintainability Implications
Important Pre-merge checks failedPlease resolve all errors before merging. Addressing warnings is optional. ❌ Failed checks (1 error, 1 warning)
✅ Passed checks (23 passed)
Full details: Docstring CoverageExplanation Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 5 functions across 2 files. (1 skipped: 1 unsupported.) Full details: Cmux Full InternationalizationExplanation The PR changes user-facing documentation in Resolution Route the changed documentation through the locale-specific documentation system and provide matching translated content for every locale in ✨ Finishing Touches 💡 1📝 Generate docstrings 💡
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Review: the guard is on the wrong eventReviewed at Ignore
|
Add a regression showing that a Claude child must stay running after the spawn tool returns and settle only when SubagentStop arrives. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude's spawn tool PostToolUse fires when a foreground or background child detaches, so it is not a completion signal. Ignore it for Claude and close the child on the SubagentStop hook instead. Keep the existing post-tool and FIFO behavior for Codex, pi, and OMP, and document the corrected lifecycle. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
|
Review: the fresh read-only review found no concrete functional, test, documentation, or repository-rule issues. Fixed: Claude Left: the macOS test target was not run locally. CI exercises it. |
Both review items are addressed at
|
CI failure attributionCI passes on Written by |
Dogfood tours of
|
The four reds are inherited from the merge point, and main already fixed themThe failing step is None of it comes from this branch. The cause is a submodule pointer that lagged its own call sites on main:
So merging current main into the branch picks up the bumped pointer and the compile error goes away. Nothing in the agent-chat change needs to move. Worth noting for the merge itself: a submodule pointer is the kind of thing a zero-conflict merge resolves quietly to the wrong side, so confirm 🤖 Generated with Claude Code |
Correction: I had the bonsplit pointer backwardsMy previous comment named
This branch's own pin, So there is nothing to change here and no merge to do. It is tracked on #15488, and #15930 restores the pin. This PR waits for that to land, then needs only a rerun. Apologies for the detour; the instruction I sent alongside the earlier comment would have replaced a working pin with the broken one. 🤖 Generated with Claude Code |
|
The failing test is #14302 ( Fix is open as #16024. |
|
Merge receipt for
|
d1ec789 Deduplicate Cloud terminal recovery requests (manaflow-ai#15906) 388ce45 fix(ios): keep terminal composer input literal (manaflow-ai#15991) bfdd953 fix(agent-chat): avoid duplicate Claude child close (manaflow-ai#15909) 3b29735 test(ci): cover per-run iOS E2E backend scripts and make the lane dispatch-only (manaflow-ai#15852) aed397a fix(ios): expect memory token store for a missing app identity (manaflow-ai#16024) 304d346 ci: bound each cmux-tui client download so a stalled stream can't hang the Release build (manaflow-ai#15944) f81376a ci: type-check agent-chat with pinned TypeScript (manaflow-ai#16008) 857d2b3 ci: treat a reused app-host receipt PID as a stale receipt, not a cleanup failure (manaflow-ai#15958) 76d5bab test: pay macOS's first-run check before timing wrapper fixtures (manaflow-ai#15955) 5e88c1a Add forward-only submodule CI guard (manaflow-ai#15943) 8cfe728 fix(sidebar): finish popover closes whose didClose never arrives (manaflow-ai#14958) # Conflicts: # .github/workflows/ci-guards.yml # .github/workflows/ios-e2e.yml
What changed
Claude child runs are bracketed by the spawn tool's
PreToolUseandPostToolUseevents. Claude also emitsSubagentStop, but that event has no request id in this path. The second close therefore used FIFO and could settle a sibling that was still running when two children were spawned in parallel.The registry now ignores
SubagentStopfor Claude. Codex, pi, and OMP still close children throughSubagentStop. The sidebar documentation now describes the FIFO behavior and the_opencode_request_idfield that the code actually decodes instead ofagent_id.The defect was found while reviewing PR 15865.
Tests
python3 scripts/verify-local.py --allpassed all 15 checks.Changelog
🤖 Generated with Claude Code
Need help on this PR? Tag
@codesmith-botwith what you need. Autofix is disabled.Summary by cubic
Fixes Claude parallel child runs settling twice when both the spawn tool's
PostToolUseand aSubagentStopclosed the same child, FIFO-closing a sibling still running.The registry now ignores
PostToolUsefor Claude — a background spawn returns at detach while the child keeps running — and settles the child onSubagentStopinstead. Codex, pi, and OMP keep closing children via theirSubagentStart/SubagentStoppair, with the FIFO fallback when no request id is present. Sidebar docs now describe the FIFO closing behavior and note thatagent_idis not read; only_opencode_request_idcan correlate a stop. Adds regression tests covering two parallel Claude spawns with the duplicate stop and the background child lifecycle.Written for commit a65cfb5. Summary will update on new commits.
Summary by CodeRabbit
agent_iddoes not correlate stop events to children.