Repository navigation
perf(cli): reuse verified Tailscale mappings before probing HTTPS - #857
Merged
Merged
Conversation
Upstream divergenceBoth sides are compared with upstream at the in-order tip
Upstream files whose difference changes (4)
|
Thread transfer impact✅ Thread transfer remains within every enforced ceiling.
Baseline: Scenario and decoded snapshot size10 historical turns, 5 command tools per turn, 878.9 KiB retained MCP result per historical turn, and a 1.05 MiB retained result in the measured turn.
Updated in place by a trusted workflow. PR artifacts are strictly validated and never executed. |
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.
Note
Reusing an exact private Tailscale Serve mapping now skips the host's redundant HTTPS self-probes. In the controlled failed-self-probe case, the packaged CLI went from 6.601s to 1.483s and made zero HTTPS requests instead of six. Healthy-path timing is inconclusive on this shared host.
A running server and its private Serve mapping can be correct while the host cannot reach its own MagicDNS HTTPS address.
pair --tailscalecurrently probes that address before inspecting the mapping and can spend five seconds retrying an endpoint it does not need to rediscover.Read the live mapping first only when its complete proxy URL equals the local origin already verified during server discovery. Reuse an exact private mapping immediately. The six-line package helper delegates to the existing strict classifier; it does not duplicate mapping policy. Funnel, foreground overrides, extra routes, different targets, and different local origins cannot take this shortcut. Dev web repointing and all fallback identity checks remain intact. The pairing implementation adds a small early-return block; existing test fixtures cover it without another test harness.
The shortcut establishes the local server and configured mapping, not public HTTPS health. It deliberately does not verify certificate readiness, DNS, or remote client reachability for an existing exact mapping. First-time configuration retains its existing checks. A nonexact same-origin fallback reads Serve configuration twice, preserving the final live ownership check rather than adding a cached snapshot.
Measured self-contained executable results against fork main
26608d8b687eab0a4c2c16e23eaec228b00161e7:Both executables used the production packing configuration, Node 26.12.0, and disabled SEA code caching. Each sample starts a fresh process and measures through exit with warm filesystem caches, after one untimed warm-up per build. Healthy/control measurements used five counterbalanced before/after pairs; delayed/failing-probe measurements used three alternating pairs. All runs used the same isolated backend and database. A synthetic Tailscale executable reported an exact private mapping; a trusted local TLS proxy provided healthy, delayed, or failed HTTPS responses. No Serve mutation occurred.
Healthy and control timing ranges overlap, so the medians do not establish a normal-case speedup. Request counts establish removal of one HTTPS round trip in the healthy case. The failed-probe case removes all six probes and five configured one-second sleeps. These measurements exclude npm resolution, SSH, real tailnet routing, and certificate provisioning. Real tailnet reachability was not verified.
Validation:
vp test run apps/server/src/cli/pair.test.ts packages/tailscale/src/tailscale.test.ts. They cover successful token/URL output without HTTPS, canonical exact-handler reuse, Funnel/foreground/extra-route protection, foreign environment rejection, dev repointing, and IPv4/IPv6 origin mismatch.Current upstream
42da166d131017335a1158d0b379dd68b8985796still probes HTTPS first and has no equivalent merged shortcut waiting in intake. The related bounded-body work is open; discovery/retry work closed unmerged. Neither has an intake position or merge date. No upstream patch or intake state was changed here.Executable timing samples (milliseconds)
Written by an agent (Codex, gpt-6.1-sol).