feat(webui,cli): triage route store, an owner-only route.json and mosaic triage route show|set (#1873) #1989

Merged
jason.woltje merged 2 commits from triage-route-store into refactor 2026-11-18 18:07:37 +00:00
Owner

What changes

Triage gets a place to keep its model route and daily token cap. Nothing reads it yet: the Console still passes route: null, so Triage still does not start.

  • Store. <dataRoot>/triage/route.json holds a harness name, a model key and a daily token cap with its reset time and IANA time zone. The zone is required and has no default. The file holds no env value, no key and no token count. The directory is 0700 and the file 0600; a wrong mode or owner, a link or a non-file refuses.
  • Writes. A write takes a lock file, compares revision, writes a temp file, renames it and appends one line to route-receipts.jsonl. A changed cap keeps its since.
  • CLI. mosaic triage route show prints the stored route or "not set". mosaic triage route set --model KEY --harness NAME --cap TOKENS --time-zone ZONE [--revision N] writes it. Both refuse an agent run.

Jason approved the store, the verb and the reset rule on 2026-11-18 ("route as recommended").

How

  • packages/webui/src/triage-route-store.mjs, packages/cli/src/triage.mjs, four dispatch lines in packages/cli/src/cli.mjs, one case in scripts/mosaic, packages/cli/README.md.
  • No bus schema, vocabulary, policy or HTTP route change.

Tests

  • triage-route-store.test.mjs and triage-route.test.mjs. Mutants: 57 of 59 red.
  • Lane gate before the last rebase: 129 files, 1706 pass, 0 fail, 1 skipped (federation-acceptance).
  • Lead check in a clean environment: on d23b573a5, the same two patches on the previous base, 6 triage test files and every packages/cli test file: 1709 tests, 1708 pass, 0 fail, 1 skipped (federation-acceptance). After the rebase onto 2d44750b9 (range-diff equal), on c9fad00d2, the triage and CLI dispatch test files: 124 pass, 0 fail.

Review

One fresh claude-opus-5-5 reviewer: changes, one P2 (the owner check had no test) and five P3s. The P2 and four P3s are fixed in the second commit. No reviewer read that commit.

Left for later

  • The model key is checked for shape only. The check against the model catalogue comes with the wiring.
  • The key verb, the count and cap, the wiring and the Settings panel are separate changes.
## What changes Triage gets a place to keep its model route and daily token cap. Nothing reads it yet: the Console still passes `route: null`, so Triage still does not start. - **Store.** `<dataRoot>/triage/route.json` holds a harness name, a model key and a daily token cap with its reset time and IANA time zone. The zone is required and has no default. The file holds no env value, no key and no token count. The directory is 0700 and the file 0600; a wrong mode or owner, a link or a non-file refuses. - **Writes.** A write takes a lock file, compares `revision`, writes a temp file, renames it and appends one line to `route-receipts.jsonl`. A changed cap keeps its `since`. - **CLI.** `mosaic triage route show` prints the stored route or "not set". `mosaic triage route set --model KEY --harness NAME --cap TOKENS --time-zone ZONE [--revision N]` writes it. Both refuse an agent run. Jason approved the store, the verb and the reset rule on 2026-11-18 ("route as recommended"). ## How - `packages/webui/src/triage-route-store.mjs`, `packages/cli/src/triage.mjs`, four dispatch lines in `packages/cli/src/cli.mjs`, one case in `scripts/mosaic`, `packages/cli/README.md`. - No bus schema, vocabulary, policy or HTTP route change. ## Tests - `triage-route-store.test.mjs` and `triage-route.test.mjs`. Mutants: 57 of 59 red. - Lane gate before the last rebase: 129 files, 1706 pass, 0 fail, 1 skipped (`federation-acceptance`). - Lead check in a clean environment: on d23b573a5, the same two patches on the previous base, 6 triage test files and every packages/cli test file: 1709 tests, 1708 pass, 0 fail, 1 skipped (federation-acceptance). After the rebase onto 2d44750b9 (range-diff equal), on c9fad00d2, the triage and CLI dispatch test files: 124 pass, 0 fail. ## Review One fresh claude-opus-5-5 reviewer: changes, one P2 (the owner check had no test) and five P3s. The P2 and four P3s are fixed in the second commit. No reviewer read that commit. ## Left for later - The model key is checked for shape only. The check against the model catalogue comes with the wiring. - The key verb, the count and cap, the wiring and the Settings panel are separate changes.
jason.woltje added 2 commits 2026-11-18 18:07:08 +00:00
<dataRoot>/triage/route.json holds Triage's model route and daily cap as names only:
a catalogue model key, a harness name and a daily-quota cap leaf, with no env value
and no key. The directory is 0700 and the file 0600, owned by the running user; a
link, a hard link, a non-file, a wrong mode or owner, an unknown field or an unknown
time zone refuses. A write is compare-and-set on revision under an exclusive lock,
atomic (temp file, fsync, rename, directory fsync), and appends one receipt line.
The reset is 00:00 in a zone the owner gives, with no default. The file location,
field names and reset rule each live in one place.

mosaic triage route show|set are human verbs and refuse an agent run before any read.
Nothing is wired into the Triage host: the Console keeps route: null. Held for
Jason's ruling on the design's four questions (#1873, lane triage-route-store).
The file owner check has its own test through a file-owner seam, for
route.json on read and write and for route-receipts.jsonl on write. The
directory, temp file and a new receipts file get their modes on the open
descriptor, so a narrow umask cannot leave a route the next read refuses;
an existing receipts file is never repaired. A failed temp write refuses
and removes the temp file. A failure after the rename refuses as
triage-route-unrecorded and names the new revision. The input zone check
uses the stored cap's rule, so +05:00 refuses as an unknown zone. A
changed cap keeps its since, as an organization's token limits do, so
lowering the cap never drops tokens already counted (#1873, lane
triage-route-store).
jason.woltje merged commit c9fad00d25 into refactor 2026-11-18 18:07:37 +00:00
Sign in to join this conversation.