Repository navigation
Conversation
Claude full access mapped straight to bypassPermissions even when resolved settings set disableBypassPermissionsMode to disable. Resolve the same filesystem sources as the session and omit the forbidden request so the session can start. Co-authored-by: Mats Varnskühler <imMxts@users.noreply.github.com>
Honor disableAutoMode as well as disableBypassPermissionsMode so a locked Auto fallback does not send another forbidden mode. Swap CLAUDE_CONFIG_DIR only around settings resolve and restore it if resolve throws. Co-authored-by: Mats Varnskühler <imMxts@users.noreply.github.com>
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.
Fixes pingdotgg#4927
What Changed
Claude
startSessionnow resolves the same filesystem settings cascade as the SDK session (user,project,local; managed policy still loads regardless) before requestingbypassPermissionsorauto.If resolved policy forbids the requested mode, the adapter:
allowDangerouslySkipPermissionsunless effective mode is still bypassExisting Full access behavior is unchanged when policy allows bypass. Auto-accept-edits and supervised keep their current mappings.
Settings resolve for isolated Claude homes temporarily sets
CLAUDE_CONFIG_DIRunder a mutex and always restores it, including when resolve throws.Why
Verified root cause
On
origin/main(bab4b6f02),ClaudeAdapter.startSessionmapped"full-access"straight topermissionMode: "bypassPermissions"plusallowDangerouslySkipPermissions: true. It never read Claude's resolved policy. Current Claude docs saypermissions.disableBypassPermissionsMode: "disable"(user settings or managed policy) forbids that mode. The adapter still sent it, so the Claude CLI/SDK rejected the session.The first draft only remapped Full access to Auto. Claude also accepts
disableAutoMode: "disable"(top-level orpermissions.disableAutoMode). Sending Auto in that case is the same class of bug. Claude docs say a session that would start in Auto then starts in default / Manual instead.Why this seam
startSessionpublic interface, strongest policy guarantee, UI can still be added later.Requested vs effective mode
session.runtimeModestays what the client asked for (full-accessorauto).claude.query.permission_modeis the allowed mode (bypassPermissions,auto, or omitted for Supervised);claude.query.requested_permission_modekeeps the original mapping.auto, ordefaultwhen Supervised).Tests and commands
vp test run apps/server/src/provider/Layers/ClaudeAdapter.test.ts vp run --filter t3 typecheck vp lint apps/server/src/provider/Layers/ClaudeAdapter.ts apps/server/src/provider/Layers/ClaudeAdapter.test.ts85 tests passed. Typecheck passed. No new lint on the changed logic. No real Claude account, credentials, or managed policy required. Policy tests inject settings fixtures.
CLAUDE_CONFIG_DIRtests inject the inner SDK resolve so they observe the env swap without hitting disk or MDM.Covered matrix: permissive + full access; bypass locked + full access → Auto; bypass and Auto locked + full access → Supervised; Auto locked + Auto runtime → Supervised; Auto locked + full access still bypass; top-level and
permissions.disableAutoMode; non-"disable"policy values; settings resolution failure (fail closed to Auto); plan restore after Auto or Supervised downgrade; resolve call uses cwd +["user","project","local"]; instanceCLAUDE_CONFIG_DIRis visible during resolve and restored after success or throw.Risk, compatibility, and rollout
resolveSettings()is an alpha Claude Agent SDK API. We call it with the same sources asquery().CLAUDE_CONFIG_DIRis applied around the in-process resolve call under a mutex so user settings from isolated Claude homes are visible. The SDK call itself stays interruptible; acquire/release restore the previous env.UI Changes
None in this draft. Composer, compact menu, and mobile still show Full access. A later change can grey it out once provider state surfaces "bypass locked".
Remaining uncertainty
Checklist
Model: Cursor Grok 4.6. Harness: Cursor cloud agent.
Status: DRAFT — NOT READY FOR REVIEW.