Repository navigation
test(experiments): reconcile the Pi schema offline fixture with the host relay - #4037
Merged
Merged
Conversation
…ntial (#4031) The host inference relay now resolves a turn's credential from pi's auth store before the worker launches. The offline fixture provisions the same fictional Codex identity into its fresh agent directory, host side only, and refuses to write over an existing store. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…s tool-safety hook (#3888) The managed worker refuses any loaded Pi extension as uncollected input, and the extension-factory anchor had drifted. The measurement guard now wraps the host tool-safety hook in native-session-runtime instead, with the same admission policy and receipt, and records a denied call's reason as its host result as Pi's blocked path did. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This was referenced Nov 15, 2026
schlessera
marked this pull request as ready for review
November 15, 2026 23:34
…ost (#3888) Its parameterless permission() narrowed the wrapper's inferred type, so strict typecheck rejected the three-argument calls and deny results. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
schlessera
marked this pull request as draft
November 16, 2026 00:57
schlessera
marked this pull request as ready for review
November 16, 2026 00:57
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #4031
Closes #3888
Supersedes draft #4032, whose anchor-repair commit this branch carries unchanged.
What changed
backend-entry.ts, the prepared prompt inworker-session.ts, the launch arguments and environment inworker-launch.ts, and receipt interception inworker-reader.ts. Its load filter names exactly those files plusbridge-tools.ts.preparePiHostInference,packages/ui-backend-pi/src/host-inference.ts:243-295) before the worker launches.scripts/pi-schema-offline-preload.tsnow writes the fixture's existing fictional Codex identity (nativeCredential()) into the freshPI_CODING_AGENT_DIR/auth.json. It does this on the host side only, withwxand mode 0600, and refuses when that directory is unset or already holds a store. The worker still gets the same fictional identity through itsBRAIN_MEASURE_*environment and the measurement model runtime, so the fake transport andbearerMatchesNativeAccessreceipts are unchanged.extensionFactories: [anchor insession-resources.tshad drifted. More importantly, the managed worker now refuses any loaded Pi extension as uncollected input (unqualifiedResources,packages/ui-backend-pi/src/native-session-runtime.ts:134-137), so the measurement's inline guard extension would fail every turn withInput collection is not qualified for this runtime configuration, even on a namespace-enabled host. The guard is nowmeasurementToolSafety. It wraps the worker's host tool-safety hook at bothinstallPiToolSafety(...)sites innative-session-runtime.ts, with the same admission policy andtool-admission.jsonlreceipt. A denied call records its reason as the host result, as Pi's blocked-extension path did. The guard's unit test now drives the wrapper and keeps its assertions.scripts/pi-schema-protocol.mddescribes both changes.Product code and the table assertions are unchanged. The fixture stays keyless and offline, and no real credential is used.
Proof
All runtime receipts below come from a namespace-enabled rootless container on this host, because the host itself refuses
unshare -Ur. The container ran with--network none, seccomp and AppArmor unconfined, andSYS_ADMIN/NET_ADMINfor the tier's ownbwrappreflight. It used Bun 1.4.4, with the worktree and its git dir mounted.real Pi/server flat/acceptedfails withBACKEND_REQUEST_ERROR:This pi turn cannot run on the host inference relay: pi has no credential for openai-codex. There is no native request.Measurement source anchor drift.frompi-schema-worker-preload.ts(theextensionFactoriesanchor). Repairing only that anchor givesBACKEND_ERROR:Input collection is not qualified for this runtime configuration, in the container as on the host.bun run test ./experiments/pi-schema-measurement.test.tsgives 27 pass, 0 fail, including all 19real Pi/servertable cases.flat/accepted,shared/billing-headerandshared/binary-errorall fail with the relay refusal andNo native request, before provider dispatch. The billing case fails at its existingJSON.parseof the physical receipts, and binary-error at its existingresult.jsonread. Restored.options.toolSafety):shared/tool-guardfails withENOENTonreceipts/tool-admission.jsonl(test line 193). Restored.installPiToolSafety(session.agent, options.toolSafety,with a space, innative-session-runtime.ts):flat/acceptedfails withMeasurement source anchor drift.Restored.git diffon product source is empty.flat/acceptedwithMeasurement source anchor drift.bun run buildpassed.bun run check:pr --base origin/mainpassed all five selected checks at this head (receipt below).849751e42: candidateverifyfailed strict typecheck in the guard test (TS2554/TS2769, lines 108–113). The test's fake host declared a parameterlesspermission(), which narrowed the wrapper's inferred type. Commitde5e282c1types the fake as the real hook signature. The focusedcheck:prdoes not select strict typecheck, so I ran it on its own: roottsc --noEmit(bun run typecheck,NODE_OPTIONS=--max-old-space-size=8192, since the default heap aborts here) passes.bun run buildpasses. The Pi schema file is 27/27 again in the namespace-enabled container on the merged tree.bun run test:experimentsafterbun run build, in the same container at this head: 355 pass, 8 fail across 38 files, so no tier receipt is written.experiments/pi-schema-measurement.test.tsis 27/27. The 8 failures are in files this PR does not touch, and each is tracked: citations docs: reconcile accumulated citation drift before the next release #3626 (release check), measure-suggestions experiments: measure-suggestions still pins the suggestions rule at 336 characters after #3525 lengthened it #3889, turn-surface capture and overlap test: turn-surface capture and overlap retain stale deferred core inventories #4003 (3 cases), live collector experiments: the turn-surface live collector refuses every routed arm once the bridge roster passes the 64-entry catalogue bound #3886, runtime placement test: offline runtime placement probe exits before producing its receipt #4005, Git read qualification experiments: Git read qualification expects resolve after synchronous revision refusal #4033. Before this PR the same tier had 27 failures: these 8 plus the 19 Pi cases.{"version":1,"kind":"brain-check-pr-receipt","head":"de5e282c141dc2034425ac7a120d0e40b7b0fb84","base":"origin/main","mode":"focused","startedAt":"2026-11-16T00:09:45.700Z","finishedAt":"2026-11-16T00:11:15.012Z","checks":[{"name":"all lint and leakage gates","categories":["changeset"],"outcome":"passed","elapsedMs":12605.65628},{"name":"environment documentation","categories":["changeset"],"outcome":"passed","elapsedMs":110.94743300000118},{"name":"pending changeset package names","categories":["changeset"],"outcome":"passed","elapsedMs":88.32112799999959},{"name":"contribution changeset","categories":["changeset"],"outcome":"passed","elapsedMs":19.395300000000134},{"name":"affected fast invariants","categories":["verify","unit"],"outcome":"passed","elapsedMs":76470.899074}]}Collisions (
bun scripts/collisions.ts --json --pr 4037at head9da07b14d, before the refresh): nopathcollisions. There are shared proof-closure overlaps only, with open PRs #3054, #3056, #3059, #3069, #3116, #3437, #3581, #3622, #3806, #4002, #4008, #4018, #4022, #4024, #4028, #4030, #4034, #4035 and #4036. Superseded #4032 is closed.Checklist
docs/reflect the change, or nothing documented moved.Anything left open
No consumer changeset: this is measurement-only instrumentation. The provider-enabled runner (#1838) will also need a host credential for the relay; that stays in its scope. Hosted selected proof runs at candidate confirmation.
🤖 Generated with Claude Code