Read hosts.toml once per repo-scoped command (CLS-1264) #324

Merged
stephen merged 1 commit from cls-1264-snapshot into main 2026-11-12 10:49:53 +00:00
Owner

CLS-1264, broad half, part 1 of 2 (part 2 is the inbox mute scope).

A repo-scoped command read hosts.toml five times: the default host, routing the clone's host, the client, and the browser base each loaded it again. An auth switch or instances use from another terminal between two of those reads could validate the clone under account A, send the request as B, and build the browser URL for C.

  • resolve_with(&Hosts, ..) and Client::connect_with(&Hosts, ..) take a configuration the caller already loaded. resolve and connect are now load-once wrappers over them, so the other ~28 Client::connect callers are unchanged (they read once and have no second reader).
  • A Client keeps the host configuration it connected with and exposes it as client.config().
  • resolve_repo loads Hosts once and uses that value for the explicit-host lookup, discovery, default host, routing, the client and the browser base (taken from client.config()).
  • repo clone, repo create --clone and repo fork --clone take the git protocol from the client's configuration. fork previously read the default host's protocol even when the repo was on a routed host.

No global cache: a process-wide snapshot would hide a token another process just refreshed from the refresh hook.

Tests: resolve_with returns the snapshot's account and protocol after the files on disk are switched, while a fresh resolve sees the switch; a connected client keeps its account, protocol and browser base after the switch; the clone-URL helper follows the connected host's protocol. The account override, profile consumer, work session and legacy host suites pass unchanged.

Limit, as before: a switch before the single read is an ordinary selection. A switch after it is not seen by that command, which finishes with one consistent identity.

CLS-1264, broad half, part 1 of 2 (part 2 is the inbox mute scope). A repo-scoped command read `hosts.toml` five times: the default host, routing the clone's host, the client, and the browser base each loaded it again. An `auth switch` or `instances use` from another terminal between two of those reads could validate the clone under account A, send the request as B, and build the browser URL for C. - `resolve_with(&Hosts, ..)` and `Client::connect_with(&Hosts, ..)` take a configuration the caller already loaded. `resolve` and `connect` are now load-once wrappers over them, so the other ~28 `Client::connect` callers are unchanged (they read once and have no second reader). - A `Client` keeps the host configuration it connected with and exposes it as `client.config()`. - `resolve_repo` loads `Hosts` once and uses that value for the explicit-host lookup, discovery, default host, routing, the client and the browser base (taken from `client.config()`). - `repo clone`, `repo create --clone` and `repo fork --clone` take the git protocol from the client's configuration. `fork` previously read the default host's protocol even when the repo was on a routed host. No global cache: a process-wide snapshot would hide a token another process just refreshed from the refresh hook. Tests: `resolve_with` returns the snapshot's account and protocol after the files on disk are switched, while a fresh `resolve` sees the switch; a connected client keeps its account, protocol and browser base after the switch; the clone-URL helper follows the connected host's protocol. The account override, profile consumer, work session and legacy host suites pass unchanged. Limit, as before: a switch before the single read is an ordinary selection. A switch after it is not seen by that command, which finishes with one consistent identity.
Read hosts.toml once per repo-scoped command (CLS-1264)
All checks were successful
ci / check (pull_request) Successful in 17m14s
ci / live-e2e (pull_request) Successful in 4m54s
ci / coverage (pull_request) Successful in 5m46s
eb5283431a
gerri approved these changes 2026-11-12 10:25:33 +00:00
gerri left a comment

Automated Codex review (read-only) of head eb5283431a.

No actionable findings in the diff against the standards and surrounding code. Routing, client construction, browser URLs, and clone protocol selection consistently use the loaded configuration.

Review was read-only; tests were not run.

BLOCKING: 0

Reviewed head eb5283431a at 2026-11-12T10:25:32Z by codex exec (read-only sandbox).

Automated Codex review (read-only) of head eb5283431a56b82297d958e4d193d6a15cdfb10d. No actionable findings in the diff against the standards and surrounding code. Routing, client construction, browser URLs, and clone protocol selection consistently use the loaded configuration. Review was read-only; tests were not run. BLOCKING: 0 --- Reviewed head eb5283431a56b82297d958e4d193d6a15cdfb10d at 2026-11-12T10:25:32Z by codex exec (read-only sandbox).
Sign in to join this conversation.
No description provided.