Repository navigation
fix(computers): keep links dialled before the listener opens - #1349
Merged
Merged
Conversation
A gateway starts its linked-computer runtime, whose first tick dials every partner, before network access opens its listener. The first advertisement then saw the listener's addresses as a network change and rotated every link: links that had just completed their handshake were marked retiring and closed 100 ms later, and the partner stayed "unreachable" until the next dial after a backoff of about a second. In computer-moves.test.ts a restarted computer settled a committed move over such a short-lived link, the test went on, and the next StartMove failed with "Laptop C is unreachable"; the following tests in the file ran inside the same backoff window and failed the same way. The listener opening is no network change: no partner can hold a link to an earlier address, and the links this computer dialled keep working. Partners still get the new routes in a routes frame. Closing the listener and interface or address changes still rotate the links. The moves test now waits for the link after restarting the source, and clears crash hooks and restarts stopped runtimes after each test so a failure cannot carry over. lan-routes covers a restart whose link is up before its listener opens. Fixes: #348 Co-Authored-By: Claude Opus 5.5 <[email protected]>
nixuuu
enabled auto-merge (squash)
November 27, 2026 16:47
nixuuu
disabled auto-merge
November 27, 2026 16:58
Opening the listener no longer retired links, but it also stopped clearing dial retries and read circuits. A partner that failed while this computer was unreachable stayed blocked for the 30 s circuit backoff, so thread mirror tests that toggle network access timed out waiting for the link. Opening the listener now clears retries and read circuits without aborting dials: a dial controller owns its live link, so aborting it would drop a link made before the listener opened. Co-Authored-By: Claude Opus 5.5 <[email protected]>
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.
Changes
Root cause. A gateway starts its linked-computer runtime before network access opens its listener. The runtime's first tick already dials every partner. When the listener opened, the first address advertisement treated the listener's addresses as a network change and rotated every link (
computersReconnectwith the 100 ms flush). A link that had finished its handshake in that window was marked retiring and closed 100 ms later. The partner then stayed "unreachable" until the next dial, after a backoff of about a second.In
tests/integration/computer-moves.test.ts, the restarted source (A) settled the committed move over such a short-lived link, sofinalState(id1)returneddoneand the test continued. The nextStartMovefailed withLaptop C is unreachable since …. The two tests after it ran inside the same backoff window and failed the same way (CI run 46031074683, shard 8/12). Delaying the fixture'snetwork.start()by 300 ms reproduced the same three failures, plus the earlier "interrupted before the decision" test.runtime-lan.ts: opening the listener (gateway start, or network access turned on) is not treated as a network change. No partner can hold a link to an earlier address, and links this computer dialled keep working. Partners still get the new routes in aroutesframe. Closing the listener and interface or address changes still rotate links.computer-moves.test.ts: waits for the link after restarting the source. AnafterEachclears crash hooks and restarts link runtimes a test left stopped, so a failure cannot carry over to later tests.lan-routes.test.ts+support/computers.ts: a fixture hook (beforeListening) runs between runtime start and listener start, the same order as a gateway. A new test checks that a link dialled before the listener opens is not retired. It fails on the old code (2/2 runs) and passes with the fix.docs/linked-computers.md: documents the behaviour and adds a status line.Fixes: #348
Verification
Ran locally:
computer-moves.test.tsviacheck:tmp: 15/15 passes in a row, 5/5 under 18 busy-loop CPU hogs (load average about 20), and passing with a 300 ms delay before the listener opens (this delay made 4 tests fail before the fix).lan-routes,linked-routes-status,linked-computers,computer-relay,network-access,linked-relocation,tailscale-network: all pass.tsc --noEmitfortests/integrationandapps/gateway; oxfmt and oxlint on the edited files.Left to CI: the full gate (all test shards, repo-wide typecheck/lint/format,
gen:check, builds).Copy audit: no UI text changed.
Follow-up: thread mirror regression
The first version made
thread-mirrors.test.tsfail in every run (3/3 locally, CI run 46036520107): opening the listener no longer calledcomputersReconnect, which was also what cleared dial retries and read circuits. A partner that failed while this computer was unreachable stayed blocked for the 30 s circuit backoff. Opening the listener now callscomputersRedial(clear retries, reset read circuits) without aborting dials: a dial controller owns its live link, so aborting it would drop the link this PR keeps.Verified locally:
thread-mirrors3/3 (was 0/3),computer-moves+lan-routes3/3, andlinked-computers,linked-routes-status,network-access,computer-relay,linked-relocation,linked-thread-liveness58/58 throughcheck:tmp. Gateway typecheck, oxlint, oxfmt.🤖 Generated with Claude Code