Skip to content

The open-source app everyone uses to manage agents at work

test(runner): guard continuation after journals exceed 2 MiB (#14312)

Dottaf4f9a7c6139a
diff --git a/packages/paperclip-runner/src/live/runnerd-codex-transport.test.ts b/packages/paperclip-runner/src/live/runnerd-codex-transport.test.ts
index 825e8dd5a1..f959b4213a 100644
--- a/packages/paperclip-runner/src/live/runnerd-codex-transport.test.ts
+++ b/packages/paperclip-runner/src/live/runnerd-codex-transport.test.ts
@@ -6358,123 +6358,138 @@ it.each([
},
);
-it("probes an exact-authority resume and confirms its live provider identity", async () => {
- const stateDirectory = await mkdtemp(
- join(tmpdir(), "runnerd-exact-authority-resume-"),
- );
- const identity = {
- runnerInstanceId: "runner-exact-resume",
- environmentLeaseId: "lease-exact-resume",
- runId: "run-exact-resume",
- normalizedSessionId: "session-exact-resume",
- turnId: "turn-exact-resume",
- itemId: "item-exact-resume",
- };
- const options = {
- runnerBinary: defaultCapabilityRunnerdBinary(),
- codexCommand: fakeCodex,
- codexArgs: fakeCodexArgs(stateDirectory, "--durable-turn-ids"),
- stateDirectory,
- lifecyclePolicy: { mode: "per_turn" as const, idleTimeoutMs: null },
- prpIdentity: identity,
- };
- const first = createCapabilityRunnerdCodexTransport(options);
- first.transport.setServerRequestHandler(async () => ({
- success: true,
- contentItems: [],
- }));
- let providerThread: { id: string; sessionId: string } | null = null;
- try {
- const opened = await first.transport.request("thread/start", {
- cwd: tmpdir(),
- dynamicTools: [],
- });
- const thread = opened.thread as Record<string, unknown>;
- providerThread = {
- id: String(thread.id),
- sessionId: String(thread.sessionId),
+it.each([0, 3 * 1024 * 1024])(
+ "probes an exact-authority resume with %i extra journal bytes and confirms its live provider identity",
+ async (extraJournalBytes) => {
+ const stateDirectory = await mkdtemp(
+ join(tmpdir(), "runnerd-exact-authority-resume-"),
+ );
+ const identity = {
+ runnerInstanceId: "runner-exact-resume",
+ environmentLeaseId: "lease-exact-resume",
+ runId: "run-exact-resume",
+ normalizedSessionId: "session-exact-resume",
+ turnId: "turn-exact-resume",
+ itemId: "item-exact-resume",
};
- } finally {
- await first.transport.close();
- }
- if (providerThread === null) {
- throw new Error("exact-authority fixture did not return a provider thread");
- }
+ const options = {
+ runnerBinary: defaultCapabilityRunnerdBinary(),
+ codexCommand: fakeCodex,
+ codexArgs: fakeCodexArgs(stateDirectory, "--durable-turn-ids"),
+ stateDirectory,
+ lifecyclePolicy: { mode: "per_turn" as const, idleTimeoutMs: null },
+ prpIdentity: identity,
+ };
+ const first = createCapabilityRunnerdCodexTransport(options);
+ first.transport.setServerRequestHandler(async () => ({
+ success: true,
+ contentItems: [],
+ }));
+ let providerThread: { id: string; sessionId: string } | null = null;
+ try {
+ const opened = await first.transport.request("thread/start", {
+ cwd: tmpdir(),
+ dynamicTools: [],
+ });
+ const thread = opened.thread as Record<string, unknown>;
+ providerThread = {
+ id: String(thread.id),
+ sessionId: String(thread.sessionId),
+ };
+ } finally {
+ await first.transport.close();
+ }
+ if (providerThread === null) {
+ throw new Error(
+ "exact-authority fixture did not return a provider thread",
+ );
+ }
- const statePath = join(
- stateDirectory,
- "control-plane",
- "control-plane-state.json",
- );
- const beforeResume = JSON.parse(await readFile(statePath, "utf8")) as {
- commands: Array<{ type: string }>;
- committedEvents: Array<{ eventType: string }>;
- };
- expect(
- beforeResume.commands.some((command) => command.type === "run.attach"),
- ).toBe(false);
- const priorResumeEvents = beforeResume.committedEvents.filter(
- (event) => event.eventType === "session.resumed",
- ).length;
- const priorSnapshots = beforeResume.commands.filter(
- (command) => command.type === "session.snapshot",
- ).length;
-
- const resumed = createCapabilityRunnerdCodexTransport({
- ...options,
- resumeProviderSession: {
- driverSessionId: providerThread.id,
- providerSessionId: providerThread.sessionId,
- },
- });
- resumed.transport.setServerRequestHandler(async () => ({
- success: true,
- contentItems: [],
- }));
- try {
- const read = await resumed.transport.request("thread/read", {});
- expect(read.thread).toMatchObject(providerThread);
- const afterResume = JSON.parse(await readFile(statePath, "utf8")) as {
- commands: Array<{ commandId: string; type: string; status: string }>;
+ const statePath = join(
+ stateDirectory,
+ "control-plane",
+ "control-plane-state.json",
+ );
+ if (extraJournalBytes > 0) {
+ const journal = await readFile(statePath, "utf8");
+ const paddedJournal = `${journal}${" ".repeat(extraJournalBytes)}`;
+ await writeFile(statePath, paddedJournal);
+ expect(Buffer.byteLength(paddedJournal)).toBeGreaterThan(2 * 1024 * 1024);
+ }
+ const beforeResume = JSON.parse(await readFile(statePath, "utf8")) as {
+ commands: Array<{ type: string }>;
committedEvents: Array<{ eventType: string }>;
};
- expect(afterResume.commands).toContainEqual(
- expect.objectContaining({
- commandId: expect.stringMatching(/^command_resume_probe_/),
- type: "runner.drain",
- status: "completed",
- }),
- );
- expect(afterResume.commands).toContainEqual(
- expect.objectContaining({
- type: "session.snapshot",
- status: "completed",
- }),
- );
expect(
- afterResume.commands.filter(
- (command) => command.type === "session.snapshot",
- ),
- ).toHaveLength(priorSnapshots + 2);
- // The authenticated snapshot above proves the live provider identity.
- // Control-first dispatch may deliver that command before the independent
- // session event is ingested. Still require exactly one durable event;
- // don't mistake an immediate file read for an event-delivery barrier.
- await vi.waitFor(async () => {
- const delivered = JSON.parse(await readFile(statePath, "utf8")) as {
+ beforeResume.commands.some((command) => command.type === "run.attach"),
+ ).toBe(false);
+ const priorResumeEvents = beforeResume.committedEvents.filter(
+ (event) => event.eventType === "session.resumed",
+ ).length;
+ const priorSnapshots = beforeResume.commands.filter(
+ (command) => command.type === "session.snapshot",
+ ).length;
+
+ const resumed = createCapabilityRunnerdCodexTransport({
+ ...options,
+ resumeProviderSession: {
+ driverSessionId: providerThread.id,
+ providerSessionId: providerThread.sessionId,
+ },
+ });
+ resumed.transport.setServerRequestHandler(async () => ({
+ success: true,
+ contentItems: [],
+ }));
+ try {
+ const read = await resumed.transport.request("thread/read", {});
+ expect(read.thread).toMatchObject(providerThread);
+ const afterResume = JSON.parse(await readFile(statePath, "utf8")) as {
+ commands: Array<{ commandId: string; type: string; status: string }>;
committedEvents: Array<{ eventType: string }>;
};
+ expect(afterResume.commands).toContainEqual(
+ expect.objectContaining({
+ commandId: expect.stringMatching(/^command_resume_probe_/),
+ type: "runner.drain",
+ status: "completed",
+ }),
+ );
+ expect(afterResume.commands).toContainEqual(
+ expect.objectContaining({
+ type: "session.snapshot",
+ status: "completed",
+ }),
+ );
expect(
- delivered.committedEvents.filter(
- (event) => event.eventType === "session.resumed",
+ afterResume.commands.filter(
+ (command) => command.type === "session.snapshot",
),
- ).toHaveLength(priorResumeEvents + 1);
- }, { timeout: 3_000, interval: 25 });
- } finally {
- await resumed.transport.close();
- await rm(stateDirectory, { recursive: true, force: true });
- }
-}, 30_000);
+ ).toHaveLength(priorSnapshots + 2);
+ // The authenticated snapshot above proves the live provider identity.
+ // Control-first dispatch may deliver that command before the independent
+ // session event is ingested. Still require exactly one durable event;
+ // don't mistake an immediate file read for an event-delivery barrier.
+ await vi.waitFor(
+ async () => {
+ const delivered = JSON.parse(await readFile(statePath, "utf8")) as {
+ committedEvents: Array<{ eventType: string }>;
+ };
+ expect(
+ delivered.committedEvents.filter(
+ (event) => event.eventType === "session.resumed",
+ ),
+ ).toHaveLength(priorResumeEvents + 1);
+ },
+ { timeout: 3_000, interval: 25 },
+ );
+ } finally {
+ await resumed.transport.close();
+ await rm(stateDirectory, { recursive: true, force: true });
+ }
+ },
+ 30_000,
+);
it("still fails closed when a real close grace period cannot fit a durable suspension round trip", async () => {
const stateDirectory = await mkdtemp(
diff --git a/tests/runner-e2e/README.md b/tests/runner-e2e/README.md
index 1fdea9c733..889d422acb 100644
--- a/tests/runner-e2e/README.md
+++ b/tests/runner-e2e/README.md
@@ -246,6 +246,16 @@ runner instance, PID, and process-start identity. Each turn is bounded to ten
minutes, the cell to thirty minutes, and cleanup explicitly deletes the
sandbox rather than waiting for Daytona's idle timeout.
+`daytona-journal-continuity` is one explicit-only native Codex cell. Select
+`daytona-journal-continuity.runner-codex.daytona.large-journal-three-turn`.
+It reuses the three-turn warm workflow with 240 separate ordinary execution-tool calls, each printing a bounded 65 KB
+synthetic sample through the real provider. Before the first browser follow-up,
+a read-only controller journal oracle requires the exact completed run's journal
+to exceed two MiB. Only byte and call counts enter evidence. No runner state or database
+is injected or modified. The usual workspace, sandbox, provider, process,
+three-run, screenshot, timeout, billing, and cleanup assertions remain required;
+`--all` excludes this stress case.
+
`daytona-git-streaming` is an explicit-only native Codex Daytona cell for
large Git filename snapshots. Run
`pnpm test:e2e:runner -- --id daytona-git-streaming.runner-codex.daytona.large-path-three-turn`.
diff --git a/tests/runner-e2e/catalog.test.ts b/tests/runner-e2e/catalog.test.ts
index 70aa2d7366..0fd65f7e9f 100644
--- a/tests/runner-e2e/catalog.test.ts
+++ b/tests/runner-e2e/catalog.test.ts
@@ -16,6 +16,7 @@ import {
runnerSuites,
runnerTasks,
daytonaWarmContinuityTask,
+ daytonaLargeJournalTask,
daytonaWarmEnvironment,
isImmutableDaytonaImage,
pendingContextIntegrityProfiles,
@@ -112,10 +113,10 @@ describe("runner E2E catalog", () => {
expect(localIntegrityTasks).toHaveLength(2);
expect(openRouterBreadthTasks).toHaveLength(3);
expect(runnerSuites.map((suite) => suite.expectedMatrixSize)).toEqual([
- 30, 3, 16, 16, 2, 8, 46, 23, 47, 20, 52, 28, 18, 6, 6, 10, 48, 16, 10, 2, 1,
+ 30, 3, 16, 16, 2, 8, 46, 23, 47, 20, 52, 28, 18, 6, 6, 10, 48, 16, 10, 2, 1, 1,
]);
- expect(validateRunnerCatalog()).toHaveLength(408);
- expect(new Set(runnerMatrix.map((entry) => entry.id)).size).toBe(408);
+ expect(validateRunnerCatalog()).toHaveLength(409);
+ expect(new Set(runnerMatrix.map((entry) => entry.id)).size).toBe(409);
expect(
runnerMatrix.filter((entry) => entry.suite.id === "core-compatibility"),
).toHaveLength(48);
@@ -227,6 +228,18 @@ describe("runner E2E catalog", () => {
).not.toBe(suiteDefinitionHash(suite));
});
+ it("keeps large-journal stress explicit-only and uses the ordinary warm workflow", () => {
+ const suite = runnerSuites.find((candidate) => candidate.id === "daytona-journal-continuity")!;
+ expect(suite.manualOnly).toBe(true);
+ expect(suite.expectedMatrixSize).toBe(1);
+ expect(suite.profiles.map((profile) => profile.id)).toEqual(["runner-codex"]);
+ expect(daytonaLargeJournalTask.flow).toBe("warm_three_turn");
+ expect(daytonaLargeJournalTask.buildPrompt("nonce")).toContain("240 separate execution-tool calls");
+ expect(daytonaLargeJournalTask.buildFollowupMessages!("nonce")).toEqual(daytonaWarmContinuityTask.buildFollowupMessages!("nonce"));
+ expect(selectRunnerExecutions(parseRunnerSelectors(["--all"]))
+ .some((cell) => cell.suite.id === suite.id)).toBe(false);
+ });
+
it("derives the qualified local native OpenCode profiles from the ranked snapshot", () => {
expect(openRouterBreadthExcludedModelIds).toEqual(["xiaomi/mimo-v2.5"]);
expect(openRouterBreadthExcludedExecutionIds).toEqual([
diff --git a/tests/runner-e2e/catalog.ts b/tests/runner-e2e/catalog.ts
index 696add96c3..5094ad13ea 100644
--- a/tests/runner-e2e/catalog.ts
+++ b/tests/runner-e2e/catalog.ts
@@ -974,6 +974,18 @@ export const daytonaWarmContinuityTask: RunnerTaskFixture = {
},
};
+export const daytonaLargeJournalTask: RunnerTaskFixture = {
+ ...daytonaWarmContinuityTask,
+ id: "large-journal-three-turn",
+ label: "Large journal three-turn workspace continuity",
+ buildTitle: (nonce) => `Runner E2E large journal continuity ${nonce}`,
+ buildPrompt: (nonce) => [
+ "First exercise ordinary execution history with 240 separate execution-tool calls. In each call, run the Python command below exactly once. Issue the calls one by one. Do not combine them into a shell loop, script, parallel wrapper, or a single tool call: each command must be a separate ordinary execution-tool invocation. Keep a count from 1 through 240. The output is synthetic fixture data and needs no analysis.",
+ `python3 -c 'print("journal-continuity-" + "x" * 65000)'`,
+ "Wait for all 240 execution-tool calls to exit successfully. Do not redirect, suppress, or pipe their stdout. Then do the workspace task below and submit its completion report.",
+ warmTurnInstructions(1, nonce),
+ ].join("\n"),
+};
export const daytonaGitStreamingTask = createGitStreamingTask(daytonaWarmContinuityTask);
const codexContinuityProfiles = runnerProfiles.filter((profile) =>
@@ -1261,6 +1273,18 @@ export const runnerSuites: readonly RunnerSuiteFixture[] = [
tasks: [daytonaWarmContinuityTask],
expectedMatrixSize: 2,
},
+ {
+ id: "daytona-journal-continuity",
+ label: "Daytona Large Journal Continuity",
+ manualOnly: true,
+ description: "Continue the same native session after separate ordinary tool invocations and their output grow its durable journal beyond 2 MiB.",
+ groups: ["daytona", "warm"],
+ profiles: codexContinuityProfiles.filter((profile) => profile.id === "runner-codex"),
+ environments: [daytonaWarmEnvironment],
+ tasks: [daytonaLargeJournalTask],
+ expectedMatrixSize: 1,
+ definitionMetadata: { version: 4, journalMinimumBytes: 2 * 1024 * 1024, toolInvocations: 240, outputBytesPerInvocation: 65020, scheduling: "explicit-only" },
+ },
{
id: "daytona-git-streaming",
label: "Daytona Git Streaming",
@@ -1417,6 +1441,7 @@ export function validateRunnerCatalog(): MatrixExecution[] {
daytonaWarmContinuityTask,
daytonaGitStreamingTask,
instructionPersistenceTask,
+ daytonaLargeJournalTask,
];
for (const [label, values] of [
["suite", runnerSuites],
diff --git a/tests/runner-e2e/journal-evidence.test.ts b/tests/runner-e2e/journal-evidence.test.ts
new file mode 100644
index 0000000000..01b57f13e2
--- /dev/null
+++ b/tests/runner-e2e/journal-evidence.test.ts
@@ -0,0 +1,61 @@
+import { mkdtemp, mkdir, rm, writeFile } from "node:fs/promises";
+import { createHash } from "node:crypto";
+import { tmpdir } from "node:os";
+import path from "node:path";
+import { describe, expect, it } from "vitest";
+import { completedJournalStimulusCalls, largeJournalEvidence } from "./journal-evidence.js";
+
+const output = `journal-continuity-${"x".repeat(65_000)}\n`;
+function call(index: number) {
+ const event = { schema: "paperclip.prp.event.v1", runId: "expected-run", sourceKind: "runner", sourceInstanceId: "runner", normalizedSessionId: "session" };
+ const payload = { schema: "paperclip.tool.execution.v1", transport: "process", operation: "execute", executionId: `exec-${index}`, name: "python3 fixture" };
+ return [
+ { ...event, eventType: "tool.execution.started", sourceSeq: index * 2, payload: { ...payload, status: "running" } },
+ { ...event, eventType: "tool.execution.completed", sourceSeq: index * 2 + 1, payload: { ...payload, status: "completed", exitCode: 0, outputBytes: Buffer.byteLength(output), outputDigest: `sha256:${createHash("sha256").update(output).digest("hex")}` } },
+ ];
+}
+
+describe("large journal boundary evidence", () => {
+ it("requires one correctly owned journal over the boundary and an independent completed-call count", async () => {
+ const root = await mkdtemp(path.join(tmpdir(), "journal-evidence-"));
+ const directory = path.join(root, "a".repeat(64), "control-plane");
+ await mkdir(directory, { recursive: true });
+ const filename = path.join(directory, "control-plane-state.json");
+ const state = { schema: "paperclip.runner.durable.control-plane-state.v1", identity: { runId: "expected-run" }, commands: [] };
+ const input = { stateRoot: root, runId: "expected-run", minimumBytes: 1024, minimumCompletedStimulusCalls: 2 };
+ try {
+ await writeFile(filename, JSON.stringify(state));
+ await expect(largeJournalEvidence(input)).rejects.toThrow("boundary not reached");
+ await writeFile(filename, JSON.stringify({ ...state, commands: [{ payload: "x".repeat(2048) }] }));
+ await expect(largeJournalEvidence(input)).rejects.toThrow("stimulus incomplete");
+ await writeFile(filename, JSON.stringify({ ...state, committedEvents: [...call(1), ...call(2)].map(event => ({ envelope: { payload: event } })) }));
+ const evidence = await largeJournalEvidence(input);
+ expect(Object.keys(evidence)).toEqual(["journalBytes", "minimumBytes", "completedStimulusCalls", "minimumCompletedStimulusCalls"]);
+ expect(evidence.completedStimulusCalls).toBe(2);
+ await expect(largeJournalEvidence({ ...input, runId: "another-run" })).rejects.toThrow("boundary not reached");
+ } finally { await rm(root, { recursive: true, force: true }); }
+ });
+
+ it("does not count repeated receipts, unmatched completion, wrong runs, failed or unrelated output", () => {
+ const pair = call(1);
+ expect(completedJournalStimulusCalls([...pair, ...pair], "expected-run")).toBe(1);
+ expect(completedJournalStimulusCalls([pair[1]], "expected-run")).toBe(0);
+ expect(completedJournalStimulusCalls(pair, "another-run")).toBe(0);
+ expect(completedJournalStimulusCalls([pair[0], { ...pair[1], payload: { ...pair[1]!.payload, exitCode: 1 } }], "expected-run")).toBe(0);
+ expect(completedJournalStimulusCalls([pair[0], { ...pair[1], payload: { ...pair[1]!.payload, outputDigest: "sha256:unrelated" } }], "expected-run")).toBe(0);
+ });
+
+ it("requires the same runner, session, execution and command with ordered source sequence", () => {
+ const [start, complete] = call(1);
+ for (const changed of [
+ { ...complete, sourceInstanceId: "another-runner" },
+ { ...complete, normalizedSessionId: "another-session" },
+ { ...complete, sourceSeq: start!.sourceSeq },
+ { ...complete, payload: { ...complete!.payload, executionId: "another-exec" } },
+ { ...complete, payload: { ...complete!.payload, name: "another-command" } },
+ { ...complete, payload: { ...complete!.payload, outputBytes: 1 } },
+ ]) {
+ expect(completedJournalStimulusCalls([start, changed], "expected-run")).toBe(0);
+ }
+ });
+});
diff --git a/tests/runner-e2e/journal-evidence.ts b/tests/runner-e2e/journal-evidence.ts
new file mode 100644
index 0000000000..1884af2086
--- /dev/null
+++ b/tests/runner-e2e/journal-evidence.ts
@@ -0,0 +1,71 @@
+import { lstat, readdir, readFile } from "node:fs/promises";
+import { createHash } from "node:crypto";
+import path from "node:path";
+// The fixture reads bounded private evidence independently of production admission.
+const MAX_JOURNAL_EVIDENCE_BYTES = 192 * 1024 * 1024;
+const STIMULUS_OUTPUT = `journal-continuity-${"x".repeat(65_000)}\n`;
+const STIMULUS_DIGEST = `sha256:${createHash("sha256").update(STIMULUS_OUTPUT).digest("hex")}`;
+const object = (value: unknown): Record<string, unknown> => value && typeof value === "object" && !Array.isArray(value) ? value as Record<string, unknown> : {};
+
+/** Count independently completed process calls, never repeated receipts or prose. */
+export function completedJournalStimulusCalls(events: unknown[], runId: string): number {
+ const starts = new Map<string, { name: unknown; sourceSeq: number }>();
+ const completed = new Set<string>();
+ const executions = events.map(object).filter(event => {
+ const payload = object(event.payload);
+ return event.schema === "paperclip.prp.event.v1" && event.runId === runId && event.sourceKind === "runner" &&
+ typeof event.sourceInstanceId === "string" && typeof event.normalizedSessionId === "string" &&
+ Number.isSafeInteger(event.sourceSeq) && Number(event.sourceSeq) > 0 && payload.schema === "paperclip.tool.execution.v1" &&
+ payload.transport === "process" && payload.operation === "execute" && typeof payload.executionId === "string" &&
+ typeof payload.name === "string";
+ });
+ const key = (event: Record<string, unknown>) => JSON.stringify([event.sourceInstanceId, event.normalizedSessionId, object(event.payload).executionId]);
+ for (const event of executions) {
+ const payload = object(event.payload);
+ if (event.eventType === "tool.execution.started" && payload.status === "running") {
+ starts.set(key(event), { name: payload.name, sourceSeq: Number(event.sourceSeq) });
+ }
+ }
+ for (const event of executions) {
+ const payload = object(event.payload);
+ const start = starts.get(key(event));
+ if (event.eventType === "tool.execution.completed" && start && start.sourceSeq < Number(event.sourceSeq) &&
+ payload.name === start.name && payload.status === "completed" && payload.exitCode === 0 &&
+ payload.outputBytes === Buffer.byteLength(STIMULUS_OUTPUT) && payload.outputDigest === STIMULUS_DIGEST) {
+ completed.add(key(event));
+ }
+ }
+ return completed.size;
+}
+
+/** Read-only boundary and execution oracle; raw journal contents stay private. */
+export async function largeJournalEvidence(input: {
+ stateRoot: string;
+ runId: string;
+ minimumBytes: number;
+ minimumCompletedStimulusCalls: number;
+}): Promise<{ journalBytes: number; minimumBytes: number; completedStimulusCalls: number; minimumCompletedStimulusCalls: number }> {
+ const matches: Array<{ bytes: number; calls: number }> = [];
+ for (const entry of await readdir(input.stateRoot, { withFileTypes: true })) {
+ if (!entry.isDirectory() || !/^[a-f0-9]{64}$/.test(entry.name)) continue;
+ const filename = path.join(input.stateRoot, entry.name, "control-plane", "control-plane-state.json");
+ const metadata = await lstat(filename).catch(() => null);
+ if (!metadata?.isFile() || metadata.size > MAX_JOURNAL_EVIDENCE_BYTES) continue;
+ const state = JSON.parse(await readFile(filename, "utf8")) as {
+ schema?: string;
+ identity?: { runId?: string };
+ committedEvents?: unknown[];
+ };
+ if (state.schema === "paperclip.runner.durable.control-plane-state.v1" && state.identity?.runId === input.runId) {
+ const events = (state.committedEvents ?? []).map(entry => object(object(entry).envelope).payload);
+ matches.push({ bytes: metadata.size, calls: completedJournalStimulusCalls(events, input.runId) });
+ }
+ }
+ if (matches.length !== 1 || matches[0]!.bytes <= input.minimumBytes) {
+ throw new Error(`Large-journal boundary not reached: expected one matching journal above ${input.minimumBytes} bytes; observed ${JSON.stringify(matches)}`);
+ }
+ if (matches[0]!.calls < input.minimumCompletedStimulusCalls) {
+ throw new Error(`Large-journal stimulus incomplete: expected at least ${input.minimumCompletedStimulusCalls} completed calls; observed ${matches[0]!.calls}`);
+ }
+ return { journalBytes: matches[0]!.bytes, minimumBytes: input.minimumBytes, completedStimulusCalls: matches[0]!.calls, minimumCompletedStimulusCalls: input.minimumCompletedStimulusCalls };
+}
diff --git a/tests/runner-e2e/runner.spec.ts b/tests/runner-e2e/runner.spec.ts
index fde941160d..0eeea60010 100644
--- a/tests/runner-e2e/runner.spec.ts
+++ b/tests/runner-e2e/runner.spec.ts
@@ -3,6 +3,7 @@ import { completionQualityControls, completionQualityStatus, judgeCompletionQual
import { completionDelivery, type CompletionObservation } from "./completion-updates.js";
import { runInstructionPersistenceFlow } from "./instruction-persistence.js";
import { gradeApiResponsePaging, readResponseProof, responseEvidenceDescription } from "./api-response-reading.js";
+import { largeJournalEvidence } from "./journal-evidence.js";
import { observeBrowserBootstrap } from "./browser-bootstrap-diagnostics.js";
import { runAccountingFlow } from "./accounting-flow.js";
import type { Issue } from "../../packages/shared/src/types/issue.js";
@@ -1626,7 +1627,19 @@ for (const execution of executions) {
`Warm turn ${completedTurn} replaced its Daytona sandbox`,
);
}
+ const journalEvidence = execution.suite.id === "daytona-journal-continuity" && completedTurn === 1
+ ? await largeJournalEvidence({
+ stateRoot: path.join(process.env.PAPERCLIP_HOME!, "instances", process.env.PAPERCLIP_INSTANCE_ID!, "runtime", "paperclip-runner", "durable-sessions"),
+ runId: chronologicalRuns.at(-1)!.id,
+ minimumBytes: 2 * 1024 * 1024,
+ minimumCompletedStimulusCalls: 240,
+ })
+ : undefined;
+ if (journalEvidence) {
+ await writeSanitizedJson(snapshotsDir, "large-journal-boundary.json", journalEvidence, secrets);
+ }
turnEvidence.push({
+ ...(journalEvidence ? { journalEvidence } : {}),
turn: completedTurn,
issue: waitingState.currentIssue,
run: chronologicalRuns.at(-1),