fix(server): treat tailscale-serve backend as remote-reachable#4509
fix(server): treat tailscale-serve backend as remote-reachable#4509caddydove 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
|
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 |
ApprovabilityVerdict: Needs human review This PR modifies auth policy behavior and permission mode mapping, both runtime-affecting changes. Additionally, there is an unresolved high-severity review comment flagging that the auto→default mapping may break the expected auto mode behavior, which warrants human review. You can customize Macroscope's approvability policy. Learn more. |
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
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 runtime maps to default
High Severity
Mapping runtimeMode auto to permissionMode default (which is also used for approval-required) drops Claude Code's distinct auto mode. Claude Auto sessions now prompt for approval like 'Approve' actions, breaking the shared auto runtime mode contract.
Reviewed by Cursor Bugbot for commit 1cc3020. Configure here.


Fix #4462
When
--tailscale-serveis enabled, the backend is reachable via Tailscale Serve HTTPS URL even though the HTTP server binds to127.0.0.1.Adds
config.tailscaleServeEnabledto theisRemoteReachablecheck inEnvironmentAuthPolicyso the auth policy reflects remote reachability, enabling remote pairing and authorized-client controls.Changes
apps/server/src/auth/EnvironmentAuthPolicy.ts: Addedconfig.tailscaleServeEnabled ||toisRemoteReachableapps/server/src/auth/EnvironmentAuthPolicy.test.ts: Added test for loopback host + tailscale-serve combinationNote
Medium Risk
Auth policy changes affect remote pairing and bootstrap for Tailscale Serve; Claude permission mapping changes tool-approval behavior for auto and approval-required modes.
Overview
Tailscale Serve on loopback is now treated as remote-reachable for auth:
EnvironmentAuthPolicyincludesconfig.tailscaleServeEnabledinisRemoteReachable, so a web server bound to127.0.0.1with--tailscale-servegets theremote-reachablepolicy andone-time-tokenbootstrap instead ofloopback-browser. A test covers loopback +tailscaleServeEnabled.Claude agent sessions map
autoandapproval-requiredruntime modes to the SDK’sdefaultpermission mode (replacingautofor the former and making the latter explicit). Tests inClaudeAdapter.test.tsexpectpermissionMode: "default"for those modes.Reviewed by Cursor Bugbot for commit 1cc3020. Bugbot is set up for automated code reviews on this repo. Configure here.
Note
Treat tailscale-serve backend as remote-reachable in
EnvironmentAuthPolicyEnvironmentAuthPolicy.makenow setsisRemoteReachabletotruewhentailscaleServeEnabledis set, even if the host is a loopback address, resulting in policyremote-reachablewithbootstrapMethods: ['one-time-token'].makeClaudeAdapterchanges theruntimeMode→permissionModemapping:'auto'now maps to'default'(was'auto'), and'approval-required'now maps to'default'(wasundefined).runtimeMode'auto'or'approval-required'will sendpermissionMode: 'default'to Claude instead of'auto'or omitting the field.Macroscope summarized 1cc3020.