Repository navigation
fix(native): local connect pairs only with a matching CLI, switching drops the old connection - #49
Merged
Merged
Conversation
…'s exact version t3 pair opens and migrates the server's database, so a newer CLI could migrate a live install. Discovery now probes each recorded server and skips one that does not answer, a relative T3CODE_HOME is resolved once against the launch directory, and the CLI runs in its own process group, killed on timeout or cancel.
…tead of retrying HTTP 426 from /ws now maps to the unsupported state, not a transient failure.
…disk Edits go to the background writer, which re-reads environments.json and applies them, so a second app instance's entries survive. Adds relocate for a server's new address.
… stops pairing The terminal drawer, git store and usage page now follow a connection id, so a switch tears down the feeds that kept the old client open. Cancel and Disconnect abort the pairing in flight (and t3 pair's process group); a late result is ignored. A saved local pairing follows the server to its new address, and environment saves go to the background writer as edits.
This was referenced Nov 2, 2026
Merged
Open
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.
An independent review of the one-click "Connect to T3 Code on this Mac" flow (#44) found a safety issue and several correctness gaps. The developer is about to use it against a live install, so this PR fixes them, safety first.
What changed
t3 pair(P1 safety).t3 pairopens the server's SQLite auth store and runs its migrations, so a CLI newer than the running server could migrate a live database. The app now runs<t3> --versionfirst and pairs only when it prints exactly theserverVersioninserver-runtime.json. Otherwise it shows "The t3 CLI (vX) doesn't match the running T3 Code (vY). Create a pairing link in T3 Code → Settings → Sharing & access instead." and the paste flow stays available. It also refuses when either version is unknown.Online, so nothing keeps the oldClientHandle(and its supervisor) alive.discoverPairTargetdoes./wsnow maps to the blocked/unsupported state instead of retrying forever.environments.jsonand applies them, so two app instances keep each other's entries. The legacy migration goes through that writer too.T3CODE_HOMEis resolved once against the launch directory. That absolute path goes to both discovery and--base-dir/T3CODE_HOMEfor the CLI.Evidence
local_server), discovery falling through a non-answering origin, the timeout and cancel tests killing the CLI's grandchild, a supervisor test for 426 → Unsupported with no auto-retry, the store merge/relocate tests.T3CODE_HOME,T3_NATIVE_T3_BINwrapper, scratchT3_NATIVE_HOME):--version→ v0.1.7-nightly…):Error: The t3 CLI (v0.1.7-nightly.20261102.4061) doesn't match the running T3 Code (v0.1.6). Create a pairing link…, andpairwas never invoked.--version→ v0.1.6):paired with http://127.0.0.1:14658,status: Connected, shell snapshot. The CLI got--base-dir <absolute scratch home>from the relativeT3CODE_HOME.~/.t3/bin/t3 --versionprintst3 v0.1.7-nightly.20261102.4061, and~/.t3/userdata/server-runtime.jsonrecordsserverVersion0.1.7-nightly.20261102.4061. They match exactly, so on this machine the guard allows pairing.Not verified in a real window: the environment switch teardown, Cancel during a local pairing, and the address-move reconnect are app wiring. They are covered by review and build only, not by a runtime pass.
Claude Opus 5.5, Claude Code (factory worker W13b).