feat(cli, plugins, harness): the bus host runs the harness watch on a timer, keeps its results, and claude-code refuses a binary that lacks an adapter flag (#1873)
#2016
Lane harness-watch-w2, slice W2 of the harness watch design: the bus host runs the watch on a timer and keeps its results. This is the periodic check that replaces version pins.
The timer. New packages/cli/src/harness-watch-host.mjs, started from startHost in packages/cli/src/host.mjs with the env sessions launch from. One full pass at host start. Every 5 minutes a stat pass, a full pass when a binary's stat key changes, and a full pass once a day. It skips while processing is halted or invalid and runs once on resume. Passes never overlap, a pass that throws keeps the timer, and closing the host stops the timer and any check it started. A host started with --no-launch runs no watch.
State.<org dataRoot>/state/harness-watch.json holds the current record per harness, written to a temp file and renamed. harness-watch.jsonl gains one line per transition and is never rewritten. Host paths and env values are redacted, and a backstop test checks both files.
The claude-code fit rule. Every flag the claude adapter passes must have its own option line in --help, and --version must answer. The flag list comes from the adapter's argument builder. A flag that only a description mentions does not count. A miss is a definite fail with the flag as the rule id.
Preflight. claude-code preflight reads the same verdict from a cache keyed by the stat key and refuses harness-feature-missing on a definite fail. The code was approved on 2026-11-19.
No network. The claude --version and --help captures run under unshare -r -n where the host allows it, each in its own process group.
pi-fit. A failed check now carries digest and undecided. pi's inspect reads undecided and no longer matches message text. Fields were added, none renamed.
No new verb, refusal code, grant, role, schema or config format. The timer makes no model call and no network call.
Tests
New packages/cli/tests/harness-watch-host.test.mjs (14) and packages/plugins/tests/harness-watch-w2.test.mjs (18), with changes to harness-watch.test.mjs, pi-fit.test.mjs and pi-binary.test.mjs.
Lane gate on 556f57eeb: 198 files, 2653 pass, 1 fail. The 1 was pi-fit's "S3 re-check 9", a timing test this lane does not change. It passed 10 of 10 alone and the file passed 60/0 twice afterwards.
Lead check in a clean environment on the rebased tip 0f0730160: 503 files, 5775 pass, 0 fail, 7 skipped.
Review
Three rounds by fresh claude-opus-5-5 reviewers. Round one asked for 6 changes, all fixed. Rounds two and three approved. Round three left 4 minor findings, one fixed and three listed below.
Left for later
On a cache miss preflight asks the watch for a pass but does not wait. A launch that arrives before the first pass ends is not checked, as before this change.
An undecided claude check does not make preflight refuse in this slice.
The watch loads harness plugins from the org data root. The launcher loads them from the instance root. A harness installed at the instance level would launch but not be watched. The two shipped harnesses are watched.
With MOSAIC_CLAUDE_BIN unset and a relative PATH entry first, preflight and the watch can pick different claude binaries.
No test covers bus start starting the watch.
No surfaces directory, Settings line, inbox notice or stop of running sessions. Those are slices W3 to W7.
## What changes
Lane harness-watch-w2, slice W2 of the harness watch design: the bus host runs the watch on a timer and keeps its results. This is the periodic check that replaces version pins.
- **The timer.** New `packages/cli/src/harness-watch-host.mjs`, started from `startHost` in `packages/cli/src/host.mjs` with the env sessions launch from. One full pass at host start. Every 5 minutes a stat pass, a full pass when a binary's stat key changes, and a full pass once a day. It skips while processing is halted or invalid and runs once on resume. Passes never overlap, a pass that throws keeps the timer, and closing the host stops the timer and any check it started. A host started with `--no-launch` runs no watch.
- **State.** `<org dataRoot>/state/harness-watch.json` holds the current record per harness, written to a temp file and renamed. `harness-watch.jsonl` gains one line per transition and is never rewritten. Host paths and env values are redacted, and a backstop test checks both files.
- **The claude-code fit rule.** Every flag the claude adapter passes must have its own option line in `--help`, and `--version` must answer. The flag list comes from the adapter's argument builder. A flag that only a description mentions does not count. A miss is a definite fail with the flag as the rule id.
- **Preflight.** claude-code `preflight` reads the same verdict from a cache keyed by the stat key and refuses `harness-feature-missing` on a definite fail. The code was approved on 2026-11-19.
- **No network.** The claude `--version` and `--help` captures run under `unshare -r -n` where the host allows it, each in its own process group.
- **pi-fit.** A failed check now carries `digest` and `undecided`. pi's `inspect` reads `undecided` and no longer matches message text. Fields were added, none renamed.
No new verb, refusal code, grant, role, schema or config format. The timer makes no model call and no network call.
## Tests
- New `packages/cli/tests/harness-watch-host.test.mjs` (14) and `packages/plugins/tests/harness-watch-w2.test.mjs` (18), with changes to `harness-watch.test.mjs`, `pi-fit.test.mjs` and `pi-binary.test.mjs`.
- Lane gate on 556f57eeb: 198 files, 2653 pass, 1 fail. The 1 was pi-fit's "S3 re-check 9", a timing test this lane does not change. It passed 10 of 10 alone and the file passed 60/0 twice afterwards.
- Lead check in a clean environment on the rebased tip 0f0730160: 503 files, 5775 pass, 0 fail, 7 skipped.
## Review
Three rounds by fresh claude-opus-5-5 reviewers. Round one asked for 6 changes, all fixed. Rounds two and three approved. Round three left 4 minor findings, one fixed and three listed below.
## Left for later
- On a cache miss preflight asks the watch for a pass but does not wait. A launch that arrives before the first pass ends is not checked, as before this change.
- An undecided claude check does not make preflight refuse in this slice.
- The watch loads harness plugins from the org data root. The launcher loads them from the instance root. A harness installed at the instance level would launch but not be watched. The two shipped harnesses are watched.
- With `MOSAIC_CLAUDE_BIN` unset and a relative PATH entry first, preflight and the watch can pick different claude binaries.
- No test covers `bus start` starting the watch.
- No surfaces directory, Settings line, inbox notice or stop of running sessions. Those are slices W3 to W7.
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
What changes
Lane harness-watch-w2, slice W2 of the harness watch design: the bus host runs the watch on a timer and keeps its results. This is the periodic check that replaces version pins.
packages/cli/src/harness-watch-host.mjs, started fromstartHostinpackages/cli/src/host.mjswith the env sessions launch from. One full pass at host start. Every 5 minutes a stat pass, a full pass when a binary's stat key changes, and a full pass once a day. It skips while processing is halted or invalid and runs once on resume. Passes never overlap, a pass that throws keeps the timer, and closing the host stops the timer and any check it started. A host started with--no-launchruns no watch.<org dataRoot>/state/harness-watch.jsonholds the current record per harness, written to a temp file and renamed.harness-watch.jsonlgains one line per transition and is never rewritten. Host paths and env values are redacted, and a backstop test checks both files.--help, and--versionmust answer. The flag list comes from the adapter's argument builder. A flag that only a description mentions does not count. A miss is a definite fail with the flag as the rule id.preflightreads the same verdict from a cache keyed by the stat key and refusesharness-feature-missingon a definite fail. The code was approved on 2026-11-19.--versionand--helpcaptures run underunshare -r -nwhere the host allows it, each in its own process group.digestandundecided. pi'sinspectreadsundecidedand no longer matches message text. Fields were added, none renamed.No new verb, refusal code, grant, role, schema or config format. The timer makes no model call and no network call.
Tests
packages/cli/tests/harness-watch-host.test.mjs(14) andpackages/plugins/tests/harness-watch-w2.test.mjs(18), with changes toharness-watch.test.mjs,pi-fit.test.mjsandpi-binary.test.mjs.0f0730160: 503 files, 5775 pass, 0 fail, 7 skipped.Review
Three rounds by fresh claude-opus-5-5 reviewers. Round one asked for 6 changes, all fixed. Rounds two and three approved. Round three left 4 minor findings, one fixed and three listed below.
Left for later
MOSAIC_CLAUDE_BINunset and a relative PATH entry first, preflight and the watch can pick different claude binaries.bus startstarting the watch.