Repository navigation
feat(hostsync): sync login accounts from the main machine to hosts - #159
Merged
Merged
Conversation
… on hosts - Mark replica accounts with origin main in account meta; a login on the host takes the account over. - PublishReplica and DeleteReplica write replicas under the account refresh lock with local generations, comparing credentials by content so a re-login on the main machine always wins. - The refresher never renews an access-only replica, never tears a replica down on invalid_grant, and reports a refused replica token; such a replica fails with a wait-for-main-machine error. - Add RefreshAhead and a Published hook for renewing pushed credentials early.
…hosts - The push bundle carries a replica of every login account on the main machine; codex and cline replicas carry no refresh token, antigravity ones carry the whole credential. - Hosts apply replicas after rename replay and merge, with explicit pool calls so new, changed, paused and removed accounts go live without a restart; local logins are never replaced. - Login providers take the main pin and replica model catalogs unless the host pinned its own account. - Hosts report refused replica tokens by hash in the edits answer; the main machine renews them before the push. The main machine also renews rotating-grant credentials ahead of expiry and pushes on credential changes. - Replica pause, resume, priority and delete on a host answer 409 managed_by_main.
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.
Why
Login providers (codex, antigravity, cline) synced to a host arrived with models but no accounts, so every request on the host failed with
account: account not found. Copying credential files does not work: generations are counted per machine, the host daemon only reads accounts at startup, and codex/cline refresh tokens are one-time, so two machines refreshing the same account invalidate each other.Scope
managed_by_main.sync-base.jsonstores no replica data.Blast Radius
Host sync apply path, refresher, account pool and meta, and the pusher. Hosts on an older version ignore the new bundle fields. The desktop and web UI still show account controls for replicas, which now answer 409.
Verification
go build ./...passes.go test ./internal/hostsync/... ./internal/auth/... ./internal/account/... ./internal/daemon/... ./internal/management/... ./internal/provider/... ./internal/config/... ./internal/store/... ./internal/routing/...passes.sync-base.json; refresh ahead only while a host has sync on.Model: claude-opus-5-5