Preserve Pi qualification errors when diagnostic storage fails

This commit is contained in:
Dotta committed 2026-10-05 21:18:13 -05:00
1 parent 8ce546da0e
commit dda1b5fb82
3 files changed
+41 -10

No files matched your search

@@ -19,9 +19,16 @@ Shipping runtime remains `f5024863e`; these changes affect only fixtures and
documentation. Pi native definition v14 is
`8a93306b6df0008ff10b5398049fad7b4bfa7a7cbf4f4ee0dedfe76eed6f0111`.
The model, profile 15, low thinking, byte grades, deadlines and automatic retry
count remain unchanged. All 691 Pi fixture tests across 20 files and the final
count remain unchanged. All 693 Pi fixture tests across 20 files and the final
harness typecheck pass.
The diagnostic-storage regression also reproduces a review finding: a failed
diagnostic write replaced the original incomplete-terminal error. Both the main
flow and cleanup now preserve that original error. Failed diagnostic writes
remain eligible for another save during cleanup. Successful saves stay unique.
The regression fails before the correction and passes afterward; this evidence
fix does not authorize a paid retry.
The two explicit v13 attempts at harness `b3318d6be` remain failed. Restart
retains the original question, run, turn, session and producer and accepts the
exact browser answer. Its provider run succeeds, but the observer is incomplete
@@ -324,11 +331,11 @@ local tests and release review are still required.
| --- | --- | --- |
| Runtime identity and admission | Exact runtime/profile/model; verified effective thinking; startup below the 60-second admission limit; unsupported configuration fails before a prompt | Shipping runtime `f5024863e` passes normal profile-15 admission on ARM Mac and native Linux. Completed live runs confirm the frozen model and native low. Fresh Intel admission for these shipping bytes remains required. Profile-14 and earlier profile-15 results below are historical. |
| Live lifecycle | Pending native question survives controller restart in the original process; one creation and resolution; stale answer after provider death rejected; Stop retires owned processes; three warm turns keep process identity | Current Linux restart retains the same native question/run/turn/session/producer and the browser answer; the run succeeds, but its incomplete independent terminal evidence and failed canonical cleanup keep the case failed. Earlier `b012b3aeb` provider-death and native-question passes do not qualify `f5024863e`. |
| Product workflows | All 26 explicit Pi Product E2E cells (13 local, 13 Daytona); screenshots, public state, independent artifacts, terminal and cleanup evidence | Not qualified at `f5024863e`. Mac and latest Linux memory attempts fail exact saved bytes. Latest Linux restart fails independent terminal evidence. Both v13 Linux attempts fail canonical cleanup; owned children are independently absent. V14 fixture calibration and 691 tests pass, but do not regrade those cases. Historical `0bd040093` has 21/26 passes, kept only as history. Fresh complete current-runtime coverage is required. |
| Product workflows | All 26 explicit Pi Product E2E cells (13 local, 13 Daytona); screenshots, public state, independent artifacts, terminal and cleanup evidence | Not qualified at `f5024863e`. Mac and latest Linux memory attempts fail exact saved bytes. Latest Linux restart fails independent terminal evidence. Both v13 Linux attempts fail canonical cleanup; owned children and controller are independently absent. V14 fixture calibration and 693 tests pass, but do not regrade those cases. Historical `0bd040093` has 21/26 passes, kept only as history. Fresh complete current-runtime coverage is required. |
| Runner protocol | Pi roster passes through the native packaged runner and authenticated mock control plane; lifecycle/denial/control cases remain distinct from Product tests | Current-runtime Runner qualification remains required. Historical `0bd040093` has 7/7 passes at private definitions `7b112ffe3`, with unchanged graders and zero automatic retries. Those passes retain their original source labels. |
| 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 | Normal ARM public install verifies 722 packages and 79,373 files at `f5024863e`. Normal native Linux install, companion import, Pi setup and admission pass at immutable candidate image `ghcr.io/paperclipai/paperclip-daytona-runner@sha256:20c7fffddeee4298830ead1ea3f0b70819f61e549279588b605440d1155f7260`. No binary override is used. This image is not release-qualified. Fresh Intel proof remains required; earlier three-platform proofs stay historical. |
| Governance and spend | Company isolation, human-only permission, duplicate/stale answers, Stop and budget hard stop; pricing estimates never become claimed bills | Historical 58 focused invariants and live pending-permission Stop keep their source labels. Fresh shipping qualification remains required. The dedicated key retains a $5 lifetime cap, zero BYOK usage and the $100 campaign ceiling. Last read-only accounting observes $0.319832563 used and $4.680167437 remaining, with delayed settlement still possible. The 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 | Full build and recursive typecheck pass at shipping runtime `f5024863e`. V14 fixture changes pass 691 tests and harness typecheck; latest-head CI and review must be recorded separately. The full local workspace test command remains failed. Prerequisite #14921's valid production-admission finding remains open. Complete current-runtime qualification and prerequisite disposition remain required. No merge or release is authorized. |
| Integration and rollout | Review each prerequisite; final-head typecheck, tests, build and CI pass; no unresolved review; exact artifacts; rollback recorded | Full build and recursive typecheck pass at shipping runtime `f5024863e`. V14 fixture changes pass 693 tests and harness typecheck; latest-head CI and review must be recorded separately. The full local workspace test command remains failed. Prerequisite #14921's valid production-admission finding remains open. Complete current-runtime qualification and prerequisite disposition remain required. No merge or release is authorized. |
## Bounded execution
+7 -2
View File
@@ -46,8 +46,13 @@ export async function runPiNativeFlow(input: {
async function retainIncompleteTerminal(fixture: RemoteNativeFixture, ordinal: number, error: unknown) {
const snapshot = remoteNativeIncompleteTerminalEvidence(error);
if (!snapshot || retainedIncompleteTerminals.has(ordinal)) return;
await input.evidence(`pi-remote-${ordinal}-incomplete-terminal.json`, { binding: fixture.binding, snapshot, passed: false });
retainedIncompleteTerminals.add(ordinal);
try {
await input.evidence(`pi-remote-${ordinal}-incomplete-terminal.json`, { binding: fixture.binding, snapshot, passed: false });
retainedIncompleteTerminals.add(ordinal);
} catch {
// The caller must rethrow the original qualification error. Leave this
// ordinal unretained so cleanup can still try to save its diagnostic.
}
}
async function finishRemote(label: string) {
if (!currentRemote) throw new Error("Missing exact owned remote fixture");
+24 -5
View File
@@ -5,15 +5,25 @@ import { tmpdir } from "node:os";
import { expect, it, vi } from "vitest";
import { piNativeTasks, PI_NATIVE_MEMORY_PARENT_SEED_PATH, PI_NATIVE_MEMORY_PARENT_SEED_CONTENT } from "./pi-native-cases.js";
import { runPiNativeFlow } from "./pi-native-flow.js";
import * as remoteFixtures from "./remote-native-fixtures.js";
const browser = vi.hoisted(() => ({ create: (_value: any) => {} }));
vi.mock("./user-actions.js", () => ({ createTaskThroughUi: async (value: unknown) => browser.create(value) }));
vi.mock("@playwright/test", () => ({ expect: (value: unknown, message?: string) => ({ toBe: (expected: unknown) => expect(value, message).toBe(expected), toBeVisible: async () => {} }) }));
it.each([false, true])("retains managed bytes before grading and rebinds successful runs (missing LF=%s)", async missingLF => {
it.each([
{ missingLF: false, incomplete: false, diagnosticSaveFails: false },
{ missingLF: true, incomplete: false, diagnosticSaveFails: false },
{ missingLF: false, incomplete: true, diagnosticSaveFails: false },
{ missingLF: false, incomplete: true, diagnosticSaveFails: true },
])("preserves remote memory and terminal failures ($missingLF, $incomplete, $diagnosticSaveFails)", async ({ missingLF, incomplete, diagnosticSaveFails }) => {
const root = await mkdtemp(join(tmpdir(), "pi-remote-memory-"));
const task = piNativeTasks.find(row => row.id === "agent-files-fresh-run")!;
const issues: any[] = [], runs: any[] = [], cleanup: Array<() => Promise<any>> = []; const captures: any[] = [], evidence = new Map<string, any>();
let personal = "", restarted = false, readAfterFinish = false, parentSeeded = false;
let personal = "", restarted = false, readAfterFinish = false, parentSeeded = false, closed = 0, diagnosticAttempts = 0;
const terminalError = new Error("remote_native_fixture:terminal_evidence_incomplete");
const originalDiagnostic = remoteFixtures.remoteNativeIncompleteTerminalEvidence;
const diagnostic = vi.spyOn(remoteFixtures, "remoteNativeIncompleteTerminalEvidence").mockImplementation(error => error === terminalError
? { complete: false, incompleteReasons: ["unwatched_directory"] } as any : originalDiagnostic(error));
browser.create = value => {
expect(parentSeeded).toBe(true);
expect(value.prompt).toMatch(/^Read only bootstrap-/); expect(value.prompt).not.toContain("forbidden");
@@ -41,7 +51,7 @@ it.each([false, true])("retains managed bytes before grading and rebinds success
const snapshot = { observedAtMs: ordinal, complete: true, targets, workspace: {}, watcher: { complete: true, targetMutationCount: 0, workspaceMutationCount: 0 }, processes: { captured: true, root: identity, journal: [identity], live: [] } };
let armed = false, finished = false;
const fixture = { binding: { runId: input.runId }, remoteCwd: `/remote/run-${ordinal}`, outsideTarget: ordinal === 1 ? `/tmp/owned-${ordinal}/cross-root-target` : null,
snapshot: async () => { armed = true; return snapshot; }, finish: async () => { finished = true; return snapshot; }, close: async () => {},
snapshot: async () => { armed = true; return snapshot; }, finish: async () => { if (incomplete) throw terminalError; finished = true; return snapshot; }, close: async () => { closed++; },
readFile: async (path: string) => { expect(finished).toBe(true); expect(restarted).toBe(true); expect(path).toBe("pi-agent-memory-proof.txt"); readAfterFinish = true; return Buffer.from(personal); },
};
const action = await input.actionPrompt(fixture); expect(armed).toBe(true);
@@ -59,7 +69,7 @@ it.each([false, true])("retains managed bytes before grading and rebinds success
try {
await writeFile(join(root, "pi-agent-memory-proof.txt"), "WRONG HOST COPYBACK");
const call = runPiNativeFlow({ page: { goto: async () => {}, reload: async () => {}, getByTestId: () => ({ getByRole: () => ({}) }) }, api, fixtures: { company: { id: "company", issuePrefix: "PI" }, agent: { id: "agent", name: "Pi" }, environment: { id: "daytona-env" } }, execution: { task, environment: { id: "daytona" }, profile: { qualificationCandidate: "pi" } }, nonce: "fixture", workspacePath: root, deadlineAt: Date.now() + 2000,
restart: async () => { expect(evidence.has("pi-remote-1-cross-root-final.json")).toBe(true); restarted = true; }, observe: () => {}, capture: async () => {}, evidence: async (name: string, value: unknown) => { evidence.set(name, value); }, remoteBootstrap, registerCleanupAssertion: (fn: () => Promise<any>) => cleanup.push(fn) } as any);
restart: async () => { expect(evidence.has("pi-remote-1-cross-root-final.json")).toBe(true); restarted = true; }, observe: () => {}, capture: async () => {}, evidence: async (name: string, value: unknown) => { if (name.endsWith("incomplete-terminal.json")) { diagnosticAttempts++; if (diagnosticSaveFails) throw new Error("diagnostic storage unavailable"); } evidence.set(name, value); }, remoteBootstrap, registerCleanupAssertion: (fn: () => Promise<any>) => cleanup.push(fn) } as any);
if (missingLF) {
await expect(call).rejects.toThrow("Public managed-file API contains the exact native-write bytes");
expect(evidence.get("pi-agent-files-first-save.json").personal.content).toBe(personal);
@@ -67,7 +77,16 @@ it.each([false, true])("retains managed bytes before grading and rebinds success
expect(restarted).toBe(false); expect(runs).toHaveLength(1);
return;
}
if (incomplete) {
await expect(call).rejects.toBe(terminalError);
expect(cleanup).toHaveLength(1);
await expect(cleanup[0]!()).rejects.toBe(terminalError);
expect(closed).toBe(1); expect(restarted).toBe(false);
expect(evidence.has("pi-remote-1-incomplete-terminal.json")).toBe(!diagnosticSaveFails);
expect(diagnosticAttempts).toBe(diagnosticSaveFails ? 2 : 1);
return;
}
const result = await call;
expect(result.checks.every(check => check.passed)).toBe(true); expect(captures).toEqual([{ runId: "run-1" }, { runId: "run-2" }]); expect(readAfterFinish).toBe(true); expect(cleanup).toHaveLength(2); for (const fn of cleanup) await fn();
} finally { await rm(root, { recursive: true, force: true }); }
} finally { diagnostic.mockRestore(); await rm(root, { recursive: true, force: true }); }
});