Subagent-attributed "Ready to code?" approval dialog shows the AO's own plan-mode content, not the subagent's, and isn't gated on the subagent actually requesting approval
Preflight Checklist
- [x] I have searched existing issues and this hasn't been reported yet
- [x] This is a single bug report (please file separate reports for different bugs)
- [x] I am using the latest version of Claude Code
What's Wrong?
Summary:
In a session using the Agent tool to dispatch a plan-mode subagent (permissionMode: plan) while the parent session independently holds its own EnterPlanMode window open, the interactive UI periodically surfaces a "Ready to code?" approval dialog labeled from the <subagent-name> agent. The dialog's actual content is the parent session's own plan file — not any plan drafted by the named subagent — and it can appear/be approved before the subagent has ever called ExitPlanMode (verified via the harness's own ListAgents, which showed the subagent still running). Approving the misattributed dialog closes the parent's plan-mode session as a side effect, while the subagent is completely unaffected and continues running normally.
Impact:
A real, human-approved plan can end up being enacted based on stale/placeholder content mislabeled as coming from an agent that never asked for approval. In our case it repeatedly and silently closed the parent session's plan-mode window mid-task, with no trace in the parent's own tool-call transcript — the only visible symptom was a bare "Exited Plan Mode" system event with no causal link back to any action the parent took.
What Should Happen?
Expected:
The dialog should only appear when the named agent has actually called ExitPlanMode, and should show that agent's own plan content, not the parent's.
Error Messages/Logs
Steps to Reproduce
1) Parent session calls EnterPlanMode.
2) Parent dispatches a background subagent via the Agent tool with permissionMode: plan.
3) While the subagent is still exploring (confirmed via ListAgents showing running, not yet at ExitPlanMode), the interactive UI shows a "Ready to code?" dialog labeled with the subagent's identity, but its content is the parent's own plan file text.
4) Approving it closes the parent's plan-mode session; the subagent's own later ExitPlanMode call then fails with "You are not in plan mode."
Claude Model
Sonnet (default)
Is this a regression?
I don't know
Last Working Version
_No response_
Claude Code Version
2.1.229
Platform
Anthropic API
Operating System
macOS
Terminal/Shell
Other
Additional Information
I use cmux
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗