fix(claude): map 'auto' runtime mode to 'default' permission mode#4510
fix(claude): map 'auto' runtime mode to 'default' permission mode#4510caddydove wants to merge 2 commits into
Conversation
When --tailscale-serve is enabled, the backend is reachable via Tailscale Serve HTTPS URL even though the HTTP server binds to 127.0.0.1. Adds config.tailscaleServeEnabled to the isRemoteReachable check in EnvironmentAuthPolicy so the auth policy reflects remote reachability. Closes pingdotgg#4462
The Claude CLI v2.1.146 rejects PermissionMode 'auto' when called via setPermissionMode. Map 'auto' to 'default' (same as 'approval-required') since the SDK's 'auto' value is not supported by the spawned binary. Also adds the missing 'approval-required' -> 'default' mapping to runtimeModeToPermission for correctness (was relying on undefined fallback). Closes pingdotgg#4495
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Want fixes drafted automatically? Bugbot Autofix can create code changes for findings. A team admin can enable Autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 1cc3020. Configure here.
| "approval-required": "default", | ||
| "auto-accept-edits": "acceptEdits", | ||
| auto: "auto", | ||
| auto: "default", |
There was a problem hiding this comment.
Auto mode mapped away
High Severity
Mapping Claude runtime mode auto to SDK permissionMode default removes Claude Code’s native Auto mode (AI-reviewed approvals) for every session. Issue #4495 is specifically a turn/setPermissionMode failure when restoring auto after plan mode, but this change also rewrites session-start query() options, so auto becomes identical to approval-required while Codex still keeps distinct auto_review behavior.
Additional Locations (1)
Reviewed by Cursor Bugbot for commit 1cc3020. Configure here.
ApprovabilityVerdict: Needs human review This PR modifies runtime permission mode mapping for Claude sessions, which is a significant behavioral change. Additionally, there is an unresolved high-severity review comment questioning whether this approach removes intended 'auto' mode functionality. You can customize Macroscope's approvability policy. Learn more. |


Fix #4495
The Claude CLI binary v2.1.146 rejects PermissionMode value 'auto' when called via setPermissionMode(), causing an immediate 'turn/setPermissionMode failed' error.
Changes
ClaudeAdapter.ts: Changed 'auto' → 'default' inruntimeModeToPermission, added missing 'approval-required' → 'default' mappingClaudeAdapter.test.ts: Updated assertions for 'auto' and 'approval-required' runtime modes to expect 'default'Why 'default'
The 'default' permission mode is what the SDK uses when no explicit permission mode is set, and it is already confirmed working by the 'approval-required' runtime mode.
Note
Medium Risk
Claude permission mapping affects every auto/approval-required session; wrong mode could change approval behavior. Auth policy change only applies when Tailscale serve is enabled but shifts bootstrap expectations on loopback.
Overview
Fixes Claude Agent SDK sessions failing on newer CLI builds by mapping
autoandapproval-requiredruntime modes to SDK permission modedefaultinstead ofauto, which recent Claude Code rejects viasetPermissionMode.full-accessandauto-accept-editsmappings are unchanged.Separately, when
tailscaleServeEnabledis on, loopback web hosts (e.g.127.0.0.1) are treated as remote-reachable for auth so bootstrap uses one-time-token rather than loopback-browser-only behavior—covered by a newEnvironmentAuthPolicytest.Reviewed by Cursor Bugbot for commit 1cc3020. Bugbot is set up for automated code reviews on this repo. Configure here.
Note
Map 'auto' and 'approval-required' runtime modes to 'default' Claude permission mode
ClaudeAdapter.ts, theruntimeModetopermissionModemapping now sends'default'instead of'auto'for'auto'mode, and explicitly sends'default'instead ofundefinedfor'approval-required'mode.EnvironmentAuthPolicy.tsto treat the server as remotely reachable whentailscaleServeEnabledis true, even on loopback hosts.runtimeMode'auto'or'approval-required'will now passpermissionMode: 'default'to Claude instead of'auto'or omitting the field entirely.Macroscope summarized 1cc3020.