claude: accepting ExitPlanMode exits plan mode in the panel (T-337)

ExitPlanMode arrives as a can_use_tool permission prompt and was approved
like any other tool — the control_response was sent but the tracked
SessionStatus.permissionMode never changed, so the mode indicator and
composer stayed on "plan" after the plan was accepted.

On approving an ExitPlanMode prompt, sync the tracked mode to 'default'
(the CLI performs the transition itself, so no set_permission_mode control
request is sent — we only mirror it). The change rides the existing
statusStream → claude_pane._status plumbing, so the permission-mode
control and status indicator update with no extra wiring. Deny, and any
non-ExitPlanMode tool, leave the mode untouched.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-06-11 14:34:50 +02:00
co-authored by Claude Opus 4.8
parent 430189d714
commit ce200765cc
5 changed files with 72 additions and 0 deletions
@@ -570,6 +570,14 @@ class StreamJsonSession {
}),
);
if (decision is AllowTool) {
// Approving ExitPlanMode leaves plan mode. The CLI performs the
// transition itself on the approval, so we don't send a
// set_permission_mode control request — we just sync our tracked status
// (exits to 'default', matching Claude Code) so the permission-mode
// indicator and composer reflect the change (T-337).
if (prompt.toolName == 'ExitPlanMode') {
_mergeStatus(const SessionStatus(permissionMode: 'default'));
}
// The prompt card is ephemeral (it vanishes once resolved), so leave a
// compact record of an answered question in the conversation log (D-78).
if (prompt.isQuestion) {