From b224e433829860d0d010cd3fd2512fdc90147801 Mon Sep 17 00:00:00 2001 From: Dotta Date: Mon, 5 Oct 2026 10:20:47 -0500 Subject: [PATCH] fix(evals): attest Pi wrapper descriptor launches --- .../2026-10-02-pi-production-readiness.md | 28 ++++++++++++- tests/runner-e2e/FIXTURES.md | 5 +++ tests/runner-e2e/README.md | 5 +++ tests/runner-e2e/SECURITY.md | 9 ++++ tests/runner-e2e/catalog.ts | 2 +- tests/runner-e2e/pi-controls-evidence.test.ts | 4 +- tests/runner-e2e/pi-provider-fault.py | 13 +++++- tests/runner-e2e/pi-provider-fault.test.py | 41 ++++++++++++++++++- tests/runner-e2e/pi-provider-fault.test.ts | 4 +- 9 files changed, 102 insertions(+), 9 deletions(-) diff --git a/doc/plans/2026-10-02-pi-production-readiness.md b/doc/plans/2026-10-02-pi-production-readiness.md index b6a9e9b5dc5..770f5c4be26 100644 --- a/doc/plans/2026-10-02-pi-production-readiness.md +++ b/doc/plans/2026-10-02-pi-production-readiness.md @@ -27,7 +27,7 @@ qualification. The existing draft stack must be reviewed in dependency order. | Runner protocol | Pi roster passes through the native packaged runner and authenticated mock control plane; lifecycle/denial/control cases remain distinct from Product tests | All seven cases are attempted at `0bd040093`: five pass; context-before-action retains its 120-second terminal timeout, and finish-task retains use of the advisory report without the required task mutation. One context/document workflow retry passes only after verified protection against the recorded host sleep; its original failure stays unchanged. The seven `b148b73ea` passes remain historical. | | Installed distribution | Public CLI/server tars on ARM Mac, Intel Mac and Linux; normal Pi setup; exact Linux companion and immutable Daytona image imported without binary override | Exact-source public CLI/server installation and normal Pi setup pass on all three platforms. Public immutable image `ghcr.io/paperclipai/paperclip-daytona-runner@sha256:342f1fd5cb8cabfa2242f38f4f686608b28b6536aa879c54b0cb0da6fba9ef47` imports into native Linux Daytona and passes closed admission. Temporary sandbox cleanup passes. Image jobs 37102904889, 37106313185 and 37110683910 are terminal/cancelled. | | Governance and spend | Company isolation, human-only permission, duplicate/stale answers, Stop and budget hard stop; pricing estimates never become claimed bills | 58 focused governance/cost/session invariants pass at `f5f57e380`. Live pending-permission Stop passes at `03dd6ef93`. The qualification key cap is not proof of Paperclip budget enforcement. | -| Integration and rollout | Review each prerequisite; final-head typecheck, tests, build and CI pass; no unresolved review; exact artifacts; rollback recorded | Last verified fixture head `04f639eeb` has 53 successful CI checks and two skips, including full Linux build and typecheck. Its documentation consistency finding is addressed in this follow-up; verify the latest PR head and review before handoff. All 116 targeted native Linux fixture tests and 13 browser-case collections pass at `04f639eeb`. Full typecheck, complete test and build evidence remains recorded below; original failed commands remain failed. Shipping inputs stay equivalent to `0bd040093`. Four prerequisite findings have downstream corrections; upstream review threads and standalone prerequisite CI remain open. Production stays held for nine failed gates and prerequisite disposition. No merge or release. | +| Integration and rollout | Review each prerequisite; final-head typecheck, tests, build and CI pass; no unresolved review; exact artifacts; rollback recorded | Last verified PR head `4f2300d5b` has 53 successful CI checks, two skips, Greptile 5/5 and no unresolved root threads, including full Linux build and typecheck. This provider-fault fixture follow-up requires its own completed latest-head checks and review. All 116 targeted native Linux fixture tests and 13 browser-case collections pass at `04f639eeb`; the new descriptor correction separately passes all 17 free native Linux fault tests. Full typecheck, complete test and build evidence remains recorded below; original failed commands remain failed. Shipping inputs stay equivalent to `0bd040093`. Four prerequisite findings have downstream corrections; upstream review threads and standalone prerequisite CI remain open. Production stays held for nine failed gates and prerequisite disposition. No merge or release. | ## Bounded execution @@ -138,11 +138,35 @@ The owned Linux controller passes normal public installation, Pi admission in 6.949 seconds, complete 101,226-file consumer and 16,356-file plugin audits, all 13 browser-case collections and 112 targeted free native Linux tests. These preparation checks do not qualify a live behavior. Last verified root -head `14c48ff40` has 53 successful checks, two skips, Greptile 5/5 and no open +head `4f2300d5b` has 53 successful checks, two skips, Greptile 5/5 and no open root review threads; this fixture follow-up requires its own completed checks. Prerequisite reviews/standalone CI and the remaining failed production gates stay open. Rollout remains held; no merge or release occurs. +A later credential-free audit identifies another concrete fault-fixture +incompatibility. The production native bootstrap launches the wrapper through +its held executable FD 7 (or FD 3 without lifetime/credential fences). Linux +retains `/proc/self/fd/N` in its argv, while the fault helper requires the +physical snapshot Node pathname. The existing direct-path calibration misses +that launch form. A network-blocked native Linux regression rejects both actual +descriptor launches before the correction with `wrapper_parent`. The correction +requires the corresponding held descriptor and wrapper executable to match the +sealed snapshot Node inode, while retaining every other ownership check. All +17 fault tests pass afterward, including both real descriptor launches and +foreign/missing-descriptor negatives. The probe uses only synthetic owned +processes, no provider credentials or model calls, and its sandbox is deleted. +Native definitions advance from 5 to 6; their new fingerprint is +`6511c44fd0997ba56b8627d788d04d7e4924b8992b4c2a3085d5ee9aa56cd56b`. +The local helper/catalog tests pass. The broader local remote-observer suite +still fails its unchanged transient filesystem-watch test; its other 76 tests +pass. Preserve that failed command. This is a concrete fixture correction for a +separately bounded provider-death attempt after fresh preparation and guards; +no new paid attempt has occurred. The previous live error does not retain its +internal rejection stage, so complete live qualification remains unproven. +The retained production matrix stays 24 passes and nine failures. All six +earlier resumed attempts and their phases are terminal. Their controller and +child sandboxes are deleted with canonical evidence retained. + ## Qualification snapshot — 2026-10-03 The October 3 ledger has 21 passes, ten failed cells, two unattempted cells and diff --git a/tests/runner-e2e/FIXTURES.md b/tests/runner-e2e/FIXTURES.md index 51674dfaba2..b7110865c17 100644 --- a/tests/runner-e2e/FIXTURES.md +++ b/tests/runner-e2e/FIXTURES.md @@ -377,6 +377,11 @@ ancestry and fresh PID/start-time checks. Pi overwrites Linux argv via `process.title`, so the private receipt explicitly uses pinned-parent entrypoint attribution and never claims original child argv. A pidfd targets only that child; worker death, broad process-name matching and controller Stop cannot substitute. +The production bootstrap may name its held executable as `/proc/self/fd/3` +or `/proc/self/fd/7` in the wrapper argv. That form is admitted only when the +wrapper's corresponding descriptor and executable both have the exact sealed +snapshot Node inode. The guard and wrapper entrypoint paths remain exact. +Missing, foreign or other descriptor numbers fail before signalling. The runtime itself must emit `runtime_request.expired` for the original callback with `provider_process_lost` and `replayAllowed:false`, followed by native turn diff --git a/tests/runner-e2e/README.md b/tests/runner-e2e/README.md index 4e4ed5b0dff..0cd186165c1 100644 --- a/tests/runner-e2e/README.md +++ b/tests/runner-e2e/README.md @@ -1461,6 +1461,11 @@ death is excluded because this exact ownership mechanism requires Linux pidfd. The Python helper calibration uses a synthetic transport and a real title-changing Node child; it proves fault ownership only, never paid Pi lifecycle behavior. Run it on native Linux with pinned Node on PATH: `python3 tests/runner-e2e/pi-provider-fault.test.py`. +The calibration covers direct launch and the production bootstrap's held FD 3 +and FD 7 launches. Descriptor launch requires the held descriptor and wrapper +executable to match the sealed snapshot Node inode; an argv alias alone grants +no authority. Native suite definitions 6 retain the original live failures and +require new provider-death qualification after this fixture correction. The fault helper validates the profile pin against canonical normalized closure entries, matching production admission. JSON formatting is not part of that pin. The same free suite checks canonical hash admission, malformed metadata and diff --git a/tests/runner-e2e/SECURITY.md b/tests/runner-e2e/SECURITY.md index 355f4695ae1..ab8614b4484 100644 --- a/tests/runner-e2e/SECURITY.md +++ b/tests/runner-e2e/SECURITY.md @@ -307,3 +307,12 @@ controller's `processStartedAt` annotations may change as launch metadata settle and do not identify a remote process birth. Every remote snapshot and retirement seal must retain the original birth identity and complete no-effect journal. Local controls retain their separate public process-authority comparison. + +Pi provider-death admission accepts the native bootstrap's `/proc/self/fd/3` +or `/proc/self/fd/7` wrapper launch only after binding that held descriptor and +the wrapper executable to the sealed snapshot Node inode. Exact guard and +entrypoint paths, closure hashes, Pi title, run/lease ancestry and fresh process +birth checks remain required. Other descriptor aliases, missing descriptors and +foreign inodes fail before any signal. Native Linux calibration exercises both +descriptor launches with synthetic owned processes and no provider credentials; +it does not qualify paid Pi behavior or change previous failed grades. diff --git a/tests/runner-e2e/catalog.ts b/tests/runner-e2e/catalog.ts index 1de3ae1b544..e9f51913a26 100644 --- a/tests/runner-e2e/catalog.ts +++ b/tests/runner-e2e/catalog.ts @@ -1114,7 +1114,7 @@ export const runnerSuites: readonly RunnerSuiteFixture[] = [ groups: ["native"], profiles: extendedHarnessProfiles.filter(profile => profile.qualificationCandidate === "pi"), environments: runnerEnvironments, tasks: piNativeTasks, expectedMatrixSize: 10, excludedExecutionIds: ["pi-native.runner-acpx-pi.daytona.restrictive-denial", "pi-native.runner-acpx-pi.local.native-pending-provider-death"], - definitionMetadata: { version: 5, qualification: "pending", scheduling: "explicit-only", profileVersion: QUALIFIED_ACPX_PROFILES.pi.agentProfileVersion, providerDeath: "daytona-exact-pi-child-pidfd-production-expiry", remoteBootstrapApproval: "exact-published-native-read-public-accept-once-v1", remoteDenyAll: "unsupported-native-bootstrap-read-is-denied", remoteEvidence: "owned-lease-sealed-observer", pendingControllerRestart: "same-live-native-request" }, + definitionMetadata: { version: 6, qualification: "pending", scheduling: "explicit-only", profileVersion: QUALIFIED_ACPX_PROFILES.pi.agentProfileVersion, providerDeath: "daytona-exact-pi-child-pidfd-production-expiry", providerFaultExecutable: "snapshot-node-inode-with-held-bootstrap-fd-3-or-7", remoteBootstrapApproval: "exact-published-native-read-public-accept-once-v1", remoteDenyAll: "unsupported-native-bootstrap-read-is-denied", remoteEvidence: "owned-lease-sealed-observer", pendingControllerRestart: "same-live-native-request" }, }, { id: "native-active-stop", label: "Stop an unanswered native permission", manualOnly: true, diff --git a/tests/runner-e2e/pi-controls-evidence.test.ts b/tests/runner-e2e/pi-controls-evidence.test.ts index 04107edfe2e..28ce004c437 100644 --- a/tests/runner-e2e/pi-controls-evidence.test.ts +++ b/tests/runner-e2e/pi-controls-evidence.test.ts @@ -189,7 +189,7 @@ describe("Pi controls catalog admission", () => { // provider death, pending restart and the strict file oracle; no runtime admission is promoted. const pi = runnerMatrix.find(c => c.profile.qualificationCandidate === "pi")!.profile; expect(pi.modelQualification?.qualificationId).toBe("pi:0.0.33:1.0.0:openrouter"); - expect(runnerSuites.find(s => s.id === "pi-native")!.definitionMetadata).toMatchObject({ version: 5, profileVersion: 14 }); + expect(runnerSuites.find(s => s.id === "pi-native")!.definitionMetadata).toMatchObject({ version: 6, profileVersion: 14, providerFaultExecutable: "snapshot-node-inode-with-held-bootstrap-fd-3-or-7" }); expect(runnerSuites.find(s => s.id === "pi-controls")!.definitionMetadata).toMatchObject({ version: 8, profileVersion: 14, remoteProcessIdentity: "observer-pid-startTicks-bootId", controlPlaneSettlement: "required-scoped-result-and-terminal-after-runner" }); @@ -200,7 +200,7 @@ describe("Pi controls catalog admission", () => { } const hashes = Object.fromEntries(runnerSuites.filter(s => ["pi-native", "native-active-stop", "extended-harnesses", "rich-acp-warm-continuity"].includes(s.id)).map(s => [s.id, suiteDefinitionHash(s)])); expect(hashes).toEqual({ - "pi-native": "bbfcb15e83082b11046ab72ed31acf40bae268a4f13897f88214b1d42f7f23f2", + "pi-native": "6511c44fd0997ba56b8627d788d04d7e4924b8992b4c2a3085d5ee9aa56cd56b", "native-active-stop": "99682b2b106d816a011834fae5a944ed7729958893709d5b83a19b6f595e7e4d", "rich-acp-warm-continuity": "036c0faebc2f6eee5cd22ea38887c9c22650a83561fd08ee83473a565b11bb00", "extended-harnesses": "9814841e571cb8bb1dc5188a8577245896e0ce8c851294ac5dea9e3d42689db6", diff --git a/tests/runner-e2e/pi-provider-fault.py b/tests/runner-e2e/pi-provider-fault.py index 78dc8163d1f..693fa5a089b 100644 --- a/tests/runner-e2e/pi-provider-fault.py +++ b/tests/runner-e2e/pi-provider-fault.py @@ -151,7 +151,15 @@ def inspect(config): continue distribution = parent_args[3][:-len('/pi-entry.cjs')] require(re.fullmatch(r'/tmp/paperclip-acpx-native-[A-Za-z0-9_-]+/distribution', distribution), 'snapshot_path') - require(parent_args == [distribution + '/' + NODE, '--require', distribution + '/' + GUARD, distribution + '/pi-entry.cjs'], 'wrapper_parent') + require(parent_args[1:] == ['--require', distribution + '/' + GUARD, distribution + '/pi-entry.cjs'], 'wrapper_parent') + descriptor = None + if parent_args[0] != distribution + '/' + NODE: + # Production nativeBootstrap executes the held Node through child + # FD 3 (unfenced) or 7 (guardian/credential fences). The child's + # cmdline retains /proc/self/fd/N; it does not name the source path. + match = re.fullmatch(r'/proc/self/fd/(3|7)', parent_args[0]) + require(match is not None, 'wrapper_parent') + descriptor = f'/proc/{parent}/fd/{match.group(1)}' # Pi sets process.title and overwrites Linux argv. The exact pinned # parent's launch code attests the entrypoint; title alone never selects. require(argv(pid) == ['pi'], 'pi_process_title') @@ -168,6 +176,9 @@ def inspect(config): require((exe.st_dev, exe.st_ino) == identities[NODE], 'pi_executable') parent_exe = os.stat(f'/proc/{parent}/exe') require((parent_exe.st_dev, parent_exe.st_ino) == identities[NODE], 'wrapper_executable') + if descriptor is not None: + held_exe = os.stat(descriptor) + require((held_exe.st_dev, held_exe.st_ino) == identities[NODE], 'wrapper_descriptor') for identity in chain: require(proc(identity['pid'], boot) == identity, 'ancestry_changed') matches.append({'target': table[pid], 'ancestry': chain, 'nodeSha256': 'sha256:' + entries[NODE]['sha256'], diff --git a/tests/runner-e2e/pi-provider-fault.test.py b/tests/runner-e2e/pi-provider-fault.test.py index 06fbb59f43d..52a558f96c7 100644 --- a/tests/runner-e2e/pi-provider-fault.test.py +++ b/tests/runner-e2e/pi-provider-fault.test.py @@ -111,6 +111,28 @@ class IdentityTests(unittest.TestCase): self.assertFalse(receipt['originalChildArgvAvailable']) self.assertEqual(receipt['ancestry'], [TARGET, PARENT, ROOT]) + def test_descriptor_launch_attests_the_same_pinned_wrapper(self): + for descriptor in [3, 7]: + self.args[22][0] = f'/proc/self/fd/{descriptor}' + with self.subTest(descriptor=descriptor): + self.assertEqual(fault.inspect(self.config)['target'], TARGET) + + def test_descriptor_launch_rejects_foreign_missing_or_unbound_fd(self): + for name in ['/proc/self/fd/8', '/proc/99/fd/7', '/foreign/node']: + self.args[22][0] = name + with self.subTest(name=name), self.assertRaisesRegex(RuntimeError, 'wrapper_parent'): + fault.inspect(self.config) + self.args[22][0] = '/proc/self/fd/7' + stat_original = os.stat + for problem in ['foreign', 'missing']: + def descriptor_stat(path): + if path == '/proc/22/fd/7': + if problem == 'missing': raise FileNotFoundError(path) + return SimpleNamespace(st_dev=1, st_ino=999) + return stat_original(path) + with self.subTest(problem=problem), patch.object(os, 'stat', side_effect=descriptor_stat), self.assertRaises((RuntimeError, FileNotFoundError)): + fault.inspect(self.config) + def test_wrong_metadata_never_selects(self): for field, value in [('closureSha256', '0' * 64), ('runtimeEnvironmentLeaseId', 'foreign'), ('runnerdSha256', 'sha256:' + '0' * 64)]: with self.subTest(field=field), self.assertRaises(RuntimeError): fault.inspect({**self.config, field: value}) @@ -157,6 +179,14 @@ class PidfdTests(unittest.TestCase): @unittest.skipUnless(sys.platform == 'linux' and hasattr(os, 'pidfd_open'), 'Hosted native Linux calibration required') def test_real_title_overwrite_then_exact_child_pidfd(self): + self.calibrate_real_child() + + @unittest.skipUnless(sys.platform == 'linux' and hasattr(os, 'pidfd_open'), 'Hosted native Linux descriptor calibration required') + def test_real_descriptor_launch_then_exact_child_pidfd(self): + for descriptor in [3, 7]: + with self.subTest(descriptor=descriptor): self.calibrate_real_child(descriptor) + + def calibrate_real_child(self, descriptor=None): node = shutil.which('node'); self.assertIsNotNone(node) base = Path(tempfile.mkdtemp(prefix='pi-fault-calibration-', dir='/tmp')) snapshot = Path(tempfile.mkdtemp(prefix='paperclip-acpx-native-', dir='/tmp')) @@ -181,7 +211,16 @@ class PidfdTests(unittest.TestCase): for f in files: p = Path(directory) / f; p.chmod(0o500 if p == distribution / fault.NODE else 0o400) Path(directory).chmod(0o500) - script = base / 'root.cjs'; script.write_text('const p=require("node:child_process").spawn(' + json.dumps(str(distribution / fault.NODE)) + ',["--require",' + json.dumps(str(distribution / fault.GUARD)) + ',' + json.dumps(str(distribution / 'pi-entry.cjs')) + '],{stdio:"ignore"});process.on("SIGTERM",()=>{if(p.exitCode!==null||p.signalCode!==null)process.exit(0);p.once("exit",()=>process.exit(0));p.kill("SIGTERM")});setInterval(()=>{},1000);') + launch = json.dumps(str(distribution / fault.NODE)) + setup, stdio, release = '', '"ignore"', '' + if descriptor is not None: + # Production nativeBootstrap keeps its executable descriptor + # at child FD 3, or FD 7 when lifetime/credential fences exist. + setup = 'const fd=require("node:fs").openSync(' + launch + ',"r");' + launch = json.dumps(f'/proc/self/fd/{descriptor}') + stdio = '[' + ','.join(['"ignore"'] * descriptor + ['fd']) + ']' + release = 'require("node:fs").closeSync(fd);' + script = base / 'root.cjs'; script.write_text(setup + 'const p=require("node:child_process").spawn(' + launch + ',["--require",' + json.dumps(str(distribution / fault.GUARD)) + ',' + json.dumps(str(distribution / 'pi-entry.cjs')) + '],{stdio:' + stdio + '});' + release + 'process.on("SIGTERM",()=>{if(p.exitCode!==null||p.signalCode!==null)process.exit(0);p.once("exit",()=>process.exit(0));p.kill("SIGTERM")});setInterval(()=>{},1000);') check_cancelled() root_child = subprocess.Popen([str(runtime / 'bin/paperclip-runnerd'), str(script), '--run-id', 'fixture', '--environment-lease-id', 'workspace-id', '--lifecycle-mode', 'per_turn', '--state-dir', str(runtime / 'sessions' / ('a' * 64) / 'runner')], cwd=workspace, env={'PATH': '/usr/bin:/bin'}, start_new_session=True, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL) try: owned_fds.append(os.pidfd_open(root_child.pid)) diff --git a/tests/runner-e2e/pi-provider-fault.test.ts b/tests/runner-e2e/pi-provider-fault.test.ts index c9096b14a05..108eec89d68 100644 --- a/tests/runner-e2e/pi-provider-fault.test.ts +++ b/tests/runner-e2e/pi-provider-fault.test.ts @@ -15,8 +15,8 @@ it("calibrates the exact Pi fault helper with metadata negatives and native Linu expect(result.error).toBeUndefined(); expect(result.signal).toBeNull(); expect(result.status, result.stderr).toBe(0); - expect(result.stderr).toContain("Ran 9 tests"); + expect(result.stderr).toContain("Ran 17 tests"); if (process.platform === "linux") expect(result.stderr).not.toContain("skipped"); - else expect(result.stderr).toContain("skipped=1"); + else expect(result.stderr).toContain("skipped=2"); console.info(result.stderr.trim()); }, 30_000);