feat(bus): a bus started before the model proxy existed picks it up without a restart (#1873) #1996

Merged
jason.woltje merged 2 commits from proxy-pickup into refactor 2026-11-19 16:59:10 +00:00
Owner

What changes

A bus that started before the instance had a model proxy now picks the proxy up without a restart. Before this, the organization's catalogue read "unavailable" and the accounts page refused not-configured until someone restarted the bus.

  • Pickup. At each proxy page request, catalogue read and fence clear, a bus with no boot proxy loads proxy.json, the management key and, on an organization bus, the shared write lock. It uses the start path's loader, checks and lock.
  • Checked again each time. A client got this way, or by this bus's own proxy.init, is checked at every such request. The bus drops it when the start path would now refuse it: settings that do not load, a key that does not load, a lock that does not load, a port that changed, an invalid organization binding, or a dev fixture next to the proxy.
  • One plain cause line. While there is no client, accounts refuse not-configured with one line of static text and a refusal code, and the catalogue reads unavailable with proxy-not-configured and the same line. The Model proxy page and the Routing panel show it. No path and no key value is in it.
  • Init order. proxy.init creates the lock before it installs the client, so a lock that refuses leaves no client behind.
  • A bus that booted with a proxy keeps its boot client, as before.

No bus schema change, no new verb, no new refusal code, no grant or role change. Nothing under roles/, contracts/ or packages/queue/.

How

  • packages/bus/src/runtime.mjs: pickProxy, syncProxy, dropLateProxy, the catalogue wrapper, the init order.
  • packages/bus/src/broker.mjs: passes the one cause line through on not-configured only, never into refusal evidence.
  • packages/webui/src/proxy-http.mjs, public/proxy.js, public/display.js, public/bus.js: carry and show the line.
  • New startBroker option initProxy, an in-process test seam like makeProviderLoader. Boot JSON cannot pass a function and a non-function is refused.

Tests

  • packages/bus/tests/proxy-pickup.test.mjs (new, 22 tests), two buses on one instance. On base code plus only the test seam all 22 fail.
  • Refused settings still refuse: unpinned binary, proxy.json not JSON, key missing, key readable by others, state dir open to others, state naming another port, fixture, invalid binding, lock refusing at init.
  • A key scan over every stderr line, response, refusal, event and file under the second bus's data root and the proxy dir.
  • Mutants: 23 of 23 red.
  • Lane gate on d0293d660: 414 files (bus, model-proxy, webui), 3960 pass, 0 fail, 5 skipped (4 org-quick-live, 1 shots).
  • Lead check in a clean environment: 320 files (the touched tests, every test that imports a touched source file, the refusal and redact set), 3646 pass, 0 fail, 0 skipped.

Review

One fresh claude-opus-5-5 reviewer, given the diff and the brief. Approve, 0 blocking, 7 non-blocking. Three are fixed in the second commit (two cache resets had no test, init installed the client before the lock, the first red was not caused by the defect). Four are the gaps below.

Left for later

  • A launch on a picked-up proxy still needs a bus restart. The picked-up bus serves accounts, the catalogue and fence clear. It has no ModelKeys, no proxy usage, and the host launcher keeps its boot system. The catalogue can read ready while a launch still fails. A follow-up lane takes this.
  • A bus that booted with a proxy keeps its boot client if proxy.json goes away or its port changes. True before this change.
  • A new valid key on the same port: a picked-up bus keeps the old client until restart. Calls fail closed with the proxy's 401 and no cause line.
  • Each such request on a bus with no boot proxy reloads proxy.json and the key, and an organization bus creates the lock. Fine at click rates.
  • The fixture check is a little stricter than the host's.
  • No browser test covers the cause line on the two Model proxy pages.
## What changes A bus that started before the instance had a model proxy now picks the proxy up without a restart. Before this, the organization's catalogue read "unavailable" and the accounts page refused `not-configured` until someone restarted the bus. - **Pickup.** At each proxy page request, catalogue read and fence clear, a bus with no boot proxy loads `proxy.json`, the management key and, on an organization bus, the shared write lock. It uses the start path's loader, checks and lock. - **Checked again each time.** A client got this way, or by this bus's own `proxy.init`, is checked at every such request. The bus drops it when the start path would now refuse it: settings that do not load, a key that does not load, a lock that does not load, a port that changed, an invalid organization binding, or a dev fixture next to the proxy. - **One plain cause line.** While there is no client, accounts refuse `not-configured` with one line of static text and a refusal code, and the catalogue reads unavailable with `proxy-not-configured` and the same line. The Model proxy page and the Routing panel show it. No path and no key value is in it. - **Init order.** `proxy.init` creates the lock before it installs the client, so a lock that refuses leaves no client behind. - A bus that booted with a proxy keeps its boot client, as before. No bus schema change, no new verb, no new refusal code, no grant or role change. Nothing under `roles/`, `contracts/` or `packages/queue/`. ## How - `packages/bus/src/runtime.mjs`: `pickProxy`, `syncProxy`, `dropLateProxy`, the catalogue wrapper, the init order. - `packages/bus/src/broker.mjs`: passes the one cause line through on `not-configured` only, never into refusal evidence. - `packages/webui/src/proxy-http.mjs`, `public/proxy.js`, `public/display.js`, `public/bus.js`: carry and show the line. - New `startBroker` option `initProxy`, an in-process test seam like `makeProviderLoader`. Boot JSON cannot pass a function and a non-function is refused. ## Tests - `packages/bus/tests/proxy-pickup.test.mjs` (new, 22 tests), two buses on one instance. On base code plus only the test seam all 22 fail. - Refused settings still refuse: unpinned binary, `proxy.json` not JSON, key missing, key readable by others, state dir open to others, state naming another port, fixture, invalid binding, lock refusing at init. - A key scan over every stderr line, response, refusal, event and file under the second bus's data root and the proxy dir. - Mutants: 23 of 23 red. - Lane gate on d0293d660: 414 files (bus, model-proxy, webui), 3960 pass, 0 fail, 5 skipped (4 `org-quick-live`, 1 shots). - Lead check in a clean environment: 320 files (the touched tests, every test that imports a touched source file, the refusal and redact set), 3646 pass, 0 fail, 0 skipped. ## Review One fresh claude-opus-5-5 reviewer, given the diff and the brief. Approve, 0 blocking, 7 non-blocking. Three are fixed in the second commit (two cache resets had no test, init installed the client before the lock, the first red was not caused by the defect). Four are the gaps below. ## Left for later - A launch on a picked-up proxy still needs a bus restart. The picked-up bus serves accounts, the catalogue and fence clear. It has no `ModelKeys`, no proxy usage, and the host launcher keeps its boot `system`. The catalogue can read ready while a launch still fails. A follow-up lane takes this. - A bus that booted with a proxy keeps its boot client if `proxy.json` goes away or its port changes. True before this change. - A new valid key on the same port: a picked-up bus keeps the old client until restart. Calls fail closed with the proxy's 401 and no cause line. - Each such request on a bus with no boot proxy reloads `proxy.json` and the key, and an organization bus creates the lock. Fine at click rates. - The fixture check is a little stricter than the host's. - No browser test covers the cause line on the two Model proxy pages.
jason.woltje added 2 commits 2026-11-19 16:59:04 +00:00
A bus started before the instance had a proxy checks once at the next accounts, page, catalogue
or fence request, and loads the client through the start path's checks, loader and lock. A client
got that way, or by the bus's own init, is checked again at each such request and dropped when
proxy.json goes away, no longer loads, moves port, the key stops loading, the lock refuses, or a
dev fixture the host would refuse is in use. While there is no client, the bus names the cause in
one plain line on not-configured and on the unavailable catalogue, and the Console shows it.
jason.woltje merged commit d0293d6602 into refactor 2026-11-19 16:59:10 +00:00
Sign in to join this conversation.