[PR -- Features] Tailscale detection core: tailnet status, serve, doctor (mesh 1/5) - #2512
sethkarten wants to merge 3 commits into
Conversation
Prime Agent performance — completedPR Overall: 0 regressed · 0 improved · 41 no clear change.
Python runtime
Session transport
UI interactions
Sandbox cost: ~$0.1043 — no inference calls. Methodology and samplesMain resolved at 2026-09-22T17:19:56.008699+00:00. Harness
|
…doctor, mesh docs) First PR of the Tailscale agent-mesh stack: detection only. - prime-agent tailscale: tailnet state, MagicDNS suffix, node hostname (human or --json) - prime-agent tailscale serve --port <n> [--funnel]: wraps tailscale serve/funnel --bg with pre-flight checks and post-serve verification - probeTailscale() exported as the detection seam for the mesh PRs (peer discovery, remote-session labels, cross-machine messaging/spawn) - doctor surfaces the same detection in human mode - docs/tailscale.md describes the mesh (detection + remote agents); the manual workaround patterns (SSH, container MagicDNS, MCP connector) are superseded by the mesh and removed - dual-reviewer findings closed: unparseable-status and https-default-port tests, --json listed in the command registry
3c74e50 to
6ce4765
Compare
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 248a36e. Configure here.
…le after successful probe Human `prime-agent tailscale` (no --json) returned exit 1 when `tailscale serve status` failed or was unparseable, even after the probe confirmed the node is on a tailnet. --json already returned 0 for the same probe. Return 0 after printing the yellow warning so older or serve-less Tailscale installs do not look down despite a successful detection. Pinned by a regression test (serve-status exits non-zero after probe succeeds).

Motivation
User-requested feature: first-class Tailscale support as the foundation of the Tailscale agent mesh — see your agents running across your tailnet, message and spawn them, with the UI showing which tailscale connection each remote agent runs on. This is PR 1 of the 5-PR mesh stack: the detection core, trimmed from #2451.
Stack (each PR bases on the previous):
tailscalecommand, doctor facts, mesh docsWhat it adds
prime-agent tailscale— tailnet state, MagicDNS suffix, this node's hostname, and served endpoints;--jsonmachine-readable form (valid JSON even on failure paths)prime-agent tailscale serve --port <n> [--funnel]— wrapstailscale serve|funnel --bg localhost:<n>; requires an explicit--port(never guesses a default), validates 1-65535 before any side effect, exits 1 on every failuretailscalecan exit 0 after only printing an interactive enable URL without configuring anything; the wrapper re-readsserve status --jsonand refuses success when the target is absent (exact port match — 80 does not match localhost:8000, default ports 80/443 mapped)probeTailscale()exported as the detection seam the mesh PRs build on: ENOENT (absent) vs EACCES/hang (installed-but-unusable),BackendStatevsSelf.Online(stopped backend vs up-but-offline),CurrentTailnet.MagicDNSSuffixpreferred over the deprecated top-level field, hostname suffix trimmingprime-agent doctorsurfaces the same detection in human mode (doctor --jsonstays pure JSON)Verification
test/tailscale.test.ts: probe states, serve argv pinned exactly (serve|funnel --bg localhost:<n>), post-serve verification (substring trap, default ports incl. https 443), parser forms, unparseable status output, status failure diagnosticstest/public-command.test.ts(55),test/owned-session-worker.test.ts(4)npm run checkgreen: biome, test-line budget vs origin/main, tsgo, installer, push-guard, browser-smokenpm run buildgreen--jsonin the command registry); remaining findings judged intended design (tailscale exit-code passthrough on serve failure is the best diagnostic; internalrunTailscaleargs are hardcoded literals with no user input)No-Ticket: user-requested feature (Tailscale agent mesh), PR 1 of 5; supersedes #2451's scope for this stack.
Note
Medium Risk
tailscale serve/--funnelchanges network exposure and spawns the Tailscale CLI; verification can fail after a partial serve, leaving cleanup to the user.Overview
Adds first-class Tailscale support as mesh PR 1/5: a new
prime-agent tailscalecommand, shared detection viaprobeTailscale(), and human-only Tailscale lines inprime-agent doctor.prime-agent tailscale(default status) reports CLI presence, tailnet up/offline state, MagicDNS suffix, hostname, and localservemappings;--jsonis status-only.tailscale serve --port <n> [--funnel]wrapstailscale serve|funnel --bg localhost:<n>with explicit port validation, preflight probes, and post-command verification so a zero exit from Tailscale cannot count as success unlessserve status --jsonshows an exact local port match (including default 80/443).probeTailscale()is exported as the internal seam for later mesh work (peer discovery, remote session labels). Docs indocs/tailscale.mdand a changelog entry describe the staged agent mesh; vitest coverage uses PATH shims for probe, parser edge cases, serve argv, and verification traps.Reviewed by Cursor Bugbot for commit 863620a. Bugbot is set up for automated code reviews on this repo. Configure here.
Note
Add
tailscaleCLI command with status, serve, and doctor integrationprime-agent tailscalewithstatus(default) andserve/funnelsubcommands, plus JSON output mode for machine-readable stateprobeTailscaledetects CLI availability, tailnet membership, MagicDNS suffix, hostname, and up-but-offline state via bounded Tailscale CLI invocations (15s timeout)runTailscaleServevalidates ports, checks probe state, runs serve/funnel in background mode, and verifies the requested local port is actually exposedrunDoctoroutput now includes a one-line Tailscale fact; tailscale.md documents all modes and the staged mesh planrunPublicCommandnow handlestailscaledirectly instead of forwarding it downstream; status exits non-zero when the CLI is missing or the node is not on a tailnetMacroscope summarized 863620a.