reflect permission-mode changes in the status line

setPermissionMode only wrote the control_request; the mode was never
folded back into the session status, so the badge and Ctrl/Cmd+M looked
dead. Optimistically merge + emit the new mode immediately; the next
system/init still reconciles.

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2026-06-06 09:49:08 +02:00
co-authored by Claude
parent 0e85f7f5e7
commit 13187d3994
5 changed files with 41 additions and 0 deletions
@@ -674,6 +674,11 @@ class StreamJsonSession {
'request_id': 'set-perm-${_localSeq++}',
'request': {'subtype': 'set_permission_mode', 'mode': mode},
}));
// Optimistically reflect the change so the badge / status line update
// immediately (T-250) — the control_request emits no status event, and a
// fresh system/init only arrives later. The next init reconciles if the
// process ends up in a different mode.
_mergeStatus(SessionStatus(permissionMode: mode));
}
Future<void> dispose() async {