feat(harness): an OAuth Claude model runs on claude-code only, and the Triage host checks every file a harness module wrote (#1873) #2001

Merged
jason.woltje merged 9 commits from harness-matrix into refactor 2026-11-19 20:46:53 +00:00
Owner

What changes

The harness rule (lane harness-matrix): which model may run on which harness, enforced where the route is chosen and again where the run is built.

  • The rule (packages/plugins/model-provider/cliproxy/index.mjs, packages/harness/src/bundle.mjs). The Claude harness runs every model the proxy offers. A Claude model that comes from an OAuth account runs on claude-code only. A Claude model from an API key runs on claude-code and pi. An account whose kind is unknown is treated as OAuth. A legacy model entry carries no account data, so a Claude model there is treated as OAuth too.
  • Triage (packages/webui/src/triage-route.mjs, triage-host.mjs). Triage runs on claude-code or pi through the proxy. The route refuses a model and harness pair the rule does not allow.
  • Triage host checks on what a harness module wrote (triage-host.mjs, packages/seat/src/sandbox.mjs). After bundle() the host reads every file under the run's bundle/, home/, work/ and tmp/. It refuses a file that holds the key, a URL that is not the proxy's, a pi command value (a string that starts with "!"), a file with a second hard link, and a file replaced with a FIFO. The key never rests on disk.

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

Tests

  • New: packages/bus/tests/harness-matrix.test.mjs, packages/harness/tests/claude-proxy-model.test.mjs. Extended: proxy-bundle, proxy-routing, model-provider-catalogue, hosted-binds, triage-host, triage-wiring, launcher, proxy-context-join.
  • Lead check in a clean environment: 87 files, 1274 pass, 0 fail, 1 skip on e91e16d7d. After the rebase onto fbaae25d0 the 14 touched and neighbouring test files plus packages/plugins/tests/harness.test.mjs were run again on 4f6317667: all 15 exit 0.

Review

Six review rounds, each by a fresh claude-opus-5-5 reviewer, ending approve. The branch was then rebased twice, onto 2db4f24fd and onto fbaae25d0. Range-diff shows all nine commits unchanged both times.

## What changes The harness rule (lane harness-matrix): which model may run on which harness, enforced where the route is chosen and again where the run is built. - **The rule** (`packages/plugins/model-provider/cliproxy/index.mjs`, `packages/harness/src/bundle.mjs`). The Claude harness runs every model the proxy offers. A Claude model that comes from an OAuth account runs on claude-code only. A Claude model from an API key runs on claude-code and pi. An account whose kind is unknown is treated as OAuth. A legacy model entry carries no account data, so a Claude model there is treated as OAuth too. - **Triage** (`packages/webui/src/triage-route.mjs`, `triage-host.mjs`). Triage runs on claude-code or pi through the proxy. The route refuses a model and harness pair the rule does not allow. - **Triage host checks on what a harness module wrote** (`triage-host.mjs`, `packages/seat/src/sandbox.mjs`). After `bundle()` the host reads every file under the run's `bundle/`, `home/`, `work/` and `tmp/`. It refuses a file that holds the key, a URL that is not the proxy's, a pi command value (a string that starts with "!"), a file with a second hard link, and a file replaced with a FIFO. The key never rests on disk. No new bus verb, no bus schema change, no grant or role change. Nothing under `roles/`, `contracts/` or `packages/queue/`. ## Tests - New: `packages/bus/tests/harness-matrix.test.mjs`, `packages/harness/tests/claude-proxy-model.test.mjs`. Extended: `proxy-bundle`, `proxy-routing`, `model-provider-catalogue`, `hosted-binds`, `triage-host`, `triage-wiring`, `launcher`, `proxy-context-join`. - Lead check in a clean environment: 87 files, 1274 pass, 0 fail, 1 skip on e91e16d7d. After the rebase onto fbaae25d0 the 14 touched and neighbouring test files plus packages/plugins/tests/harness.test.mjs were run again on 4f6317667: all 15 exit 0. ## Review Six review rounds, each by a fresh claude-opus-5-5 reviewer, ending approve. The branch was then rebased twice, onto 2db4f24fd and onto fbaae25d0. Range-diff shows all nine commits unchanged both times.
jason.woltje added 9 commits 2026-11-19 20:46:47 +00:00
cliproxy holds a model to claude-code when its upstream is claude, when an OAuth Claude account
offers the same name, or when the name contains "claude"; every other proxy model runs on
claude-code and pi. The catalogue, the launch (sessionModel and the models.json list) and the
provider route apply the one rule and refuse with model-harness-incompatible, so a stored
Claude-on-pi route is refused, never rewritten. The other route's pi provider is mosaic-proxy-other.

Triage: the route asks the provider for the transport on the stored harness and holds the
harness's env() to one contract (the key, unchanged, under exactly one of ANTHROPIC_AUTH_TOKEN or
ANTHROPIC_API_KEY; the URL only as ANTHROPIC_BASE_URL), with no list of harness names. The host
gives the module the real proxy and transport, checks each file it writes under the session's HOME
(regular, one link, no key) and binds it read-only after the run directory, and refuses a route env
with no key name or two. PATH starts with node_modules/.bin, as a bus session's does.

Tests: claude-code runs a z.ai and a codex proxy model against a stand-in (real claude binary);
pi answers Triage through a stand-in under bwrap; every new fence has a test.
Jason 2026-11-19: Claude models through an API key may run on any harness; OAuth Claude models only
on claude-code. The name check is gone. The catalogue reads every Claude OAuth account's model names,
whatever the account's state, and holds a group model with one of those names to claude-code, since
the proxy routes by name across every account. route() has no account data, so it holds upstream
claude only; admission and Triage hold the rest through the catalogue.
jason.woltje merged commit 4f63176676 into refactor 2026-11-19 20:46:53 +00:00
Sign in to join this conversation.