fix(tailscale): Tailscale HTTPS is detected when T3 Code is launched from the macOS Dock #30756
main fromrefs/pull/30756/head·opened View on GitHubProblem#
On macOS, the "Tailscale HTTPS" row says "Start Tailscale" while Tailscale is running when T3 Code was launched from the Dock or Finder. The spawned Tailscale app binary sees no shell-like environment (SHLVL, TERM), so it runs as the GUI instead of the CLI: it prints The Tailscale GUI failed to start: … on stdout and exits 0. tailscale status --json then fails to parse and is treated as "no Tailscale", with nothing logged. tailscale serve spawned the same way exits 0 having done nothing.
Change#
Every tailscale spawn in packages/tailscale (status, debug prefs, serve) now sets TAILSCALE_BE_CLI=1 on top of the inherited environment (extendEnv: true). That is the documented switch that makes the macOS app binary act as the CLI. The Linux and Windows CLIs ignore it, so the command is built the same way on every platform. The two spawn sites now share one builder, which keeps the existing forceKillAfter.
Scope and approval#
Refs #15919. This is a small, focused fix for an obvious bug. MarcRez33's comment in #15919 isolates the cause with a reproduction outside T3 Code and a 288-run matrix across plain Node, Electron main and open-launched Electron, on both the App Store and standalone Tailscale builds. Only the environment decides CLI versus GUI mode. The diagnosis is theirs; this PR applies the env-var fix they suggested.
This does not change how tailscale is found. The original report also guessed the CLI is not on the Dock-launched app's PATH. Per that same comment, the absolute bundle path fails the same way, so GUI mode is the cause when the binary is found. I left PATH discovery out because it is a separate problem, which is why this says "Refs" rather than "Fixes".
Verification#
- New test in
packages/tailscale/src/tailscale.test.ts,runs the macOS app binary as the CLI. It uses a fake darwin spawner that answers like the app binary: GUI failure text on stdout with exit 0 unlessTAILSCALE_BE_CLIis set. Onmainit fails withTailscaleStatusParseError: Failed to decode tailscale status JSON, which is the bug. With the fix, status parses (magicDnsNameisdesktop.tail.ts.net), and the status and serve spawns both carry{ env: { TAILSCALE_BE_CLI: "1" }, extendEnv: true }. vp test run packages/tailscale/src/tailscale.test.ts: 9 passed. The existing SIGKILL-escalation test still seesforceKillAfter500 ms on all three spawns.vp run check:changed: format, lint, knip, typecheck (5 packages) and tests all pass.
Not checked: I did not run it against a real Tailscale install. The Mac I worked on doesn't have the Tailscale app, so there is no before/after capture of the settings row from a Dock-launched build. The binary's behavior with and without the variable comes from the reproduction in #15919 (env -i PATH=/usr/bin:/bin HOME=$HOME /Applications/Tailscale.app/Contents/MacOS/Tailscale status --json prints the GUI error and exits 0; adding TAILSCALE_BE_CLI=1 prints the status JSON).
Written by Claude Opus 5.5 (Claude Code harness, run inside T3 Code).
- 1
github-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:unvouched
github-actions[bot](GitHub profile, opens in a new tab) added labelssize:S
Approvability#
Verdict: Approved at
2c5350bMacroscope's review found this PR approvable — Tailscale subprocesses now explicitly use CLI mode, restoring detection when the macOS app is launched from the Dock. Existing Serve opt-in controls, policy checks, command arguments, and timeouts remain unchanged.
You can add or adjust custom eligibility rules. [Learn more](https://docs.macroscope.com/approvability#example-custom-eligibility-rules).Important
Review skipped#
Review was skipped as selected files did not have any reviewable changes.
Run configuration-
- Source mode: Auto
- Repository: pingdotgg/t3code
- Branch: main
- File: .coderabbit.config.ts
- Commit: 77f87ea
- Layers: Repository TS config
- Review profile: CHILL
- Plan: Advanced
- Run ID:
efe6ff4b-c78d-45da-b870-624c4b03ef06
Commits-
Reviewing files that changed from the base of the PR and between 740818ff428e50c95e5c1407b1c3cf22b86846cd and afbb6c945617cd22f0c841d2c3ab5337b5e7cbf9.
You can disable this status message by setting the
reviews.review_statustofalsein the CodeRabbit configuration file.Use the checkbox below for a quick retry:
- Trigger review
No actionable comments were generated in the recent review.
Walkthrough
-
Tailscale status, debug, and Serve commands now use a shared process constructor that sets
TAILSCALE_BE_CLI=1and extends the inherited environment. A macOS regression test checks the environment used for status reading and Serve setup.Changes: Tailscale CLI invocation
Layer / File(s) Summary Construct and verify Tailscale CLI commands
packages/tailscale/src/tailscale.ts,packages/tailscale/src/tailscale.test.tsThe shared constructor sets TAILSCALE_BE_CLI=1, extends the inherited environment, and applies the kill grace period. Status, debug, and Serve commands use it. Serve maps spawn defects toTailscaleCommandSpawnError. A macOS regression test checks status reading and Serve setup.Estimated code review effort: 2 (Simple) | ~10 minutes
Change: Bug fix
Suggested reviewers:
t3dotgg,rishabhx29
Merge Risk:
Minimal · previous review74081-
This change makes Tailscale commands run in CLI mode when T3 Code is launched from the macOS Dock, so HTTPS detection should work there. The change is small and tested at the spawn level. No merge-blocking risk was identified.
Pre-merge checks:
4-
Check name Status Explanation Title check The title names the fix and its scope: Tailscale HTTPS detection when T3 Code is launched from the macOS Dock. The changeset sets TAILSCALE_BE_CLI=1 on all tailscale spawns in packages/tailscale, whic… Description check The description follows the template. It has Problem, Change, Scope, and Verification sections with substantive content. The Problem section gives the reproduction context and expected behavior. The C… Linked Issues check Check skipped because no linked issues were found for this pull request. Out of Scope Changes check Check skipped because no linked issues were found for this pull request. Full details: Title check
-
Explanation
The title names the fix and its scope: Tailscale HTTPS detection when T3 Code is launched from the macOS Dock. The changeset sets TAILSCALE_BE_CLI=1 on all tailscale spawns in packages/tailscale, which addresses that bug, so the title matches the main change. It is slightly long at 88 characters.
Full details: Description check
-
Explanation
The description follows the template. It has Problem, Change, Scope, and Verification sections with substantive content. The Problem section gives the reproduction context and expected behavior. The Change section explains the env-var fix and why it applies to all platforms. The Scope section links issue
#15919and explains why the PR says 'Refs' and not 'Fixes'. The Verification section lists the focused test, the commands run, and what was not checked. The template's preamble asks for a conventional commit title, which the PR has. The description does not include the 'Read CONTRIBUTING.md' acknowledgement, which is a template comment and not a required field. The model and harness are named at the end, as the template requests.
-
Finishing Touches
-
Generate unit tests (beta)
-
- 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: main
- File: .coderabbit.config.ts
- Commit: def3722
- Layers: Repository TS config
- Review profile: CHILL
- Plan: Advanced
- Run ID:
e95281cf-826f-4368-9234-8549d48554cd
Commits-
Reviewing files that changed from the base of the PR and between 2c5350bf143bed2005f123948e696b1a0678cf6d and 740818ff428e50c95e5c1407b1c3cf22b86846cd.
Files selected for processing: 2-
packages/tailscale/src/tailscale.test.tspackages/tailscale/src/tailscale.ts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 7 remain after this review.
-
-
tanstack-source added labelsbug
Additional real-world confirmation from T3 Code 0.1.10 on macOS: the host was connected to Tailscale, and T3 Code detected and offered its 100.x Tailnet IP for pairing, but Settings → Sharing & access → Tailscale HTTPS showed
Start Tailscale to set up HTTPS access through MagicDNS.without a toggle. In the interactive shelltailscalewas only an alias to/Applications/Tailscale.app/Contents/MacOS/Tailscale. A symlink from/usr/local/bin/tailscaleto that app executable crashed withTailscale/BundleIdentifiers.swift:49: Fatal error: The current bundleIdentifier is unknown to the registry. Replacing the symlink with the following executable wrapper at/usr/local/bin/tailscalemade the CLI work and the HTTPS toggle appeared after restarting T3 Code:#!/bin/sh export TAILSCALE_BE_CLI=1 exec /Applications/Tailscale.app/Contents/MacOS/Tailscale "$@"This confirms the workaround on 0.1.10. It does not isolate whether the original failure was command discovery/PATH or GUI-vs-CLI mode (the wrapper changes both), so the PR's current CLI-mode fix may not fully resolve the PATH-only case. It would be helpful to document CLI availability and the wrapper fallback, and to distinguish a failed CLI probe from
Tailscale is not runningin the UI. I found this while trying to enable Tailnet HTTPS for remote T3 Code pairing.Note
Written by
gpt-6.1-solon behalf of Mariamerged current main into the existing head without rebasing. the pr still changes only the two tailscale files; no additional code fixes were needed.
verified
afbb6c945617cd22f0c841d2c3ab5337b5e7cbf9through blacksmith:vp run check:changed refs/remotes/github/mainpassed format, lint, knip, typechecks for five packages, and 16 tests including the macos cli-mode regression. two independent scoped reviews found no blocking issues.native macos dock launch remains unverified on this linux vm. executable discovery and clearer probe-error messaging remain outside this cli-mode fix's scope.
Sign in to join this conversation.
macroscopeapp[bot](GitHub profile, opens in a new tab) approved these changes