fix(server): a server published through Tailscale Serve no longer reports itself as local-only #35543
main fromrefs/pull/35543/head·merged by juliusmarminge View on GitHubMerged origin/main into the branch (merge commit, no rebase). There were conflicts in apps/server/src/environment/DirectEndpoints.ts, apps/server/src/server.ts and packages/tailscale/src/tailscale.ts. Main had already added, in its own form, the same check this branch added: the Tailscale Serve probe must get back this server's environment ID before the server advertises the URL (main reads the ID from ServerEnvironment and makes environmentId a required probe input). I took main's version of those three files and of DirectEndpoints.test.ts, whose environment fixture now comes from main, so the branch adds nothing on the server. What remains is the web fix: isServerNetworkAccessible in ConnectionsSettings.logic.ts treats a non-desktop server as reachable from other devices when its auth policy is remote-reachable, or when it is loopback-browser and advertises a direct endpoint. A loopback server advertises one only after its Tailscale Serve URL has answered as this server. With that, ConnectionsSettings no longer shows 'Only this machine can connect' with the switch off for a t3 serve --tailscale-serve server.
Fixes pingdotgg/t3code#35521
Reproduction on main#
Commit fc2b5de20c (origin/main). In a fresh worktree: vp i, then T3CODE_DEV_SEED=0 T3CODE_TAILSCALE_SERVE=1 T3CODE_TAILSCALE_SERVE_PORT=8443 vp run dev (web mode, no host, Tailscale Serve on, the env form of t3 serve --tailscale-serve). Paired a browser with the startup pairing URL (admin/maintain scopes) and opened /settings/access. The Network access row read "Only this machine can connect. Restart with a non-loopback host for remote pairing." with its switch off (aria-checked=false), and GET /api/auth/session returned auth.policy "loopback-browser". On this VM tailscale serve failed with permission-denied (needs a root/operator change), so the page was not viewed from a second device over the ts.net URL. The policy does not depend on Serve succeeding: resolveServerAuthPolicy reads only mode and host. Added a case to apps/server/src/auth/EnvironmentAuthPolicy.test.ts (mode web, host undefined, tailscaleServeEnabled true, expect policy not loopback-browser); it fails on main with "expected 'loopback-browser' not to be 'loopback-browser'".
Evidence#
Started each commit with fresh isolated state, loopback binding and Tailscale Serve enabled on HTTPS port 8443. Paired with startup admin scopes, opened Settings → Sharing & access, and successfully requested the real server descriptor through Tailscale HTTPS. Same browser origin, viewport and light theme; stable captures cropped identically to omit private environment labels.
| Before | After |
|---|---|
| d8f3feff0c | 6108604e70 |
![]() | ![]() |
Head also correctly leaves network access off when another live service occupies the Serve port:

Manual driver · Runtime transcript · Attempted scenario
AI-assisted; verified with the tests and tools listed above.
Not shown:
- No second-device browser capture: HTTPS reachability was verified through real Tailscale Serve from this VM; Settings was captured through the local dev origin.
- Permission-denied Serve failure was not separately captured; the occupied-port refusal path was exercised and correctly remained off.
- Desktop shell was not exercised. The supplied head's actual diff changes only web reachability presentation and its focused tests; it does not change desktop auth policy, bootstrap methods or managedLimits ordering.
Tests#
vp test run src/environment/DirectEndpoints.test.ts src/auth/EnvironmentAuthPolicy.test.ts (apps/server): 14 passed. vp test run src/components/settings/ConnectionsSettings.logic.test.ts (apps/web): 22 passed. vp run check:changed: format, lint, knip, typecheck (2 packages), tests and react compiler all pass.
Not in this change#
- The web Settings copy for the remote-reachable case ("Change network exposure where the server starts") does not mention Tailscale Serve specifically; left as is.
- Whether Tailscale Serve actually succeeded at runtime is not reflected in the auth policy (it is config-based, like the bind-host check); a failed
tailscale servestill reports remote-reachable. - /api/auth/session still reports auth.policy 'loopback-browser' for a loopback server published through Tailscale Serve; the policy describes the bind host, and making it track whether Serve is working would need the auth descriptor to change at runtime.
- The Settings row reads 'Only this machine can connect' until the server's Tailscale Serve check finishes (a few seconds), then changes.
- /api/auth/session still reports auth.policy 'loopback-browser' for a loopback server published through Tailscale Serve; the policy describes the bind host.
- The desktop Tailscale endpoint check (apps/desktop/src/backend/tailscaleEndpointProvider.ts) still accepts any T3 descriptor when marking its Tailscale HTTPS endpoint compatible; it is not used by this Settings row and is left as on main.
- The branch's extra DirectEndpoints test case (a Serve probe returning another server's environment ID) was dropped in favour of main's test file; main's own probe code covers that check, but no test asserts that case now.
AI-assisted; verified with the tests and tools listed above.
- 1
github-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:trusted
github-actions[bot](GitHub profile, opens in a new tab) added labelssize:S
Approvability#
Verdict: Approved at
6108604Macroscope's review found this PR approvable — Connections settings now recognize an advertised Tailscale Serve endpoint instead of reporting the server as local-only. This changes status presentation, not network exposure or authentication.
You can add or adjust custom eligibility rules. [Learn more](https://docs.macroscope.com/approvability#example-custom-eligibility-rules).No actionable comments were generated in the recent review.
Walkthrough
-
The server now checks that a Tailscale Serve descriptor matches its environment ID before advertising the endpoint. Settings uses the auth policy and direct endpoints to derive network accessibility for non-desktop connections. Desktop accessibility remains based on exposure mode.
Changes: Tailnet network access
Layer / File(s) Summary Validate Tailscale Serve endpoint identity
packages/tailscale/src/tailscale.ts,apps/server/src/environment/DirectEndpoints.ts,apps/server/src/server.ts,apps/server/src/environment/DirectEndpoints.test.tsThe probe accepts an optional environment ID and returns true only when a descriptor exists and its ID matches when an ID is supplied. DirectEndpoints passes the server identity to the probe. Tests cover a mismatched identity. Derive settings network accessibility
apps/web/src/components/settings/ConnectionsSettings.logic.ts,apps/web/src/components/settings/ConnectionsSettings.tsx,apps/web/src/components/settings/ConnectionsSettings.logic.test.tsThe helper returns true for remote-reachable, or forloopback-browserwith at least one direct endpoint. Non-desktop settings use this result for accessibility and the disabled-row description. Tests cover policy and endpoint cases.Estimated code review effort: 3 (Moderate) | ~20 minutes
Change: Bug fix · Severity of issue fixed: Low
Possibly related issues
- pingdotgg/t3code#35512: This change passes the server environment ID to the Tailscale HTTPS probe and rejects descriptors with a different ID, addressing the issue's stated probe-acceptance gap.
Possibly related PRs
- pingdotgg/t3code#27197: It introduces the server auth policy used by the settings accessibility calculation.
Suggested labels:
bugfixSuggested reviewers:
t3dotgg,maria-rcks
Merge Risk:
Minimal · up tod0aae-
The change makes the Tailscale Serve endpoint check validate the server's identity and makes the browser Settings row reflect tailnet reachability. No actionable merge-blocking risk was identified.
Pre-merge checks:
3 · 1-
Failed checks: 1 warningCheck name Status Explanation Resolution Description check The description follows the template's main sections (Problem, Change, Scope, Verification) and gives substantial detail. It names the problem (browser Settings shows 'Only this machine can connect' f… Clarify the scope of the change. State whether the branch changes server code. If it does not, remove or relabel the server test and the 'EnvironmentAuthPolicy.test.ts' reproduction steps that describe a server change. Remove the duplicated… Passed checks: 3 passed-
Check name Status Explanation Title check The title names the main change: a server published through Tailscale Serve no longer reports itself as local-only. The changeset makes resolveServerAuthPolicy return remote-reachable when tailscaleSe… Linked Issues check [ #35521] Requirement: the Network access row in browser Settings must not say "Only this machine can connect" or show remote access as off for a loopback server that Tailscale Serve exposes. At the re…Out of Scope Changes check All changed files relate to the Serve-reachability signal used by the Network access row: ConnectionsSettings.tsx and ConnectionsSettings.logic.ts (row decision and helper), their tests, DirectEndpoin… Full details: Title check
-
Explanation
The title names the main change: a server published through Tailscale Serve no longer reports itself as local-only. The changeset makes resolveServerAuthPolicy return remote-reachable when tailscaleServeEnabled is set, which matches the title. The title uses the fix(server) conventional commit form and is specific enough for history scanning.
Full details: Linked Issues check
-
Explanation
[
#35521] Requirement: the Network access row in browser Settings must not say "Only this machine can connect" or show remote access as off for a loopback server that Tailscale Serve exposes. At the reviewed head, ConnectionsSettings.tsx computes isLocalBackendNetworkAccessible via isServerNetworkAccessible (ConnectionsSettings.logic.ts). That function returns true for loopback-browser when directEndpoints is non-empty. DirectEndpoints.ts advertises the Serve base URL only when probeTailscaleHttpsEndpoint succeeds. The row text then uses isLocalBackendNetworkAccessible, so a reachable Serve server shows "Remote access is already configured". Unit tests in ConnectionsSettings.logic.test.ts cover this decision for remote-reachable, loopback-browser with and without endpoints, and null policy. Desktop mode keeps its existing desktop exposure check. Limits: the row itself was not exercised in a browser, and the diff does not change resolveServerAuthPolicy in apps/server/src/auth/EnvironmentAuthPolicy.ts, which still returns loopback-browser for a loopback host with Serve on. The issue does not require that classifier change, so this does not fail the requirement. Commit-message intent (probe must match the expected environment ID) is implemented in DirectEndpoints.ts and packages/tailscale/src/tailscale.ts.
Full details: Out of Scope Changes check
-
Explanation
All changed files relate to the Serve-reachability signal used by the Network access row: ConnectionsSettings.tsx and ConnectionsSettings.logic.ts (row decision and helper), their tests, DirectEndpoints.ts and its test (passes the server environment ID to the Serve probe), server.ts (provides ServerEnvironment.layerIdentity to DirectEndpoints), and tailscale.ts (optional environmentId check in probeTailscaleHttpsEndpoint). The environment-ID check supports the reachability signal: it stops a Serve route to another T3 server from counting as this server's endpoint. No unrelated change was found. Mismatch: the PR description says resolveServerAuthPolicy, managedLimits.ts, and its test were changed. The diff against the merge base does not include those files, so those described changes are absent at the reviewed head. This is a description/diff mismatch, not an out-of-scope change.
-
Full details: Description check
-
Explanation
The description follows the template's main sections (Problem, Change, Scope, Verification) and gives substantial detail. It names the problem (browser Settings shows 'Only this machine can connect' for a t3 serve --tailscale-serve server), links issue
#35521, explains the web-only change in isServerNetworkAccessible, and lists reproduction steps, before/after evidence, and test results. Gaps: the Problem section does not have a clear standalone heading-level problem statement separate from the reproduction notes, and the Scope section does not explicitly say why the change is a bug fix rather than a feature. The description also contains contradictory and stale content. It says the branch adds nothing on the server, yet it lists a server test case and a before/after comparison against commits that describe server-side changes. The 'Not in this change' list repeats the same bullet about /api/auth/session twice. The Verification section cites tests run against the server package, which the description says the branch no longer changes. The title is not provided in the supplied context, so the conventional commit title requirement cannot be checked. The template also asks for the agent model and harness; the AI-assisted note does not name them.Resolution
Clarify the scope of the change. State whether the branch changes server code. If it does not, remove or relabel the server test and the 'EnvironmentAuthPolicy.test.ts' reproduction steps that describe a server change. Remove the duplicated bullet in 'Not in this change'. Make the Scope section say why this is a bug fix and link the issue. Confirm the PR title uses a conventional commit format. Name the model and harness used, as the template requests.
-
Finishing Touches
-
Generate unit tests (beta)
-
- Commit to this branch
- Create a new PR
-
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Recent review info-
Run configuration-
- Source mode: Auto
- Repository: pingdotgg/t3code
- Branch: factory/issue-35521
- File: .coderabbit.config.ts
- Commit: d0aaee1
- Layers: Repository TS config
- Review profile: CHILL
- Plan: Team
- Run ID:
252384af-cd30-4bce-87ef-d896541d28b2
Commits-
Reviewing files that changed from the base of the PR and between bf801ebf9b4061a66ff76c3a8fdcc711b8053702 and d0aaee14e79266a83a2d11dbc0ae8b7ccf8c1bca.
Files selected for processing: 4-
apps/server/src/environment/DirectEndpoints.test.tsapps/server/src/environment/DirectEndpoints.tsapps/server/src/server.tspackages/tailscale/src/tailscale.ts
Limit details: You’ve used all 10 included reviews currently available.
-
-
Thread transfer impact#
✅ Thread transfer remains within every enforced ceiling.
Provider Metric Main baseline This PR Impact PR ceiling Codex Total thread wire 5.0 KiB 5.0 KiB 0 B (0.0%) 6.8 KiB ✅ Codex Thread snapshot wire 3.8 KiB 3.8 KiB 0 B (0.0%) 4.9 KiB ✅ Codex Live turn WebSocket wire 1.2 KiB 1.2 KiB 0 B (0.0%) 2.0 KiB ✅ Codex Live turn WebSocket decoded 21.5 KiB 21.5 KiB 0 B (0.0%) 24.4 KiB ✅ Codex Live turn messages 1 1 0 (0.0%) 8 ✅ Claude Total thread wire 5.0 KiB 5.0 KiB 0 B (0.0%) 6.8 KiB ✅ Claude Thread snapshot wire 3.8 KiB 3.8 KiB 0 B (0.0%) 4.9 KiB ✅ Claude Live turn WebSocket wire 1.2 KiB 1.2 KiB 0 B (0.0%) 2.0 KiB ✅ Claude Live turn WebSocket decoded 21.9 KiB 21.9 KiB 0 B (0.0%) 24.4 KiB ✅ Claude Live turn messages 1 1 0 (0.0%) 8 ✅ Other scenarios#
All 64 scenario measurements match
main.All 64 scenario measurements
Provider Scenario Metric Main baseline This PR Impact PR ceiling Codex short turn resumeWebSocket decoded10.5 KiB 10.5 KiB 0 B (0.0%) 12.7 KiB ✅ Codex short turn resumeWebSocket messages2 2 0 (0.0%) 2 ✅ Codex long turn running, cold openHTTP decoded281.7 KiB 281.7 KiB 0 B (0.0%) 302.7 KiB ✅ Codex long turn running, cold openrows75 75 0 (0.0%) 75 ✅ Codex long turn running, history pageHTTP decoded92.4 KiB 92.4 KiB 0 B (0.0%) 107.4 KiB ✅ Codex long turn running, history pagerows75 75 0 (0.0%) 75 ✅ Codex long turn finished, cold openHTTP decoded381.5 KiB 381.5 KiB 0 B (0.0%) 410.2 KiB ✅ Codex long turn finished, cold openrows151 151 0 (0.0%) 151 ✅ Codex long turn finished, socket cold openWebSocket decoded381.6 KiB 381.6 KiB 0 B (0.0%) 410.2 KiB ✅ Codex long turn finished, socket cold openWebSocket messages2 2 0 (0.0%) 2 ✅ Codex long turn finished, socket cold openrows151 151 0 (0.0%) 151 ✅ Codex long turn finished, work pageHTTP decoded186.2 KiB 186.2 KiB 0 B (0.0%) 200.2 KiB ✅ Codex long turn finished, work pagerows150 150 0 (0.0%) 150 ✅ Codex idle thread resumeWebSocket decoded65 B 65 B 0 B (0.0%) 200 B ✅ Codex idle thread resumeWebSocket messages1 1 0 (0.0%) 1 ✅ Codex fleet shell snapshotHTTP decoded41.6 KiB 41.6 KiB 0 B (0.0%) 53.7 KiB ✅ Codex fleet shell snapshotrows27 27 0 (0.0%) 27 ✅ Codex fleet shell subscribeWebSocket decoded65 B 65 B 0 B (0.0%) 200 B ✅ Codex fleet shell subscribeWebSocket messages1 1 0 (0.0%) 1 ✅ Codex fleet shell resume checkHTTP decoded18 B 18 B 0 B (0.0%) 100 B ✅ Codex fleet shell resume checkrows0 0 0 0 ✅ Codex stale shell reloadHTTP decoded41.6 KiB 41.6 KiB 0 B (0.0%) 53.7 KiB ✅ Codex stale shell reloadrows27 27 0 (0.0%) 27 ✅ Codex stale shell resumeWebSocket decoded140 B 140 B 0 B (0.0%) 400 B ✅ Codex stale shell resumeWebSocket messages2 2 0 (0.0%) 2 ✅ Codex stale todo list cold openHTTP decoded72.4 KiB 72.4 KiB 0 B (0.0%) 83.0 KiB ✅ Codex stale todo list cold openrows75 75 0 (0.0%) 75 ✅ Codex stale todo list cold opennodes2 2 0 (0.0%) 4 ✅ Codex stale todo list cold opensubagents2 2 0 (0.0%) 4 ✅ Codex stale todo list cold openplans1 1 0 (0.0%) 2 ✅ Codex stale todo list cold openproviderTurns1 1 0 (0.0%) 2 ✅ Codex stale todo list cold opencheckpoints1 1 0 (0.0%) 2 ✅ Claude short turn resumeWebSocket decoded10.6 KiB 10.6 KiB 0 B (0.0%) 12.7 KiB ✅ Claude short turn resumeWebSocket messages2 2 0 (0.0%) 2 ✅ Claude long turn running, cold openHTTP decoded283.3 KiB 283.3 KiB 0 B (0.0%) 302.7 KiB ✅ Claude long turn running, cold openrows75 75 0 (0.0%) 75 ✅ Claude long turn running, history pageHTTP decoded93.4 KiB 93.4 KiB 0 B (0.0%) 107.4 KiB ✅ Claude long turn running, history pagerows75 75 0 (0.0%) 75 ✅ Claude long turn finished, cold openHTTP decoded384.2 KiB 384.2 KiB 0 B (0.0%) 410.2 KiB ✅ Claude long turn finished, cold openrows151 151 0 (0.0%) 151 ✅ Claude long turn finished, socket cold openWebSocket decoded384.3 KiB 384.3 KiB 0 B (0.0%) 410.2 KiB ✅ Claude long turn finished, socket cold openWebSocket messages2 2 0 (0.0%) 2 ✅ Claude long turn finished, socket cold openrows151 151 0 (0.0%) 151 ✅ Claude long turn finished, work pageHTTP decoded188.1 KiB 188.1 KiB 0 B (0.0%) 200.2 KiB ✅ Claude long turn finished, work pagerows150 150 0 (0.0%) 150 ✅ Claude idle thread resumeWebSocket decoded66 B 66 B 0 B (0.0%) 200 B ✅ Claude idle thread resumeWebSocket messages1 1 0 (0.0%) 1 ✅ Claude fleet shell snapshotHTTP decoded42.2 KiB 42.2 KiB 0 B (0.0%) 53.7 KiB ✅ Claude fleet shell snapshotrows27 27 0 (0.0%) 27 ✅ Claude fleet shell subscribeWebSocket decoded66 B 66 B 0 B (0.0%) 200 B ✅ Claude fleet shell subscribeWebSocket messages1 1 0 (0.0%) 1 ✅ Claude fleet shell resume checkHTTP decoded18 B 18 B 0 B (0.0%) 100 B ✅ Claude fleet shell resume checkrows0 0 0 0 ✅ Claude stale shell reloadHTTP decoded42.2 KiB 42.2 KiB 0 B (0.0%) 53.7 KiB ✅ Claude stale shell reloadrows27 27 0 (0.0%) 27 ✅ Claude stale shell resumeWebSocket decoded140 B 140 B 0 B (0.0%) 400 B ✅ Claude stale shell resumeWebSocket messages2 2 0 (0.0%) 2 ✅ Claude stale todo list cold openHTTP decoded73.4 KiB 73.4 KiB 0 B (0.0%) 83.0 KiB ✅ Claude stale todo list cold openrows75 75 0 (0.0%) 75 ✅ Claude stale todo list cold opennodes2 2 0 (0.0%) 4 ✅ Claude stale todo list cold opensubagents2 2 0 (0.0%) 4 ✅ Claude stale todo list cold openplans1 1 0 (0.0%) 2 ✅ Claude stale todo list cold openproviderTurns1 1 0 (0.0%) 2 ✅ Claude stale todo list cold opencheckpoints1 1 0 (0.0%) 2 ✅ Baseline:
a7779fc· PR result:c7051be· Source CI: successScenario and decoded snapshot size
10 historical turns, 5 command tools per turn, 878.9 KiB retained MCP result per historical turn, and a 1.05 MiB retained result in the measured turn.
- Codex decoded thread snapshot: 108.5 KiB
- Claude decoded thread snapshot: 108.8 KiB
Updated in place by a trusted workflow. PR artifacts are strictly validated and never executed.
github-actions[bot](GitHub profile, opens in a new tab) removed labelssize:S
github-actions[bot](GitHub profile, opens in a new tab) added labelssize:M
macroscopeapp[bot](GitHub profile, opens in a new tab) approved these changes
tanstack-source added labelsbug
github-actions[bot](GitHub profile, opens in a new tab) removed labelssize:M
github-actions[bot](GitHub profile, opens in a new tab) added labelssize:S
macroscopeapp[bot](GitHub profile, opens in a new tab) approved these changes
juliusmarminge merged this0d51d5b
juliusmarminge closed this
Sign in to join this conversation.


macroscopeapp[bot](GitHub profile, opens in a new tab) reviewed