Repository navigation
feat(tailscale): just-works default + --no-tailscale opt-out - #112
Conversation
Reverses my earlier "skip the prompt entirely because Tailscale is optional" choice. Joel's read of the 90% case: "tailscale logs out all the time; default should JUST WORK — if you got it, use it. Otherwise it's a setting/pref." Behavior: - Default: at startup of every airc connect / airc join, if Tailscale is installed but the daemon reports Logged out / NeedsLogin, surface a non-fatal warning and (Mac) auto-foreground Tailscale.app for sign-in. Same-machine and same-LAN substrate paths still work without it; the prompt is for the remote-mesh use case the host has in mind. - Opt-out: --no-tailscale flag on `airc join` / `airc connect`. Sets AIRC_NO_TAILSCALE=1 internally so the existing call sites (status detection, host_address_set tailscale entry, advise_tailscale_if_down) all respect it. Flag is the primary user-facing API; env var is the internal toggle. Files: - airc: tailscale_login_check_or_prompt() function; --no-tailscale flag in cmd_connect's parser; prompt fires AFTER flag parse so opt-out takes effect. Cold-host banner restored to "Hosting #X" wording so scenario_room's assertion + the human-readable "we're hosting" signal both stay intact. - airc.ps1: Test-TailscaleLoginOrPrompt; --no-tailscale flag in Invoke-Connect's parser; same post-parse call shape as bash. - skills/join/SKILL.md: description updated to match the post-#104 default (#general unconditionally), with a Tailscale paragraph documenting the prompt + --no-tailscale opt-out so a Claude agent driving airc knows about both. Verified on this Mac: - AIRC_NO_TAILSCALE=1 → prompt suppressed - Tailscale signed in → prompt suppressed (status output isn't Logged out) - scenario_room: 14/14 still pass after banner wording fix Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
There was a problem hiding this comment.
Pull request overview
This PR updates the “just works” Tailscale behavior by nudging users to sign in when Tailscale is installed but logged out, while adding an explicit --no-tailscale opt-out. It also updates the join skill documentation to reflect the default #general room behavior and the new Tailscale flow, with bash + PowerShell parity.
Changes:
- Add a startup Tailscale “logged out” check in bash and PowerShell connect flows, with a non-fatal sign-in nudge.
- Introduce
--no-tailscaleto setAIRC_NO_TAILSCALE=1as an explicit opt-out. - Update the join skill doc to reflect defaulting to
#generaland the new Tailscale behavior.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| skills/join/SKILL.md | Updates join skill guidance for #general default + Tailscale behavior/opt-out. |
| airc.ps1 | Adds Test-TailscaleLoginOrPrompt and parses --no-tailscale before connect starts. |
| airc | Adds tailscale_login_check_or_prompt, parses --no-tailscale, and tweaks the hosting banner text. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| [ "${AIRC_NO_TAILSCALE:-0}" = "1" ] && return 0 | ||
| local ts_bin; ts_bin=$(resolve_tailscale_bin 2>/dev/null || true) | ||
| [ -z "$ts_bin" ] && return 0 # not installed; no nag (Tailscale truly optional) | ||
| local out; out=$("$ts_bin" status 2>&1) |
There was a problem hiding this comment.
In tailscale_login_check_or_prompt, out=$("$ts_bin" status 2>&1) can terminate the whole script under set -e when tailscale status exits non-zero (e.g., daemon down / transient failure). Since this helper is intended to be non-fatal, wrap the status call to avoid errexit (e.g., capture rc with || true) and treat non-zero as “no nag / return 0”.
| local out; out=$("$ts_bin" status 2>&1) | |
| local out rc | |
| rc=0 | |
| out=$("$ts_bin" status 2>&1) || rc=$? | |
| [ "$rc" -ne 0 ] && return 0 |
| --no-tailscale|-no-tailscale) | ||
| # Opt out of Tailscale entirely: skips the login prompt AND | ||
| # drops the tailscale entry from host_address_set so the | ||
| # gist envelope advertises only localhost+LAN. The flag is | ||
| # the primary user-facing API; AIRC_NO_TAILSCALE=1 stays as | ||
| # an internal toggle for code that already reads it. | ||
| export AIRC_NO_TAILSCALE=1 | ||
| shift ;; |
There was a problem hiding this comment.
--no-tailscale sets AIRC_NO_TAILSCALE=1, which currently also short-circuits advise_tailscale_if_down in the resume path. If the saved host_target (or an explicit target) is a Tailscale CGNAT IP, this can reintroduce the “hang on SSH ConnectTimeout + retry forever” failure mode with no actionable message. Consider fast-failing when --no-tailscale is used and the target/resume host is 100.64/10, or otherwise preserving the fail-loud behavior for that specific case.
| - `No live #general found on your gh account — hosting fresh.` — we're the host. Subsequent agents who run `airc join` will auto-join. | ||
| - `✓ Multi-address pick: <addr>:<port> (from host.addresses)` — joiner found the host's gist and selected the cheapest reachable address. `127.0.0.1` means same-machine match; a `192.168.x.x` means same-LAN; `100.x.x.x` means via Tailscale. | ||
| - `⚠ Tailscale is installed but you're not signed in.` — non-fatal nudge; same-machine and same-LAN paths still work. Either sign in (the launched Tailscale.app) or pass `--no-tailscale` to silence. |
There was a problem hiding this comment.
The documented first-event outcomes don’t match current airc output. In particular, the “host” case now prints a Hosting #<room> — ... banner rather than No live #general found on your gh account — hosting fresh., and the Tailscale warning text references “the launched Tailscale.app” even on Linux/Windows where nothing is launched. Updating these example strings will keep the skill aligned with what users/agents actually see.
| - `No live #general found on your gh account — hosting fresh.` — we're the host. Subsequent agents who run `airc join` will auto-join. | |
| - `✓ Multi-address pick: <addr>:<port> (from host.addresses)` — joiner found the host's gist and selected the cheapest reachable address. `127.0.0.1` means same-machine match; a `192.168.x.x` means same-LAN; `100.x.x.x` means via Tailscale. | |
| - `⚠ Tailscale is installed but you're not signed in.` — non-fatal nudge; same-machine and same-LAN paths still work. Either sign in (the launched Tailscale.app) or pass `--no-tailscale` to silence. | |
| - `Hosting #general — ...` — we're the host. Subsequent agents who run `airc join` will auto-join. | |
| - `✓ Multi-address pick: <addr>:<port> (from host.addresses)` — joiner found the host's gist and selected the cheapest reachable address. `127.0.0.1` means same-machine match; a `192.168.x.x` means same-LAN; `100.x.x.x` means via Tailscale. | |
| - `⚠ Tailscale is installed but you're not signed in.` — non-fatal nudge; same-machine and same-LAN paths still work. Either sign in to Tailscale (on Mac, `airc join` may launch Tailscale.app; on Linux/Windows, follow the printed `tailscale up` guidance) or pass `--no-tailscale` to silence. |
| '^(--no-tailscale|-no-tailscale)$' { $env:AIRC_NO_TAILSCALE = '1' } | ||
| default { $positional += $Argv[$i] } | ||
| } | ||
| } | ||
|
|
||
| # Tailscale-installed-but-logged-out nudge. AFTER flag parsing so | ||
| # --no-tailscale takes effect. Default: prompt to sign in if it's | ||
| # installed but logged out (90% case is "I want it on, just got | ||
| # logged out"). --no-tailscale is the explicit opt-out. | ||
| Test-TailscaleLoginOrPrompt | ||
| $target = if ($positional.Count -gt 0) { $positional[0] } else { '' } |
There was a problem hiding this comment.
--no-tailscale sets AIRC_NO_TAILSCALE=1, but Advise-TailscaleIfDown returns $false immediately when that env var is set. On a resume path where the cached host_target is a CGNAT (100.64/10) Tailscale IP, this removes the intended fail-loud guidance and can fall back to repeated SSH timeouts. Consider adding an explicit fast-fail for the “no-tailscale + CGNAT target” case (or adjusting the guard so only the general ‘nag’ is suppressed, not the hang-prevention).
fix(tailscale): just run `tailscale up` synchronously (cross-platform) PR #112 used `open -a Tailscale` on Mac to surface the sign-in flow, which brings up the GUI app's "Login Required" window with an extra "Log In..." click before the actual auth URL appears. Joel: "I think it could be simpler and more powershell friendly to do differently." Pattern continuum already uses: just run `tailscale up`. The CLI prints the auth URL straight to the user's terminal — where they're already looking — and blocks until they authorize via the URL. Modern macOS Terminal auto-links HTTPS URLs (cmd-click). Linux/Windows terminals the same. No GUI middleman, no extra click. Implementation: - Bash tailscale_login_check_or_prompt and PS Test-TailscaleLoginOrPrompt drop the `open -a Tailscale` / "open browser to URL" code path. - They run `tailscale up` synchronously, with `|| true` (bash) / try-catch (PS) so if the user cancels (Ctrl-C), airc continues. - airc proceeds to host/join with whatever address set is currently reachable (same-machine and same-LAN paths still work even if user abandons Tailscale auth). - Identical shape across both leaves. No bg jobs, no log-tailing, no URL extraction, no platform-specific browser launchers. Verified locally with mock tailscale: prompt fires, mock-`tailscale up` prints the URL, airc continues. Real mac+real Tailscale e2e was verified by the prior fix #113; this just trims the surface. Co-authored-by: Claude Opus 4.7 (1M context) <[email protected]>
Default to prompting for sign-in when Tailscale is installed but logged out (Joel: 'logs out all the time; if you got it use it').
--no-tailscaleis the explicit opt-out for the few who don't want it. Bash + PS parity. Skill doc updated.