🐛 Fix Claude permission mode drift between session state and web UI#145
Merged
🐛 Fix Claude permission mode drift between session state and web UI#145
Conversation
The web UI was reading `approvalPolicy` (a Codex concept with values `ask`/`auto-edit`/`auto-full`) instead of Claude's actual `permission_mode` (`default`/`plan`/`acceptEdits`/`bypassPermissions`/ `dontAsk`). The server already emits permission_mode in both REST SessionState and WS SessionDelta, but the web frontend never consumed it — so the mode pill could show stale or wrong state even when Claude entered plan mode during a live session. Changes: - sessions store: propagate `permission_mode` through delta handler - session.jsx: seed and track `permission_mode` from the store instead of `approvalPolicy`; PATCH `/config` with `permission_mode` - message-composer.jsx: render status pill from `permissionMode` with correct Claude mode labels (Plan Mode, Accept Edits, Bypass, etc.) - provider-controls.jsx: update ClaudePermissionPicker options to match real Claude permission modes - Add unit tests for permission_mode delta, null-clear, preservation, and resume propagation Native (Swift) was already correct — no changes needed there. Closes #135
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
approvalPolicy(Codex concept:ask/auto-edit/auto-full) to display Claude's permission mode pill, instead of the actualpermission_mode(default/plan/acceptEdits/bypassPermissions/dontAsk) that the server already emitspermission_modein both RESTSessionStateand WSSessionDelta), but the web frontend never consumed itChanges
stores/sessions.js— Addpermission_modetohandleSessionDeltaso WS delta updates flow into the session storepages/session.jsx— ReplaceapprovalPolicylocal state withpermissionModeseeded fromselected.value?.permission_mode(updated via store deltas); PATCH/api/sessions/:id/confignow sendspermission_modeinstead ofapproval_policycomponents/input/message-composer.jsx— Status pill now renders Claude permission modes with correct labels (Plan Mode, Default, Accept Edits, Bypass, Don't Ask) and cycles through real modes on clickcomponents/input/provider-controls.jsx—ClaudePermissionPickeroptions updated to match real Claude permission modestests/stores/sessions.test.js— 4 new tests covering permission_mode delta application, null-clear, preservation when absent, and resume propagationWhat didn't change
permissionModethroughout (reducer, store events,ClaudePermissionPillUI)Test plan
Closes #135