Repository navigation
feat(computers): share providers, models and proxies across computers - #164
Merged
Merged
Conversation
nixuuu
force-pushed
the
feat/linked-shared-config-2
branch
from
November 5, 2026 12:22
9d8c2f7 to
abedd2a
Compare
Provider instances (name, connection, proxy, colour, launch arguments, own-login choice, all workers, model lists, API keys and secret variables) and proxies are now shared configuration records with per-field versions across linked computers. CLI paths and homes stay on each computer; per-worker choices stay local. - Secret values travel only on the pinned link stream, are re-encrypted with the receiver's key (config_secrets) and never reach history of another computer, the BFF, logs or other computers' workers. - Identity merge on link: endpoint instances with the same harness, address and key, and proxies with the same kind, address and secret, become one element with a deterministic alias; the same instance id for different accounts splits into two. - Routed calls translate instance ids through aliases; links without Share configuration translate nothing. - Conflict notices and Restore cover instances and proxies, including deletions; migration 0074_config_providers converts pending 0050 instance and model questions. - Providers and Proxies lose the per-item share toggle and show notices; the instance runtime marks CLI paths as this computer's.
nixuuu
force-pushed
the
feat/linked-shared-config-2
branch
from
November 5, 2026 14:43
abedd2a to
7cd77f3
Compare
nixuuu
marked this pull request as ready for review
November 5, 2026 14:43
nixuuu
added a commit
that referenced
this pull request
Nov 5, 2026
Linked computers now show the real provider status of each other's workers, and no longer report equal shared settings as conflicts. **1. A remote worker's instance status was dropped** (introduced by #176) On each Mac, the other computer's worker showed only "Available", with no auth, version or connection details. So each Mac looked as if the other used the device login, though both used the proxy. - **Fix:** overview snapshots and updates carry the home worker's report: auth kind, CLI version, effective connection kind (with per-worker overrides) and check time. - **Older peer:** a peer that does not send the report gets an explicit "unavailable" status instead. **2. Conflicts were recorded for equal values** (introduced by #164) Conflict detection compared stored representations: - re-encrypted secrets, whose ciphertext differs on each computer; - proxy aliases; - defaults versus explicit values. So almost every field looked different. It now compares effective values: the secret plaintext inside the gateway, canonical proxy aliases and effective defaults. HLC ordering is unchanged, and a reused clock with a different value is still rejected. **3. Stale notices stayed open** (introduced by #157) Notices whose values have converged are now dismissed automatically, including stored legacy notices and after a restart. Real conflicts keep Restore and Dismiss. No migration is needed. **Tests:** 8 new regression tests across two linked gateways: - remote provider rows on both sides; - identical encrypted values give no notice; - a real divergent edit gives exactly one notice; - convergence clears notices, also after a restart; - version skew and clock ties. `check:tmp`: 1406 passed, 0 failed. **Checked** in a browser with two linked gateways: light and dark, desktop, narrow and phone width, with long names, real conflict notices and automatic clearing. **Copy audit (§8):** explicit unknown states, sentence case, no duplicated "Proxy" label, and no meaning carried by colour alone. **After updating both Macs:** both provider rows should show Proxy with auth, version and check time, and the equal stale notices should disappear. `native` stays the instance id; "Proxy" names its connection. Fixes: #176 Fixes: #164 Fixes: #157
nixuuu
added a commit
that referenced
this pull request
Nov 9, 2026
Track bootstrap intent and preserve concurrent provider and account edits until an explicit choice. Keep local CLI homes and worker overrides, and scope recovery commands to the effective login home. Fixes: #164
nixuuu
added a commit
that referenced
this pull request
Nov 9, 2026
Track bootstrap intent and preserve concurrent provider and account edits until an explicit choice. Keep local CLI homes and worker overrides, and scope recovery commands to the effective login home. Fixes: #164
nixuuu
added a commit
that referenced
this pull request
Nov 9, 2026
Linking a fresh desktop could replace an existing `claude:native` definition with its later bootstrap defaults. In particular, resetting `ownLogin` could make the worker remove the instance's existing `.credentials.json` while trying to link an absent device login. A two-gateway regression reproduced the overwrite before this fix (`Working Claude` became an empty label). Fixes: #164 ## Result - Track edit intent per field. Untouched account/provider defaults yield to configured values, regardless of creation time or invitation direction. Explicit resets remain edits; legacy snapshots use conservative inference. - Preserve concurrent explicit account, instance and proxy values locally. Settings → Linked computers lists alternatives with **Keep this computer’s** / **Use the other’s**. Either choice publishes a resolution, including transitive observations across computers and restarts. - Keep CLI paths, CLI authentication files and per-worker overrides at their existing home. Shared definitions still include connection kind, arguments, models, environment and own-login choice. Connector/environment records retain their documented merge rules. Secrets remain encrypted at rest and travel only over the pinned mTLS gateway link; notices contain no secret values. - Make Sign in commands target the actual worker executable and effective instance/device login home, including worker overrides and PowerShell quoting. The turn action already selects the correct instance and worker; it opens settings and does not execute login. ## Recovery 1. Update both computers before enabling configuration sharing again; an older gateway still has the old merge behavior. 2. On the affected computer, restore overwritten provider fields from Settings → Linked computers history (90-day retention), especially own-login choice and secrets. Without history, restore the definition and local paths manually in Settings → Providers. 3. Select the instance and worker, refresh account status, run its **Sign in** command on that worker, refresh and retry. Configuration history cannot restore native CLI authentication files or keychain tokens that were already deleted. Migration: **0110_config_field_ancestry**, following the merged DB2 migrations 0103–0109 on `dev` (`a423af85`). Rebased onto that commit: provider recording retains DB2's bounded `saveRecords` batches together with edit intent and per-author ancestry. Configuration store scoping, blob filtering and move redirect batching remain intact. Protobuf additions are additive; generated code is included. Polish merge, ownership and recovery documentation is updated. ## Validation - **67 passing tests after rebase**, with files run separately: 36 original focused integration tests (bootstrap, intent, providers, identity, settings, notices, notice recovery and provider accounts), the complete schema suite (23, including the original migration-idempotence test), online migrations (5) and DB2 record batches (3). This reruns all previous 37 tests. Coverage includes all four creation/invitation combinations, local login fixtures/paths/worker overrides/secrets, explicit resets and conflict choices, three-computer transitive restore, encryption and owner scope. The batch durability test also verifies `edited` and `seen` survive reopening storage. - PostgreSQL migration application and idempotence, including merged migrations 0103–0109 followed by 0110; `bun install`, `bun run typecheck`, `bun run lint`, `bun run format:check`, `bun run gen:check`, web build. - Investigated the repeated recovery-file CI failure: unmodified PR head `4e0ea1ac` failed 5/5 isolated runs at the same post-replay record assertion; current `dev` `a423af85` passed 5/5. The fixture omitted the intentional `edited=true` and `seen=[]` field metadata added during transport. Updated the fixture while retaining exact equality and all rollback/cursor/restart assertions. The corrected recovery file passed 5/5 isolated runs (30 passing tests), with a private TMPDIR throughout. The failure did not indicate a production atomicity defect: merge/history/intent writes and cursor updates remain in the same `sql.withTransaction`. - Full `check:tmp` deliberately left to CI as requested. No UI/E2E tests or live provider login. Browser visual inspection remains unverified. Copy audit (`docs/copy.md` §8): ambiguous Restore/Dismiss for unresolved conflicts → **Use the other’s / Keep this computer’s**, so the effect is explicit. Bare CLI login guidance → the selected worker's scoped command, so it reaches the actual account. Text uses English, sentence case, active actions and the existing instance/worker/computer glossary; secret alternatives remain **A different key**. Layout allows action wrapping and long text, but desktop/phone and light/dark browser inspection has not been performed. No new decorative copy or color-only cues.
This was referenced Nov 13, 2026
nixuuu
added a commit
that referenced
this pull request
Nov 14, 2026
## Problem Settings → Providers → Grok on two linked computers showed **Changed on two computers** with two rows: "Connects with" (Endpoint) and "Proxy" (A different proxy). **Restore** failed with "Computer link operation failed. Check the address, code and Network access settings." The link itself was fine. ## Root cause Not #696. The remote policy and the device-login refusal are not involved: Restore runs locally (`manageConfigNotice`). - Restore wrote `kind` or `proxy` **alone** (one history row per field). For example, the instance ended up `native` while still pointing at the proxy. `applyInstance` stored `proxy_id` on a native instance. `instanceSync` then copied the proxy's base URL and key onto it (`UPDATE provider_instances … FROM proxies`), and Postgres refused the row: `provider_instances_endpoint` (non-endpoint instances must have no base URL and no key). - `computerGuard` turned every error that is not a `ConnectError` (here a `SqlError`) into the pairing message. The field-by-field Restore of instance records comes from #164 (already on stable), so this PR uses `Related:` and not `Fixes:`. Linking #164 would hold everything merged since 2026-11-05. ## Change - **One connection notice.** An instance's `kind`, `proxy`, `baseUrl` and `apiKey` that were lost in the same merge with the same computer are one notice, `field = "connection"`. Its value is a JSON object (the key shows only as "A different key"). Restore, **Use the other’s** and **Keep this computer’s** write those fields together, taking the newest lost version of each. - **Defence in depth.** `applyInstance` sets `proxy_id` only on endpoint instances. A record that combines `native` with a proxy (from Restore or from a field-by-field merge) can no longer break the worker sync. - **Whose value.** New additive field `ConfigNotice.own_value = 11`: the kept value was set on this computer. - **Errors.** `computerGuard(run, failure)`: only pairing and the link service keep "Check the address, code and Network access settings". The other actions name what failed (see the copy audit). - **#696 untouched.** `StartProviderLogin` stays out of `SERVED`/`WORKER_SETTINGS`. - Docs: `docs/linked-computers.md` (notices). ## Verification - New `tests/integration/config-sync-connection.test.ts` (two linked gateways): - A: Grok native → endpoint through a proxy. B: endpoint → back to device login. After linking, B has **one** `connection` notice (`choice`, `own_value=false`). Restore on B: both computers are endpoint through the proxy, both workers get its address and key, and no notices are left on either computer. - A `merged` connection in A's history (as left by an earlier link): one notice (`own_value=true`, "Studio B"). Restore: both converge, no notices are left. **Keep current** (Dismiss) clears it and leaves both on device login. - Before the fix, the same scenario failed on the second Restore with the `provider_instances_endpoint` violation, which the user saw as the generic link message. - The device-login refusal still holds: `config-sync-workers` (a linked computer can't start `StartProviderLogin` through its API or directly over the link), 9/9. - Multi-gateway files run one at a time: `config-sync-connection` 2/2, `-workers` 9/9, `-providers` 7/7, `-intent` 3/3, `-identity` 4/4, `-recovery` 6/6, `-bootstrap` 4/4, `config-sync` 7/7, `-environment` 8/8. - `bun install`, `gen:check`, `typecheck`, `lint`, `format:check`, web build: clean. `check:tmp` (full run) was not run; only the focused files above. - **Not checked in a browser**: the change only replaces text in the existing notice row, which already wraps (`break-words`, `flex-wrap` buttons). Mobile still shows its plain notice list (field name and raw value); the `connection` field shows there as raw JSON, as other fields already do. ## Copy audit (docs/copy.md §8) | Where | Before → after | Why | |---|---|---| | Instance notice title | `Connects with` + `Proxy` (two rows) → `Connects with` (one row) | One thing changed: how the instance connects. "Connection" is a banned synonym for instance, so the title keeps "Connects with". | | Connection value | `Endpoint` / `A different proxy` → `This computer’s value: Endpoint through a different proxy` (also `Device login`, `Endpoint at <url>`, `… with a different key`) | Says what differs and whose value it is; proxies are never shown as ids. | | Merged notice | `Merged with <computer>.` → `Replaced when this computer linked with <computer>.` / `Not used when this computer linked with <computer>.` | Says what happened; active voice; ≤ 10 words. | | Restore button (merged/concurrent) | `Restore` → `Restore this computer’s` / `Use the other’s` | Verb first; says what Restore does; same wording as the existing choice notice. | | Dismiss button (merged/concurrent) | `Dismiss` → `Keep current` | Says the effect instead of hiding a notice. | | Notice action failed | `Computer link operation failed. Check the address, code and Network access settings.` → `Could not apply this value on this computer. Try again, or change it in its settings.` | What happened, then what to do; the link message fits only pairing. | | Other linked-computer actions | same generic link message → `Could not load linked computers. Try again.`, `Could not change this linked computer. Try again.`, `Could not move the threads. Check that the other computer is online, then try again.`, `Could not load moves. Try again.`, `Could not load workers of linked computers. Try again.`, `Could not read thread sync diagnostics. Try again.` | Each names the failed action and ends with an action. | | Settings → Linked computers fallback | `Computer link operation failed` → `Could not update linked computers. Try again.` | Ends with an action. | Glossary: "instance", "proxy", "computer" used as defined; no new terms; no "soul" sentences. Long computer names wrap (`break-words`). Related: #164, #696
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.
Stage 2 of 7 of shared configuration across linked computers. The design is in
docs/linked-computers.md.all_workers, models, keys and secret variables), model preferences, and proxies, including secrets.config_secrets, encrypted with its own key. Restore can bring back a lost secret. Secrets never reach the BFF, logs or the other computer's history, and never cross a link where sharing is off.config_aliases;slug-<computer>;Migration:
0074_config_providers. Proto (additive):ConfigNotice.local_id = 9,item_name = 10.Tests:
config-sync-providers: the rename bug first, edits both ways, re-encryption with the key absent from BFF, logs and history, concurrent edits with Restore of a name and a key, delete and Restore, sharing off, owner scoping;config-sync-identity: alias merge and a routed thread using an aliased id;config-providers: the migration from 0050.Copy audit (
docs/copy.md§8): the share toggles are removed. New text uses sentence case and one idea per sentence, follows the glossary (instance, proxy, computer), and errors say what to do.