Repository navigation
fix(cli): select the Tailscale Serve origin matching the current device - #25
Draft
andromarces wants to merge 1 commit into
Draft
andromarces wants to merge 1 commit into
andromarces wants to merge 1 commit into
Conversation
codor install built the pairing link from the first https origin in tailscale serve status. Tailscale keeps a handler keyed by the old MagicDNS name after a tailnet rename and lists it first, so the link carried a hostname that no longer resolves. Read Self.DNSName from tailscale status --json and return the origin whose host matches it and whose handler proxies to the local endpoint. Fail with a diagnostic naming the configured origins and the tailscale serve reset escape when none matches.
This branch has not been deployed
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.
Fixes #24.
Problem
With Tailscale Serve access,
codor installbuilds the pairing link from the firsthttps://originin
tailscale serve status. After a tailnet DNS rename, Tailscale keeps the Serve handler keyed by theold MagicDNS name and lists it first, so the link and its
?endpoint=parameter carry a hostname thatno longer resolves. Codor never reads the node's current
Self.DNSName, soserve statusorder alonedecides the endpoint.
Result
The pairing origin is now the HTTPS origin whose host matches the current device name and whose root
handler proxies to Codor, regardless of the order
serve statusprints.Implementation
tailscale status --jsonSelf.DNSName(trailing dot removed).An unreadable or absent name fails with its own diagnostic.
tailscale serve statustext into per-origin root-path proxy targets.Self.DNSNameand whose/handler proxies to the localendpoint.
tailscale serve resetclears all Serve config on the node. Zero HTTPS origins keeps the existing "did not report a private
HTTPS origin" message.
tailscale status --jsonfailure now reports "Tailscale status command failed" instead of the Servelabel.
tailscale status --jsonread.Parser scope
Matches Tailscale's port/path granularity, checked against
cmd/tailscale/cli/serve_legacy.goandcmd/tailscale/cli/serve_status.goat v1.102.4:HTTPS origin printed before it;
/handler qualifies, so a/subproxy does not;host:10443can precedehoston 443, andwhy order alone is not authoritative.
Compatibility decision
Codor's serve command publishes the root handler on HTTPS 443, so the HTTPS-only, root-only match
reflects what Codor itself created. This adds a dependency on the
tailscale status --jsonshape. Theread degrades to a clear failure, never a silent stale pick.
Harn
Touches
setup-bounds-tailscale-serve-consent-and-keeps-diagnostics-actionable, nested insetup-resolves-and-capability-probes-tailscale-serve. The bounds contract stays intact: onlyserve --bgis bounded;status --jsonandserve statusstay unbounded..harn/is not edited.Tests
setup-tailscale.spec.tspasses, including 7 new cases: stale-first two-origin selection, all-originsno-match diagnostic, current-name wrong-proxy rejection, unreadable device name, non-root
/subignored, HTTP-handler boundary, and the
status --jsonfailure label.baseline run on unmodified
main(03481a3) reproduced the same 11 failures, 5 inlauncher-install.spec.tsand 6 inupdate.spec.ts. Earlier runs also reported anindex.spec.tsworktree lifecycle timeout that did not recur. None of the failures is Tailscale-related. The suite
total grows from 297 to 304, the 7 new cases.
pnpm -r testaborts inpackages/adapters/antigravityon Windows before reaching@codor/cli. CIruns
pnpm -r --workspace-concurrency=1 teston Ubuntu; that gate was not run on this platform.Not tested
index.spec.tssetup integration case isposixHostIt-guarded, so itdid not execute here; the parser cases run on every platform.
tailscale serve resetremoved the old handler. Stale-first selection is unit-tested.https://<device>.<current-tailnet>.ts.netwith the call orderserve --bg,status --json,serve status.