Skip to content

fix(core): Core-host Pi gets its models.json; failed harness turns keep their stderr tail - #2378

Open
Th0rgal wants to merge 3 commits into
masterfrom
claude/core-host-pi
Open

Th0rgal wants to merge 3 commits into
masterfrom
claude/core-host-pi

Conversation

@Th0rgal

@Th0rgal Th0rgal commented Nov 30, 2026

Copy link
Copy Markdown
Owner

What and why

Found by the first full deploy canary run (pi@core FAIL, see #2377).

1. Pi on the Core host could not start.

  • Core staged a per-mission PI_CODING_AGENT_DIR with models.json only for node turns, so a Core-host Pi turn knew no orb/… model.
  • Reproduced on agent-core with the argv Core builds: pi --mode json -p --model orb/orbfault/fault-ok … → Error: Model "orb/orbfault/fault-ok" not found, exit 1.
  • The renderer moves from RemoteDispatch into the shared OrbBin.HarnessProxy as piModelsJson (moved, not copied).
  • harnessProxySetupWithHome now gives a routed Pi <state>/pi-home/<mission> (mode 0700) containing that models.json, and sets PI_CODING_AGENT_DIR. Core-host turns and orb-locald "Core accounts" turns get it from there; node turns keep their prelude but render the same file. Missions on Core accounts through orb-locald had the same gap and are fixed by the same change.
  • RemoteDispatch.piCatalogFor builds the owner's routable catalog for both Core paths.
  • No secret is written: the key stays in SANDBOXED_PROXY_API_KEY.

2. A failed harness turn said only "exited with code 1".

  • Both one-shot spawn paths (spooled and direct) now keep stderr in a private file: next to the <id>.jsonl spool, or a mkstemp file.
  • The turn's error ends with its scrubbed, bounded (600-character) tail: pi exited with code 1: Error: Model … not found. The reattach-after-restart paths read the same file.
  • Secrets are scrubbed by the one existing scrubber, moved unchanged from OrbCore.TelemetryAndVoice to OrbBin.Redact so OrbBin can use it. scrubSecrets is still that function.
  • This is the same approach Claude Code's warm process already used (ClaudeControl, "Keep Claude's stderr").

How it was tested

  • New in HarnessProxyTests:
    • A routed Pi gets PI_CODING_AGENT_DIR, the proxy key, and orb/<model>.
    • Its models.json declares provider orb at Core's router with the mission's model, the catalog and builtin/smart. It holds no token, and it is byte-identical to piModelsJson (one implementation).
    • oneShotExitError keeps the stderr tail, scrubs an sk-ant-… key, stays under 700 characters, removes the file, reports the bare code without stderr, and returns nothing for exit 0.
  • Built on spark (build_orb_bins.sh --only orb-core-test --only orb-core): OrbBin, OrbCore and OrbLocald compiled.
  • orb-core-test ran through HarnessProxyTests and the launch admission matrix with no failure. It then stopped on a spark-only environment fault: /tmp/sandboxed-sh-uploads is owned by the sandboxed-node user there, so writing to it gave permission denied. The rest of the suite, StreamableMcpTests (the piModelsJson rename) and orb-locald-test (another build held spark) are left to CI.

Not verified live

  • A Core-host Pi mission on dev reaches a first turn. Closed by: canary pi@core on the next warn-mode deploy after merge.
  • A local Pi mission on Core accounts through orb-locald reaches a first turn. Not covered by the canary (client/locald placement): named follow-up for a desktop check.

…et; failed harness turns keep their stderr tail

A Pi mission on the Core host exited 1 with 'Model "orb/..." not found':
Core staged no PI_CODING_AGENT_DIR there, only on nodes. Pi's models.json
renderer moves to OrbBin.HarnessProxy (piModelsJson), and
harnessProxySetupWithHome gives a routed Pi <state>/pi-home/<mission> (0700)
with that file, so Core-host, orb-locald and node turns share one
implementation. RemoteDispatch.piCatalogFor builds the owner's catalog for
both Core paths.

One-shot harness turns kept no stderr, so a failure read only 'pi exited with
code 1'. Both spawn paths now keep stderr in a private file and the error ends
with its scrubbed, 600-character tail (OrbBin.Redact.stderrTail). The secret
scrubber moves from OrbCore.TelemetryAndVoice to OrbBin.Redact unchanged, so
OrbBin can use it; scrubSecrets stays as the same function.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant