Bus cannot boot after a credentialed agent is added when secrets/agents is missing (F3 defect l) #1886

Closed
opened 2026-11-09 22:47:52 +00:00 by jason.woltje · 1 comment
Owner

Found during F3 (#1873; report org-f3-build.md row l and section 8.1). Pre-existing, not an F3 regression.

On an instance with no <configDir>/secrets/agents, adding an agent definition that declares a store credential (for example companion or gitea) leaves the bus unable to boot. The next bus restart fails with broker refused to start: credential-file. packages/bus/src/credentials.mjs #read calls privateDir(this.#storeRoot) without { missing: true }. The store root is created only by issue(), which needs a running bus. Only scripts/case2/launch.mjs creates the root, so dev and org instances do not have it.

This conflicts with runtime.mjs ("issue works after the restart") and design D3a (a store reference with no file yet reads as null). But credential-store.test.mjs T1 deliberately pins "a missing store root refuses start" (row 199, cb5fdb064). Fixing it therefore means choosing a design, not just changing a line:

  1. The bus creates <configDir>/secrets/agents (0700, checked) at boot before Credentials opens, and keeps refusing a root that exists with bad modes or is a symlink. T1 changes from "missing root refuses" to "missing root is created private".
  2. #read treats a missing root as no file yet (null), like the model path at :198. T1 changes the same way.

Recommendation: option 1. It keeps a single place that decides the root's modes, and every later read still sees an existing private root.

Workaround until fixed: do not press Restart bus after adding a credentialed agent on a dev or org instance. The uiorg test guide says so.

Found during F3 (#1873; report org-f3-build.md row l and section 8.1). Pre-existing, not an F3 regression. On an instance with no `<configDir>/secrets/agents`, adding an agent definition that declares a store credential (for example `companion` or gitea) leaves the bus unable to boot. The next bus restart fails with `broker refused to start: credential-file`. `packages/bus/src/credentials.mjs` `#read` calls `privateDir(this.#storeRoot)` without `{ missing: true }`. The store root is created only by `issue()`, which needs a running bus. Only `scripts/case2/launch.mjs` creates the root, so dev and org instances do not have it. This conflicts with `runtime.mjs` ("issue works after the restart") and design D3a (a store reference with no file yet reads as null). But `credential-store.test.mjs` T1 deliberately pins "a missing store root refuses start" (row 199, cb5fdb064). Fixing it therefore means choosing a design, not just changing a line: 1. The bus creates `<configDir>/secrets/agents` (0700, checked) at boot before Credentials opens, and keeps refusing a root that exists with bad modes or is a symlink. T1 changes from "missing root refuses" to "missing root is created private". 2. `#read` treats a missing root as no file yet (null), like the model path at `:198`. T1 changes the same way. Recommendation: option 1. It keeps a single place that decides the root's modes, and every later read still sees an existing private root. Workaround until fixed: do not press Restart bus after adding a credentialed agent on a dev or org instance. The uiorg test guide says so.
Author
Owner

Fixed by PR #1888, merged as 7a97cfc4f. Bus start now creates the private store root when a reference names the store. A root with loose modes or that is a symlink still refuses start.

Fixed by PR #1888, merged as 7a97cfc4f. Bus start now creates the private store root when a reference names the store. A root with loose modes or that is a symlink still refuses start.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: mosaicstack/stack#1886