Repository navigation
fix(tailscale): guide recovery of existing foreground claims - #139283
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: needs maintainer review before merge. Reviewed September 5, 2026, 3:08 PM ET / 19:08 UTC. ClawSweeper reviewWhat this changesThe PR distinguishes foreground Tailscale conflicts in startup errors, documents recovery through the confirmed owning process, and simplifies the startup-timeout regression test. Merge readiness✅ Ready for maintainer review This remains a useful recovery follow-up: current main and v2026.9.1 still recommend background-handler removal for foreground conflicts. No blocking patch defects found; the merged prevention repair does not replace this work. Priority: P2 Review scores
Verification
How this fits togetherManaged Tailscale ingress gives the Gateway an HTTPS endpoint through Serve or Funnel. Gateway startup reads existing routes, acquires a foreground claim, and reports conflicts through the route-ownership error. flowchart TD
A[Gateway startup] --> B[Read Tailscale routes]
B --> C[Acquire foreground claim]
C --> D{Port available?}
D -->|Yes| E[Managed HTTPS endpoint]
D -->|No| F[Classify existing claim]
B --> F
F --> G[Scoped recovery guidance]
Before mergeNone. Agent review detailsSecurityNone. PR surfaceSource +29, Tests -17, Docs +18. Total +30 across 7 files. View PR surface stats
Review metrics
Technical reviewBest possible solution: Keep recovery classification in the existing error owner using the already-read status; the bounded production growth supplies missing session diagnostics without unsafe automatic process reclamation. Do we have a high-confidence way to reproduce the issue? Yes, from source: an existing foreground claim produces a port conflict, but current main recommends background-handler removal. The added Gateway regression covers that trigger; it was not executed during this review. Is this the best way to solve the issue? Yes. The existing conflict owner is the appropriate boundary, and reusing its caller’s status snapshot avoids extra subprocesses; automatic termination would require ownership evidence the snapshot cannot establish. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against e7590cd58042. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
History |
Co-authored-by: PollyBot13 <[email protected]>
|
Merged via squash.
|
…w#139283) * fix(tailscale): explain recovery for existing foreground claims * fix(tailscale): validate diagnostic values and recovery matchers Co-authored-by: PollyBot13 <[email protected]> --------- Co-authored-by: PollyBot13 <[email protected]>
Related: #126445 (Tailscale orphan crash loop), #126457, and #139261.
What Problem This Solves
Fixes an issue where a Gateway blocked by an existing foreground Tailscale claim recommends
serve ... off, a command that only removes background Web handlers and cannot release that claim. Operators recovering an orphan left by a pre-fix Gateway need to identify and stop its confirmed owning process.Why This Change Was Made
Foreground conflicts now identify the observed session and route and direct the operator to stop only a confirmed owning process. The already-read status snapshot supplies the diagnostic; Tailscale does not expose the claiming CLI PID, and this change does not infer process ownership. Existing background-route guidance remains scoped to a confirmed stale route.
The prevention repair landed in #139261 while this follow-up was in progress. This PR completes its named recovery-guidance follow-up and documents the one-time manual recovery. It also removes a fake-clock/filesystem-marker test handshake that stalled validation, retaining the real startup-timeout and original-error assertion.
User Impact
Operators can distinguish a foreground claim from a background handler and follow the appropriate recovery steps. Historical claims remain untouched until their owner confirms and stops them. See the Tailscale guide.
Thanks to @PollyBot13 for the original report and contribution in #126445 and #126457; the contributor trailer is preserved here and in #139261. No automatic orphan reclamation, shutdown-timeout policy, or persistence design is introduced.
Evidence
Exact head:
5d4fa89057e94ddbc4bf28b243856cd71eb14611. Exact-head CI is green. Fresh branch autoreview is scoped-clean at P0–P2. The final Crabbox five-file test run and fullnode scripts/check-changed.mjscompleted successfully on this exact source.offcommand, and passed afterward with session/route/process-stop guidance. Existing background adoption and independent-route cases passed: 22 Gateway tests.node scripts/check-changed.mjspassed initial guards, formatting, dependency/boundary checks, and the TypeScript graph boundary, then stopped because declaration inputs resolve outside this dependency-less worktree. Local process runs also encountered missing files in the sharedtsx/zodinstallation. Prepared remote dependencies are used for complete proof.BackendState=Stopped,SelfOnline=false. No operator daemon, route, Gateway, or state was changed. The approved fallback is process/socket and Gateway-owner tests. fix(tailscale): release managed routes after Gateway crashes #139261 separately records real built-Gateway before/after proof on Crabbox with a synthetic TCP claimant; it is not authenticated Tailscale proof.53a0d659afa51835dd7a9283873cca44261454f8:cmd/tailscale/cli/serve_v2.go:490-548,1529-1585andipn/ipnlocal/serve.go:425-433establish foreground watch ownership and background-only handler removal.Production LOC: +42/-13 (net +29). Tests/support: +12/-29 (net -17). Docs: +19/-1. Growth is the explicitly requested missing recovery path: port-scoped session/route extraction and carrying existing status into the error owner. The prevention in #139261 separately removed one production line. No new config/env option, schema, protocol, or external call.
NO-FOLLOW-UP: this completes the prevention PR's named recovery follow-up and removes the nearby fragile test handshake; no further owner refactor earns its scope here.
Final remote proof transcript
Provider
blacksmith-testbox, leasetbx_01m1se3ea3ycw0epbexgc8hs58; backing workflow. The wrapper verified source5d4fa89057e94ddbc4bf28b243856cd71eb14611, raw treeaf21d3b07eb4252b45509e65260e8ccdd69ff548before execution.The combined remote payload took 18m11s after source synchronization. The provider's external portal sync timed out after successful execution; this did not change the command/wrapper success. The lease was stopped after proof. Initial CI failures were corrected, then final exact-head CI passed. The latest ClawSweeper review had no findings or rank-up moves; fresh final branch autoreview was scoped-clean at P0–P2.