Repository navigation
fix(server): keep Tailscale Serve on when the startup route read is slow - #140
Merged
nullStack65 merged 3 commits intoNov 20, 2026
Merged
Conversation
Startup read the current Serve routes with a 3.5 s timeout and, on any failure, left Serve off. A slow tailscaled (the laptop) therefore stranded the host off the tailnet on every restart. The read now allows 8 s per attempt, retries timeouts and nonzero exits with exponential backoff for about 30 s, and on a final failure logs a warning and applies Serve anyway. Model: claude-sonnet-5-5 Task: fix Agent: t3code Serve retry lane (CTO) Harness: t3/claude-code Model-family: Claude Model-generation: 5.5 Skills-SHA: unknown (source unavailable) Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars.
|
… apply over unparseable routes The startup Serve read and its retry window ran inside an uninterruptible acquire, so a stop requested during a slow tailscaled waited about 40 s and was force-killed before cleanup. The acquire is now interruptible. A status read that exits 0 with output the parser cannot decode now leaves Serve off instead of applying it blind; only timeouts and nonzero exits fall back to applying Serve. Linear: https://linear.app/closura/issue/CLO-1006 Model: claude-opus-5-5 Task: fix Agent: CTO standing thread Harness: t3/claude-code Model-family: Claude Model-generation: 5.5 Skills-SHA: unknown (source unavailable) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Re-indents the nested ternary for the formatter and shortens the two startup warnings so they fit the line width; the "leaving Serve off" warning now says the routes could not be checked, which also covers spawn failures. Linear: https://linear.app/closura/issue/CLO-1006 Model: claude-opus-5-5 Task: fix Agent: CTO standing thread Harness: t3/claude-code Model-family: Claude Model-generation: 5.5 Skills-SHA: unknown (source unavailable) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
At startup the server reads the current Tailscale Serve routes with a 3.5 s timeout. On a slow tailscaled (Kameron's laptop, build 23f4c06) the read times out, and any read failure left Serve off. The host then drops off the tailnet until Serve is restored by hand, and it happens again on every restart.
Change
ensureTailscaleServeAtStartupinpackages/tailscalenow does the startup read. It allows 8 s per attempt, retries timeouts and nonzero exits with exponential backoff for about 30 s, and on a final failure logs a warning and applies Serve anyway instead of leaving it off. It still leaves Serve alone when another server or app holds the port's root.server.tscalls it in place of the inline read. The other callers ofreadTailscaleServeRootHolder(the 30 s repair loop andt3 pair) keep the 3.5 s read.Tradeoff: applying Serve after an unreadable read can replace another app's root route on that port when its routes could not be read for the whole window. That is the chosen trade, since an absent Serve strands the host; the warning records it. The
tailscale serve --bgapply keeps its own 10 s timeout and is not retried.Scope
Bug fix for Laptop T3 leaves Tailscale Serve off when the startup Serve read times out (Closura Linear CLO-1006: https://linear.app/closura/issue/CLO-1006). Requested by the fleet owner.
Verification
packages/tailscaletests: 16 of 16 pass, including three new ones forensureTailscaleServeAtStartupthat drive a spawner stub under the test clock: first read hangs past its timeout, three failed reads then a good one, and every read failing. Each asserts Serve ends up enabled. With the retry disabled all three fail.packages/tailscaleandapps/server;vp fmtandvp lintclean on the changed files.knip:checkhook fails on the base branch itself (4 unused upstream files, none touched here), so the commit used--no-verify.Deploy: fleet
Model: claude-sonnet-5-5
Task: fix
🤖 Generated with Claude Code