feat(conversation, discord): the conversation engine takes pi from the harness lookup and the fit check, with no pin (#1873) #2015

Merged
jason.woltje merged 8 commits from pi-unpin-s4 into refactor 2026-11-20 13:16:03 +00:00
Owner

What changes

Lane pi-unpin-s4, slice S4 of the pi unpin design: the conversation engine stops pinning pi.

  • The pi comes from the harness lookup. The conversation controller takes a pi option that defaults to locate(process.env) from packages/plugins/harness/pi/binary.mjs: MOSAIC_PI_BIN, then pi on PATH, then the repository's pi.
  • The fit check replaces the pins. piFit and its digest stand where the npm version and integrity stood. A claim records the pi's version and the fit digest.
  • One refusal code, already approved. engine-feature-missing refuses a pi whose help lacks --mode rpc, or whose first line the kernel and node would read differently from the fit check. Jason approved the code on 2026-11-19.
  • The launch and the check run the same program. The controller keeps a frozen copy of the lookup's answer, runs the lookup again on its bin, and refuses unsealed-engine unless root, dest, view and pkg match. Under #!/usr/bin/env node it walks PATH as the fit check's sandbox sees it and refuses when the first node there is not the engine's own. A node under /tmp counts as hidden, because the sandbox's /tmp starts empty.
  • Old claims refuse. A claim made under the old pin record refuses engine-pin-mismatch with a line that names the old record, at every start of that session.
  • Discord. The Discord CLI finds pi through the same lookup. A bad MOSAIC_PI_BIN refuses with the lookup's line and no path.
  • pi-pin.mjs is renamed pi-seal.mjs. The launch passes --no-mcp when the pi's help lists it.

No new verb, grant, role, schema or config format.

Tests

  • New and changed tests in packages/conversation/tests (claim S4a to S4h, turns N24c, cohort, smoke), packages/discord/tests/offline-check.test.mjs and packages/cli/tests/stack-copy.test.mjs. The S4 tests fail on the base source.
  • Lane gate on 4a3f501e1: 84 files, 1129 pass, 2 fail. The 2 are flows.test.mjs and reader.test.mjs, red the same way on the base because the host has no python jsonschema.
  • Lead check in a clean environment on 4a3f501e1: 431 files, 5163 pass, 2 fail, 37 skipped. The 2 are flows.test.mjs and reader.test.mjs, the same jsonschema reds as on the base.

Review

A fresh claude-opus-5-5 reviewer, then six re-checks by fresh reviewers. Each round's findings were fixed in its own commit. Re-check 7 approved with no new findings.

Left for later

  • The engine-node-under-/tmp rule has no test of its own. A test needs a node under the real /tmp, which the test rules forbid. Re-check 7 checked it by simulation.
  • The Discord CLI uses the lookup but does not run the fit check yet. discord-service.sh and test-discord.sh still require the copy's .bin/pi.
  • No second check runs between the fit check and the launch. That gap predates this change.
  • The fit cache key does not include the PATH value, and files outside the fit digest can change unseen. Both live in pi-fit.mjs.
  • With TMPDIR unset or under /tmp, pi-fit's own /tmp mount hides a package root there. The start refuses, which is safe.
  • A node install reached through links outside the shown directories (nvm style) is refused.
  • The Controller has no production call site yet.
## What changes Lane pi-unpin-s4, slice S4 of the pi unpin design: the conversation engine stops pinning pi. - **The pi comes from the harness lookup.** The conversation controller takes a `pi` option that defaults to `locate(process.env)` from `packages/plugins/harness/pi/binary.mjs`: `MOSAIC_PI_BIN`, then pi on PATH, then the repository's pi. - **The fit check replaces the pins.** `piFit` and its digest stand where the npm version and integrity stood. A claim records the pi's version and the fit digest. - **One refusal code, already approved.** `engine-feature-missing` refuses a pi whose help lacks `--mode rpc`, or whose first line the kernel and node would read differently from the fit check. Jason approved the code on 2026-11-19. - **The launch and the check run the same program.** The controller keeps a frozen copy of the lookup's answer, runs the lookup again on its bin, and refuses `unsealed-engine` unless root, dest, view and pkg match. Under `#!/usr/bin/env node` it walks PATH as the fit check's sandbox sees it and refuses when the first node there is not the engine's own. A node under `/tmp` counts as hidden, because the sandbox's `/tmp` starts empty. - **Old claims refuse.** A claim made under the old pin record refuses `engine-pin-mismatch` with a line that names the old record, at every start of that session. - **Discord.** The Discord CLI finds pi through the same lookup. A bad `MOSAIC_PI_BIN` refuses with the lookup's line and no path. - `pi-pin.mjs` is renamed `pi-seal.mjs`. The launch passes `--no-mcp` when the pi's help lists it. No new verb, grant, role, schema or config format. ## Tests - New and changed tests in `packages/conversation/tests` (claim S4a to S4h, turns N24c, cohort, smoke), `packages/discord/tests/offline-check.test.mjs` and `packages/cli/tests/stack-copy.test.mjs`. The S4 tests fail on the base source. - Lane gate on 4a3f501e1: 84 files, 1129 pass, 2 fail. The 2 are `flows.test.mjs` and `reader.test.mjs`, red the same way on the base because the host has no python `jsonschema`. - Lead check in a clean environment on 4a3f501e1: 431 files, 5163 pass, 2 fail, 37 skipped. The 2 are flows.test.mjs and reader.test.mjs, the same jsonschema reds as on the base. ## Review A fresh claude-opus-5-5 reviewer, then six re-checks by fresh reviewers. Each round's findings were fixed in its own commit. Re-check 7 approved with no new findings. ## Left for later - The engine-node-under-`/tmp` rule has no test of its own. A test needs a node under the real `/tmp`, which the test rules forbid. Re-check 7 checked it by simulation. - The Discord CLI uses the lookup but does not run the fit check yet. `discord-service.sh` and `test-discord.sh` still require the copy's `.bin/pi`. - No second check runs between the fit check and the launch. That gap predates this change. - The fit cache key does not include the PATH value, and files outside the fit digest can change unseen. Both live in `pi-fit.mjs`. - With TMPDIR unset or under `/tmp`, pi-fit's own `/tmp` mount hides a package root there. The start refuses, which is safe. - A node install reached through links outside the shown directories (nvm style) is refused. - The Controller has no production call site yet.
jason.woltje added 8 commits 2026-11-20 13:16:00 +00:00
jason.woltje merged commit 4a3f501e13 into refactor 2026-11-20 13:16:03 +00:00
Sign in to join this conversation.