The Triage host got route: null. It now gets a route read fresh at each
admit from the route store, the key file, each active organization's
model catalogue (held to checkRoutes) and the harness module. The spawn
env adds only ANTHROPIC_BASE_URL (the instance proxy) and
ANTHROPIC_AUTH_TOKEN (the Triage key); the host sets every MOSAIC_ name.
The key file reader moves to packages/cli/src/triage-key-file.mjs so the
Console reads the key with the key verbs' checks without loading the
proxy management client; triage-key.mjs re-exports it. Each refusal (no
route, no key, unsafe key, proxy down, model not offered, no catalogue,
harness incompatible) launches nothing and answers 409 with one plain
line. Every admit runs the host's fences on the answer, a session
running or not.
The cap fails closed: two turns in a row with unknown usage end the
session with a host line; the next message starts a new run with a
fresh session directory, and its usage counts again.
#1873, lane triage-wiring
GET and POST /api/triage/route, owner only behind the proxy-admin gate, with one
Origin and Sec-Fetch-Site same-origin on a write and Fetch Metadata on a read.
GET returns the stored route or says it is not set, plus the merged catalogue
choices (model keys, availability, compatible installed harnesses) with no
provider, upstream, module, key or path. POST takes model, harness, cap, time
zone and revision, checks the route with checkRoutes against the merged
catalogue (offered, available, compatible, installed), requires a known time
zone with no default, and writes through the store's writeRoute, so the lock,
the revision compare and the receipt are the store's. A stale revision answers
409 with the stored revision. updatedBy is the signed-in owner.
The Settings > Triage page shows only to the owner /api/config marks proxyAdmin.
Model and harness selects (the harness list is the chosen model's), a cap in
tokens, reset 00:00 read only, a time zone, Save. Not set before a first save;
a refusal is one line and keeps the fields; a stale save offers Reload route; a
second Save while one runs does nothing; one line says saving does not start
Triage. cli.mjs keeps route: null for the Triage host.
Each turn's usage goes to <dataRoot>/triage/usage.jsonl, one line per
usage.end, 0600 and owned by the running user; a link, wrong mode or
owner, or a non-file refuses. The host holds the stored cap through
daily-quota mayLaunch and report before each start and each queued
message, lets a crossing turn finish, drains the queue with a host
line, sums the file again after a restart (a torn line counts as an
unknown turn), and GET /api/triage adds usageToday, cap and resetsAt.
With no route stored the fields say "not set". cli.mjs keeps route
null. (#1873, lane triage-cap)
- The grace is the earliest retire time, not a timer: rotate, status and the
README say the old key stays live until retire runs after it.
- A temp file left by a kill before the rename is removed under the lock by
the next issue, rotate or retire; status counts it.
- The receipts file is checked under the lock before any change
(triage-key-receipts-unsafe); a receipt that fails after the change is
triage-key-unrecorded.
- A failed directory sync after the rename is triage-key-unsynced, after the
receipt is written, not triage-key-unwritten.
- proxy-lock-busy points at mosaic proxy fence status.
- Tests: a sentinel lost on the read-back, FIFO key and receipts files, a stale
lock reaped, a crash before the rename, the receipts checks, the sync
failure; the no-op assertion is gone. (#1873)
issue adds one mst-<tag>-triage- key under the instance proxy lock (read,
sentinel, re-read, fence, PUT, read back, confirm) and writes it to
<configDir>/secrets/triage/model (directory 0700, file 0600, the running
user's; a link, a non-file, a second link, a wrong mode or owner refuses).
rotate adds a new key and keeps the old one until now plus the bus's
rotateGraceMinutes from proxy.json; retire removes retiring keys once due.
status reads the file and the list, takes no lock and writes nothing.
Outputs, errors and receipts carry key ids only. A crash at each step
leaves a state status names and the next verb clears. Org and no-org bus
reconciles leave the key alone. Nothing wires the key into the host (#1873)
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).
<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 workflows read listed the triage template, which only the client hid.
The read handler now drops every template the organization vocabulary marks
system-only, and the Console's read supplier in cli.mjs drops them too. The
client filter stays. (#1873, lane triage-followups)
The test helper opens the drawer after the page's first render has focused its heading, as a person
would. A drawer opened before that loses focus to the heading (bus.js); that is left as a follow-up.
The drawer reads GET /api/triage only while open. A poll keeps the draft and the reader's scroll place.
Every field is set as text. Cards show the command with no Run button, and the dropped count.
The send box shows only when config triageSend and the read's send are both true. It names each
answer in plain words, never resends, and keeps the draft after a refusal.
Workflows: Save with only the state changed in an add form says the step is not added yet and keeps
the form. The step picker no longer offers the system-only triage template.
P1-1: the organizations branch lets the instance owner's own session through to the two Triage paths;
everyone else still gets this Console's unknown /api/ answer.
P1-2: each start clears turns/, so the runner's numbered turn files do not collide on restart.
P2-1: on exit, a message the session took and never marked read leaves the queue with a host line.
P2-2: member, signed-out, organizations-Console and org-selected route tests.
P3-1: bus-start cards carry --dev-local-owner on a dev local owner Console.
P3-2: a failed start writes a host line; the queue index is guarded.
P3-3: one shared refresh, a unique temp name per write, four organizations read at a time.
P3-4: the restart path waits for stop() inside its two-second exit.
P3-5: ANTHROPIC_API_KEY no longer passes from the route.
The Console holds <dataRoot>/triage/ (0700): health/ mounted read-only at
work/health inside the session, agent/ the session's own run directory, and
host/ with the 0600 transcript and the runner's log, never mounted. The seat
package's new hostedBinds and hostedArgv give the session the system part,
the runner's files, the adapter and those two directories, and nothing else
of the data root: no org root, bus socket, config or secrets, and no git
identity. Each source inside agent/ is made fresh at start (rm never follows
a link), and hostedBinds refuses a link in place of any of them.
The spawn environment is PATH (fixed), LANG, LC_ALL, TZ, TERM and the
route's ANTHROPIC_BASE_URL, ANTHROPIC_AUTH_TOKEN or ANTHROPIC_API_KEY; bwrap
sets HOME and TMPDIR. A route answer whose harnessEnv names MOSAIC_CONFIG,
a MOSAIC_BUS_ variable or a founder credential variable is refused.
The relay is the only broker the runner reaches. It answers the runner's
lifecycle verbs with fixed answers, hands over the owner's messages, and keeps
a message.send only when it is addressed to "human": its text goes to the
transcript with its cards checked. Every other verb, a send to anyone else
and a call without the capability are refused with triage-refused.
The model route is injected; without one nothing launches (triage-no-route),
and a route over its cap refuses with triage-over-cap and its until. The
tests run the session end to end under bwrap with a stub adapter.
The snapshot is one 0600 JSON file with a fixed field list: the Console's
answer, the model proxy unit, the system config check, and each active org's
bus state, last start, processing and org config check. States, times, counts
and codes only; a read that fails or hangs says "not read". The system config
check runs scripts/mosaic-config.mjs validate in a child with stdout ignored and
keeps the exit code and one fixed refusal code; the org config check keeps its
exit code only. Cards are { step, org } with a known step and a registered org;
the server renders the command and drops anything else.
One list, SYSTEM_ONLY in vocabulary.mjs, names triage; every path by which an
organization could gain one refuses with the one code template-system-only:
hire prepare at org, project and root level and a change onto it (hire.raise,
hire.start.console, decision.raise naming role.hire or role.change); the hire
and definitions template lists omit it; definition import; a definition copied
from it; organization roles, root agents and project agents; a pack record
pinning it; a starter pack defining it, so pack preview and apply refuse an
installed pack that names it; instances.set add and change for the human and
the tester, and the instances add list omits it. The broker passes the code
through and the webui tables map it. The template itself still loads and
validates. Red-first tests in organization and bus system-only.test.mjs; the
channel-proof hash of webui bus.mjs and the broker import pin are updated.