Repository navigation
fix: --host over ssh no longer evicts a session host started with CODEAF_SYNC_URL - #2067
Merged
Merged
Conversation
…of evicting it `codeaf chat --host` runs `codeaf engine` under a non-interactive ssh shell, which rarely carries the CODEAF_SYNC_URL a person exported in their own terminal. The session host compared that launch's resolved relay (the saved or hosted one) with the relay the terminal's variable had named, read the silence as a different sync setting, and retired the idle host or refused a busy one. The terminal's next launch did the same back, so --host and a local window on a self-hosted relay took the workspace from each other in turn. Only a relay this process names is a choice now. With CODEAF_SYNC_URL set the full resolved answer is compared, as before. With it unset, only what both sides read from the same home — a pairing's saved address, else the hosted default — is compared, recorded by the host as `sync-unnamed`. The provider fingerprint no longer carries the relay, so the same launch cannot restart an idle host through EnvironmentDiffers either. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
What was wrong
codeaf chat --host <machine>runscodeaf engineon that machine under a non-interactive ssh shell. That process attaches to the machine's per-workspace session host — the same one a localcodeafwindow there uses.Since Wormhole (#1888), the attach check (
clearStaleEngineHostAs→enginehost.SyncDiffers) compares the relay the attaching process resolves with the relay the host resolved at startup. The ssh shell usually lacks theCODEAF_SYNC_URLthe person exported for a self-hosted relay. So the ssh launch resolved the saved or hosted relay, saw a "different sync setting", and retired the idle host, or refused withthe background engine for this folder started with a different environment…when the host was busy. The local window's next launch did the same in reverse. The two took the workspace from each other in turn.--hostand the relay are separate features:--hostis ssh transport, and the relay is chat sync. They meet only at that host-compatibility check.The fix
Only a relay the attaching process names counts as a choice.
CODEAF_SYNC_URLset: the full resolved relay is compared, as before. An explicit different address oroffstill retires an idle host and refuses a busy one (C10 unchanged).CODEAF_SYNC_URLunset: only what both sides read from the same home is compared: the address a pairing saved, else the hosted default. The host now records that value assync-unnamednext tosync-environment. A changed pairing still restarts an idle host.environmentfingerprint no longer includes the relay, so the same launch cannot restart an idle host throughEnvironmentDiffersinstead.EnvironmentMAC(used by the automations clock) is unchanged.The manual's A different sync setting on an existing engine section now covers this. It also quotes the refusal exactly as the code spells it, since the old quote had drifted.
Validation contract
CODEAF_SYNC_URLjoins a host that a terminal started withCODEAF_SYNC_URL=<url>, idle or busy. The PID is unchanged and there is no note and no refusal. Covered byTestC10ALaunchThatNamesNoRelayJoinsTheHostATerminalStarted, which fails ondevfor both busy states and passes here.TestC10AChangedSavedRelayStillRetiresAnIdleHost.offstill retires an idle host and refuses a busy one, for same, older and newer builds. Covered by the existingTestC10*tests, which pass unchanged.Local:
go build ./...,go veton the touched packages, and focusedTestC10|TestSameOrUnknown…|TestEngineStatusReports…|TestDifferentEnvironmentincmd/codeaf, plus the enginehost and syncsetup relay tests, all green. Touched-package suites are left to CI.Not changed (follow-up if wanted)
CODEAF_SYNC_URLwhile the--hostwindow is attached. That is the explicit-choice rule working as designed. Saving the relay with a pairing, instead of exporting it per shell, avoids it.🤖 Generated with Claude Code