diff --git a/doc/plans/2026-10-02-pi-production-readiness.md b/doc/plans/2026-10-02-pi-production-readiness.md index 45ae69103a9..bede0871829 100644 --- a/doc/plans/2026-10-02-pi-production-readiness.md +++ b/doc/plans/2026-10-02-pi-production-readiness.md @@ -19,7 +19,7 @@ qualification. The existing draft stack must be reviewed in dependency order. | Gate | Acceptance evidence | Current result | | --- | --- | --- | | Runtime identity and admission | Exact runtime/profile/model; verified effective thinking; startup below the 60-second admission limit; unsupported configuration fails before a prompt | Deterministic checks and ARM installed startup pass. Recheck final source on all supported hosts. | -| 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 | Controller recovery fixes in PR #14956. Live attempts exposed the durable/provider turn-ID gap and duplicate request creation. Neither attempt is a qualification pass. | +| 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 | Installed local restart and three-turn warm continuity pass at `f5f57e380`. Provider-death and Stop remain required. | | Product workflows | All 26 explicit Pi Product E2E cells (13 local, 13 Daytona); screenshots, public state, independent artifacts, terminal and cleanup evidence | Historical partial passes exist. Full final-source campaign remains 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 | Historical get-task-context pass. Final-source roster remains required. | | 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 | Fresh ARM public installation passes. Linux source/image build is running. Final-source Intel/Linux/Daytona receipts remain required. | @@ -50,6 +50,14 @@ prices are estimates. Unpriced usage must stay unpriced in the ledger and UI. because recovery emitted a second `runtime_request.created`. The oracle correctly requires one creation. The next change restores the ledger without repeating its creation event. +- `f5f57e380`: the fresh installed restart journey passes all six matchers, + including one native creation/resolution, the original process and turn, exact + browser answer, independent file and cleanup. The revised three-turn warm + journey also passes all nine matchers with the same native process/session. + Earlier failed attempts remain unchanged. +- The full workspace typecheck, 332 native core tests and 58 focused governance, + cost and session tests pass. The PR's Linux timestamp precision finding is + fixed with positive and negative calibration and the real process fixture. - Credential-free ARM startup through the installed CLI, server and database passed. Normal Pi setup verifies the profile-13 closure. Full transport and recovery regressions at `780471702` passed 216 tests. diff --git a/tests/runner-e2e/process-tree-owner.ts b/tests/runner-e2e/process-tree-owner.ts index 531c0df646e..12d177d4a34 100644 --- a/tests/runner-e2e/process-tree-owner.ts +++ b/tests/runner-e2e/process-tree-owner.ts @@ -19,6 +19,15 @@ export function parseRestartRunnerIdentity(value: unknown): RestartRunnerIdentit return { processPid: v.processPid, processGroupId: v.processGroupId, processStartedAt: v.processStartedAt }; } +/** Linux run receipts retain milliseconds; ps lstart retains whole seconds. */ +export function restartProcessStartMatches(observed: string, expected: string, platform = process.platform): boolean { + const actualTime = Date.parse(observed), expectedTime = Date.parse(expected); + if (!Number.isFinite(actualTime) || !Number.isFinite(expectedTime)) return false; + return platform === "linux" + ? Math.floor(actualTime / 1000) === Math.floor(expectedTime / 1000) + : actualTime === expectedTime; +} + export function createProcessTreeOwner(root: ChildProcess, options: { readTable?: () => Promise; signalGroup?: (pid: number, signal: NodeJS.Signals) => void; @@ -92,7 +101,7 @@ export function createProcessTreeOwner(root: ChildProcess, options: { const candidate = tree.members.map(member => member.process).find(row => row.pid === expected.processPid); if (!candidate || !running(candidate) || candidate.kind !== "paperclip-runnerd" || candidate.processGroupId !== expected.processGroupId - || Date.parse(candidate.started) !== Date.parse(expected.processStartedAt) + || !restartProcessStartMatches(candidate.started, expected.processStartedAt) || candidate.processGroupId === root.pid) throw new Error("Restart runner is not the exact owned durable daemon"); const subtree = observeDescendantProcessTree(table, candidate.pid); const members = new Set(subtree.members.map(member => member.process.pid)); diff --git a/tests/runner-e2e/server-restart-preservation.test.ts b/tests/runner-e2e/server-restart-preservation.test.ts index 110fe76dfdb..54d6031571b 100644 --- a/tests/runner-e2e/server-restart-preservation.test.ts +++ b/tests/runner-e2e/server-restart-preservation.test.ts @@ -1,6 +1,6 @@ import type { ChildProcess } from "node:child_process"; import { expect, it, vi } from "vitest"; -import { createProcessTreeOwner, parseRestartRunnerIdentity } from "./process-tree-owner.js"; +import { createProcessTreeOwner, parseRestartRunnerIdentity, restartProcessStartMatches } from "./process-tree-owner.js"; import { createRunnerE2EServerStopper } from "./server-stop.js"; import { diagnosticProcessKind, type ProcessObservation } from "./process-tree.js"; @@ -35,6 +35,16 @@ function fixture() { replace: (next: ProcessObservation[]) => { table = next; }, close: () => owners.forEach(owner => owner.stopObserving()) }; } +it("matches Linux process birth receipts at ps precision without accepting another second", () => { + expect(restartProcessStartMatches(started, "2026-10-02T13:55:27.731Z", "linux")).toBe(true); + for (const expected of ["2026-10-02T13:55:26.999Z", "2026-10-02T13:55:28.000Z", "invalid"]) { + expect(restartProcessStartMatches(started, expected, "linux")).toBe(false); + } + expect(restartProcessStartMatches("invalid", started, "linux")).toBe(false); + expect(restartProcessStartMatches(started, "2026-10-02T13:55:27.731Z", "darwin")).toBe(false); + expect(restartProcessStartMatches(started, started, "darwin")).toBe(true); +}); + it.skipIf(process.platform === "win32")("preserves only the admitted daemon tree across restart and finally retires old and new owners", async () => { const f = fixture(); try {