Skip to content
Source
Sign inSign up
pingdotgg/t3code

[Bug]: A timed-out `tailscale status --json` probe can start the Tailscale macOS GUI, which then opens login pages in the browser #21609

ClosedPrinceJunkie(GitHub profile, opens in a new tab) opened this issue 1 comment

Before submitting

  • I searched existing issues and did not find a duplicate.
  • I included enough detail to reproduce or investigate the problem.

Area

apps/server

Steps to reproduce

Not deterministic, it needs a slow process start. The conditions on my machine:

  1. macOS with the standalone Tailscale app (1.102.4) and its CLI wrapper installed at /usr/local/bin/tailscale. The wrapper is #!/bin/sh plus /Applications/Tailscale.app/Contents/MacOS/tailscale "$@", without exec, so the real binary is a child of sh.
  2. Tailscale GUI not running, Tailscale stopped. No sshd listening on loopback :22.
  3. T3 Code desktop running. Every client WebSocket (re)connect re-subscribes subscribeServerConfig, which runs RemoteOpenTargets.resolveTargets and with it tailscale status --json (1.5 s TAILSCALE_STATUS_TIMEOUT). Overnight, with the window in the background, my client reconnected about every 3 minutes, so this ran about 110 times between 04:36 and 10:29.
  4. One of those runs (04:29) started slowly while the machine was busy, and the timeout fired.

Expected behavior

tailscale status --json is a read-only probe. It returns or gets killed on timeout, and nothing keeps running afterwards.

Actual behavior

On timeout the spawner sends SIGTERM to the process group (process.kill(-pid, SIGTERM)) and does not escalate to SIGKILL. The sh wrapper died. The Tailscale binary survived and launchd adopted it.

The macOS Tailscale binary decides between CLI and GUI mode at startup, and its first check is the parent PID. Disassembly of 1.102.4 (x86_64 slice): getppid(); cmp eax, 1; je <return GUI>. The arguments and the TAILSCALE_BE_CLI, SHLVL, TERM, TERM_PROGRAM and PS1 checks only come after that. With ppid 1 it ignored status --json and started as the full menu-bar app. Its command line still reads tailscale status --json.

That GUI process then:

  • turned on VPN On-Demand, which restarted the Tailscale network extension
  • subscribed to the IPN bus

My node is not authorized on its (self-hosted) control server, so the backend receives a new auth URL every 15 minutes. The GUI opened each one in the default browser: 27 login pages between 04:36 and 11:06, and still going until I found the process.

macOS TCC attributes the process to T3 Code: responsible={identifier=com.t3tools.t3code, pid=51447, responsible_path=/Applications/T3 Code (Beta).app/...}.

This machine only started running the probe with #19402. Before that PR, resolveTargets returned [] when no loopback sshd was listening, without calling tailscale. It now runs tailscale status --json on every config subscription.

I could not determine why the binary survived the group SIGTERM. It does not import signal or sigaction.

Possible fixes:

  • Run the Tailscale binary directly instead of through the sh wrapper. Its parent is then the T3 server, so it never sees ppid 1 while T3 is running.
  • Escalate to SIGKILL after the grace period (forceKillAfter), so a timed-out probe cannot outlive the call.
  • Cache the result instead of probing on every config subscription (related: #14517, #16401).

Impact

Minor bug or occasional failure

Version or commit

T3 Code (Beta) desktop 0.1.0, with #19402 in the server bundle. Tailscale 1.102.4 (standalone).

Environment

macOS 26.7.1, Apple Silicon

Logs or stack traces

# ps
12449  ppid 1  pgid 12389  started 04:29:08  /Applications/Tailscale.app/Contents/MacOS/tailscale status --json
# pgid 12389 is the sh wrapper, no longer running

# T3 desktop trace
04:29:09.164  DesktopAppActivation.setRendererReady   (client reconnect)

# unified log
04:29:15.808  tccd  AUTHREQ_ATTRIBUTION: msgID=12449.1, responsible={identifier=com.t3tools.t3code, pid=51447, ...}
04:29:46      Tailscale[12449]  creates its menu bar status item
04:31:52      network-extension  stopTunnel: "providerDisabled"
04:36:02      network-extension  gui: [ipnBus] - Started IPN Watch Session ...
04:36:02      network-extension  gui: ondemand: Enabling VPN On-Demand persistency
11:06:02.783  network-extension  popBrowserAuthNow(""): url=true, key-expired=false
11:06:02.784  network-extension  gui: Opening browseToURL https://<control-server>/register/<redacted>
11:06:02.784  Tailscale[12449]   LaunchServices.launchViaCSUA

# For comparison, T3's runs at 03:58:29 and 04:21:00 took the CLI path: they loaded
# the VPN configuration, queried the LocalAPI, and exited within ~100 ms.

Workaround

Quit the Tailscale menu-bar app, or kill the orphaned tailscale status --json process. Authorizing or logging out the node stops the login pages.

  1. Note

    Grok responding on behalf of Julius.

    Accepted as a bug, scoped to the timed-out probe outliving its call. On main, tailscale status --json runs tailscale from PATH (tailscale.ts:21-22, 224) under a timeout with no forceKillAfter (tailscale.ts:255-257). Without that option, cleanup sends SIGTERM to the process group, waits up to a second, and never escalates. With it, cleanup sends SIGKILL to any group member still alive. Your ps shows the binary still in the wrapper's group, so escalation would have reached it. Main now waits 3.5 s instead of 1.5 s (tailscale.ts:17), which makes a timeout less likely but doesn't change the cleanup.

    The menu-bar app starting when its parent is gone comes from Tailscale's own launch logic, and we haven't confirmed why the binary survived SIGTERM.

    How often the probe runs is a separate issue. Since #19402 it runs on every config subscription (RemoteOpenTargets.ts:32-36, ws.ts:1684), and #14517 tracks the per-connect probes.

    For now, quitting the Tailscale menu-bar app or killing the orphaned process stops the login pages.

  2. juliusmarminge added labelsaccepted

  3. juliusmarminge added labelsbug

  4. juliusmarminge added labelsvia-triage

Sign in to join this conversation.