Skip to content

feat(app): persist auto-accept permissions preference across sessions - #39328

Open
PinkR1ver wants to merge 1 commit into
anomalyco:devfrom
PinkR1ver:fix-auto-accept-permissions-persistence
Open

feat(app): persist auto-accept permissions preference across sessions#39328
PinkR1ver wants to merge 1 commit into
anomalyco:devfrom
PinkR1ver:fix-auto-accept-permissions-persistence

Conversation

@PinkR1ver

@PinkR1ver PinkR1ver commented Jul 28, 2026

Copy link
Copy Markdown

Issue for this PR

Closes #38289

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

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 a permissions.autoApprove field that was completely unused.

Changes:

  1. general-controllers.ts (V2 Settings) — Toggle reads/writes settings.permissions.autoApprove (global, persistent). Falls back to global preference when settings is opened outside a session context. Toggle is always enabled.

  2. settings-general.tsx (V1 Settings) — Same: writes to settings.permissions.autoApprove alongside session-level toggle. Falls back to global preference when no directory context.

  3. permission.tsx — New enableAutoApproveDirectory() function, modeled after enableConfiguredDirectory(). Auto-enables directory-level auto-accept for new directories when global preference is ON. Only sets if autoAccept[key] === undefined (never overrides explicit user settings).

Session-level override via Cmd+Shift+A still takes precedence — session-level keys are checked before directory-level in autoRespondsPermission().

How did you verify your code works?

  • Reviewed the resolution logic in permission-auto-respond.ts and permission-auto-respond.test.ts — existing 9 tests pass unchanged
  • Traced the full flow: settings toggle → global persistence → directory-level auto-accept → session-level override precedence
  • The enableAutoApproveDirectory() guard (autoAccept[key] !== undefined) ensures explicit user settings are never overwritten

Screenshots / recordings

N/A — this is a state management fix, no visual UI changes.

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

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
@github-actions github-actions Bot added needs:compliance This means the issue will auto-close after 2 hours. and removed needs:compliance This means the issue will auto-close after 2 hours. labels Jul 28, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Thanks for updating your PR! It now meets our contributing guidelines. 👍

@github-actions

Copy link
Copy Markdown
Contributor

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FEATURE][Desktop]: Show a persistent indicator when auto-accept permissions is active, and make the setting a real default for new sessions

1 participant