feat(app): persist auto-accept permissions preference across sessions - #39328
feat(app): persist auto-accept permissions preference across sessions#39328PinkR1ver wants to merge 1 commit into
Conversation
The Settings toggle for auto-accept permissions was only session-scoped and did not persist across app restarts or new sessions. The global settings already had a permissions.autoApprove field that was unused. - Connect V2 Settings toggle (general-controllers.ts) to the global settings.permissions.autoApprove preference for persistence across sessions - Connect V1 Settings toggle (settings-general.tsx) similarly - Add enableAutoApproveDirectory() alongside enableConfiguredDirectory() to auto-enable auto-accept for new directories using the global preference - Session-level override via Cmd+Shift+A takes precedence as before - Toggle is no longer disabled when settings is opened outside a session Closes anomalyco#38289
|
Thanks for updating your PR! It now meets our contributing guidelines. 👍 |
|
The following comment was made by an LLM, it may be inaccurate: The search found one related PR that's different from the current PR: Related PR (not a duplicate):
No duplicate PRs found |
|
Automated PR Cleanup Thank you for contributing to opencode. Due to the high volume of PRs from users and AI agents, we periodically close older PRs using automated criteria so maintainers can focus review time on the most active and community-supported contributions. This PR was closed because it matched the following cleanup criteria:
PRs created within the last month are not affected by this cleanup. If you believe this PR was closed incorrectly, or if you are still actively working on it, please leave a comment explaining why it should be reopened. A maintainer can review and reopen it if appropriate. Thanks again for taking the time to contribute. |
Issue for this PR
Closes #38289
Type of change
What does this PR do?
The Settings toggle for auto-accept permissions was only session-scoped and did not persist across app restarts or new sessions. The underlying state store uses
Persist.serverGlobal()which is server-scoped and lost on restart. Meanwhile, the global settings store (settings.tsx) already had apermissions.autoApprovefield that was completely unused.Changes:
general-controllers.ts(V2 Settings) — Toggle reads/writessettings.permissions.autoApprove(global, persistent). Falls back to global preference when settings is opened outside a session context. Toggle is always enabled.settings-general.tsx(V1 Settings) — Same: writes tosettings.permissions.autoApprovealongside session-level toggle. Falls back to global preference when no directory context.permission.tsx— NewenableAutoApproveDirectory()function, modeled afterenableConfiguredDirectory(). Auto-enables directory-level auto-accept for new directories when global preference is ON. Only sets ifautoAccept[key] === undefined(never overrides explicit user settings).Session-level override via
Cmd+Shift+Astill takes precedence — session-level keys are checked before directory-level inautoRespondsPermission().How did you verify your code works?
permission-auto-respond.tsandpermission-auto-respond.test.ts— existing 9 tests pass unchangedenableAutoApproveDirectory()guard (autoAccept[key] !== undefined) ensures explicit user settings are never overwrittenScreenshots / recordings
N/A — this is a state management fix, no visual UI changes.
Checklist