Skip to content

fix(server): treat tailscale-serve backend as remote-reachable#4509

Open
caddydove wants to merge 2 commits into
pingdotgg:mainfrom
caddydove:main
Open

fix(server): treat tailscale-serve backend as remote-reachable#4509
caddydove wants to merge 2 commits into
pingdotgg:mainfrom
caddydove:main

Conversation

@caddydove

@caddydove caddydove commented Jul 25, 2026

Copy link
Copy Markdown

Fix #4462

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, enabling remote pairing and authorized-client controls.

Changes

  • apps/server/src/auth/EnvironmentAuthPolicy.ts: Added config.tailscaleServeEnabled || to isRemoteReachable
  • apps/server/src/auth/EnvironmentAuthPolicy.test.ts: Added test for loopback host + tailscale-serve combination

Note

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: EnvironmentAuthPolicy includes config.tailscaleServeEnabled in isRemoteReachable, so a web server bound to 127.0.0.1 with --tailscale-serve gets the remote-reachable policy and one-time-token bootstrap instead of loopback-browser. A test covers loopback + tailscaleServeEnabled.

Claude agent sessions map auto and approval-required runtime modes to the SDK’s default permission mode (replacing auto for the former and making the latter explicit). Tests in ClaudeAdapter.test.ts expect permissionMode: "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 EnvironmentAuthPolicy

  • EnvironmentAuthPolicy.make now sets isRemoteReachable to true when tailscaleServeEnabled is set, even if the host is a loopback address, resulting in policy remote-reachable with bootstrapMethods: ['one-time-token'].
  • makeClaudeAdapter changes the runtimeModepermissionMode mapping: 'auto' now maps to 'default' (was 'auto'), and 'approval-required' now maps to 'default' (was undefined).
  • Behavioral Change: Sessions with runtimeMode 'auto' or 'approval-required' will send permissionMode: 'default' to Claude instead of 'auto' or omitting the field.

Macroscope summarized 1cc3020.

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
@coderabbitai

coderabbitai Bot commented Jul 25, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 296eb344-2150-431e-92dd-91a721922c6c

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions github-actions Bot added vouch:unvouched PR author is not yet trusted in the VOUCHED list. size:XS 0-9 changed lines (additions + deletions). labels Jul 25, 2026
@macroscopeapp

macroscopeapp Bot commented Jul 25, 2026

Copy link
Copy Markdown
Contributor

Approvability

Verdict: 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

@cursor cursor Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.

Fix All in Cursor

❌ 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",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 1cc3020. Configure here.

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

Labels

size:XS 0-9 changed lines (additions + deletions). vouch:unvouched PR author is not yet trusted in the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: --tailscale-serve leaves headless backend classified as local-only

1 participant