From 6c70800a66bdbcdef03a57452d923f6e03a4b63b Mon Sep 17 00:00:00 2001 From: Dotta Date: Wed, 30 Sep 2026 16:50:51 -0500 Subject: [PATCH] fix(runner-e2e): reserve remote runtime readiness budget Include lease revalidation and the readiness RPC in the existing setup reserve, so late lease admission cannot consume the observation window. Keep the authored outer deadline, single installation, armed baseline action gate, and teardown reserve unchanged. Co-Authored-By: Paperclip --- tests/runner-e2e/README.md | 6 ++- .../remote-native-bootstrap.test.ts | 40 +++++++++----- .../runner-e2e/remote-native-fixtures.test.ts | 53 +++++++++++++++---- tests/runner-e2e/remote-native-fixtures.ts | 14 +++-- 4 files changed, 85 insertions(+), 28 deletions(-) diff --git a/tests/runner-e2e/README.md b/tests/runner-e2e/README.md index 911c78a6015..b62ca6d9915 100644 --- a/tests/runner-e2e/README.md +++ b/tests/runner-e2e/README.md @@ -1373,8 +1373,10 @@ still fail. SDK 0.203.0, immutable image and executable digests, public run/leas ownership, sandbox labels and workspace sentinel are verified before execution. Bootstrap admission uses the existing authored case deadline, including cold -snapshot provisioning, with the fixture’s existing 42-second installation and -teardown reserve subtracted before admission. It does not impose a separate +snapshot provisioning, with a 64-second minimum setup reserve subtracted before +admission: 10 seconds for lease revalidation, 12 for the runtime-ready RPC, +27 for installation, and 15 for teardown. A lease discovered later is not admitted +with only installation/teardown time left. This does not impose a separate 20-second lease deadline or extend the case budget. After lease admission, a read-only probe waits for the exact pinned runner process and runtime directory before installing the observer once. This uses diff --git a/tests/runner-e2e/remote-native-bootstrap.test.ts b/tests/runner-e2e/remote-native-bootstrap.test.ts index c3d68c4127c..28e033b13e9 100644 --- a/tests/runner-e2e/remote-native-bootstrap.test.ts +++ b/tests/runner-e2e/remote-native-bootstrap.test.ts @@ -3,11 +3,11 @@ import { afterEach, expect, it, vi } from "vitest"; import { classifyFailure } from "./failure-classifier.js"; import { ObservedStateTimeout, RemoteAdmissionReadError, RunnerApi, RunnerApiHttpError } from "./api.js"; import { createRemoteNativeBootstrap } from "./remote-native-bootstrap.js"; -import type { RemoteFixtureApi, RemoteNativeFixture } from "./remote-native-fixtures.js"; +import { REMOTE_FIXTURE_MIN_SETUP_BUDGET_MS, type RemoteFixtureApi, type RemoteNativeFixture } from "./remote-native-fixtures.js"; afterEach(() => { vi.useRealTimers(); vi.unstubAllEnvs(); }); -function harness(timeoutMs = 60_000) { +function harness(timeoutMs = REMOTE_FIXTURE_MIN_SETUP_BUDGET_MS + 18_000) { const order: string[] = []; const issue = { id: "issue", companyId: "company", assigneeAgentId: "agent" }; const run = { id: "run", companyId: "company", agentId: "agent", status: "running", executionStage: "preparing" }; @@ -32,6 +32,22 @@ function harness(timeoutMs = 60_000) { return { bootstrap, input, bind, api, issue, run, leases, fixture, request, order }; } +it("keeps the complete readiness/install reserve when a lease arrives at the admission boundary", async () => { + vi.useFakeTimers(); vi.setSystemTime(0); + const h = harness(REMOTE_FIXTURE_MIN_SETUP_BUDGET_MS + 1000); h.bootstrap.prompt("late-lease"); + const lease = h.leases.pop()!; + let remainingAtBind = 0; + h.bind.mockImplementation(async () => { remainingAtBind = h.input.deadlineAt - Date.now(); return h.fixture; }); + const pending = h.bootstrap.bindAndRelease(h.request); + await vi.advanceTimersByTimeAsync(800); + expect(h.bind).not.toHaveBeenCalled(); expect(h.fixture.publishAction).not.toHaveBeenCalled(); + h.leases.push(lease); await vi.advanceTimersByTimeAsync(100); + await expect(pending).resolves.toBe(h.fixture); + expect(remainingAtBind).toBeGreaterThanOrEqual(REMOTE_FIXTURE_MIN_SETUP_BUDGET_MS); + expect(h.bind).toHaveBeenCalledExactlyOnceWith(expect.objectContaining({ deadlineAt: h.input.deadlineAt })); + expect(h.order.indexOf("baseline")).toBeLessThan(h.order.indexOf("publish")); +}); + it("withholds actual work until exact run admission, armed observer and awaited baseline", async () => { const h = harness(); const prompt = h.bootstrap.prompt("nonce"); expect(prompt).not.toContain("PRIVATE ACTUAL ACTION"); @@ -120,7 +136,7 @@ it("admits a cold building_snapshot lease after 20 seconds within the unchanged it.each(["failed", "cancelled", "succeeded"])("stops waiting immediately when provisioning run becomes %s", async status => { vi.useFakeTimers(); vi.setSystemTime(0); - const h = harness(60_000); h.bootstrap.prompt("terminal"); h.leases.length = 0; + const h = harness(REMOTE_FIXTURE_MIN_SETUP_BUDGET_MS + 18_000); h.bootstrap.prompt("terminal"); h.leases.length = 0; const delivery = expect(h.bootstrap.bindAndRelease(h.request)).rejects.toThrow("stopped before observer setup"); await vi.advanceTimersByTimeAsync(1000); h.run.status = status; await vi.advanceTimersByTimeAsync(100); await delivery; @@ -140,7 +156,7 @@ it("rechecks run ownership while waiting for the lease", async () => { it.each(["foreign-run", "foreign-issue", "inactive", "missing-provider"])("never admits %s and reserves setup time within the authored deadline with bounded state", async variant => { vi.useFakeTimers(); vi.setSystemTime(0); - const h = harness(43_000); h.bootstrap.prompt("timeout"); + const h = harness(REMOTE_FIXTURE_MIN_SETUP_BUDGET_MS + 1000); h.bootstrap.prompt("timeout"); if (variant === "foreign-run") h.leases[0]!.heartbeatRunId = "foreign"; if (variant === "foreign-issue") h.leases[0]!.issueId = "foreign"; if (variant === "inactive") h.leases[0]!.status = "released"; @@ -190,7 +206,7 @@ it.each(["terminal", "run-owner", "issue-owner"])("does not lose a successful %s it.each(["/api/issues/issue", "/api/heartbeat-runs/run", "/api/environments/env/leases"])("never admits while %s cannot be read", async failedPath => { vi.useFakeTimers(); vi.setSystemTime(0); - const h = harness(43_000); h.bootstrap.prompt("missing-read"); + const h = harness(REMOTE_FIXTURE_MIN_SETUP_BUDGET_MS + 1000); h.bootstrap.prompt("missing-read"); const original = h.api.get.getMockImplementation()!; h.api.get.mockImplementation(async path => { if (path === failedPath) throw new Error("PRIVATE API ERROR"); return original(path); }); const delivery = expect(h.bootstrap.bindAndRelease(h.request)).rejects.toThrow("diagnostics withheld"); @@ -211,7 +227,7 @@ it("allows a transient lease read failure to recover without losing the setup re it("rejects a lease read completing inside the final setup reserve and saves startup evidence", async () => { vi.useFakeTimers(); vi.setSystemTime(0); - const h = harness(43_000); h.bootstrap.prompt("late"); + const h = harness(REMOTE_FIXTURE_MIN_SETUP_BUDGET_MS + 1000); h.bootstrap.prompt("late"); const original = h.api.get.getMockImplementation()!; h.api.get.mockImplementation(async path => { if (path.endsWith("/leases")) await new Promise(resolve => setTimeout(resolve, 1100)); @@ -260,7 +276,7 @@ it.each(["terminal", "run-owner", "issue-owner"])("rejects %s immediately with a it("retains persistent 503 classification without its raw cause", async () => { vi.useFakeTimers(); vi.setSystemTime(0); - const h = harness(43_000); h.bootstrap.prompt("503"); + const h = harness(REMOTE_FIXTURE_MIN_SETUP_BUDGET_MS + 1000); h.bootstrap.prompt("503"); const cause = new RunnerApiHttpError(503, "GET /api/environments/env/leases returned 503: PRIVATE BODY"); const original = h.api.get.getMockImplementation()!; h.api.get.mockImplementation(async path => { if (path.endsWith("/leases")) throw cause; return original(path); }); @@ -276,7 +292,7 @@ it("retains persistent 503 classification without its raw cause", async () => { it.each([true, false])("clears a recovered 503 cause before %s admission or observed-state timeout", async admits => { vi.useFakeTimers(); vi.setSystemTime(0); - const h = harness(43_000); h.bootstrap.prompt("503-recovery"); + const h = harness(REMOTE_FIXTURE_MIN_SETUP_BUDGET_MS + 1000); h.bootstrap.prompt("503-recovery"); const original = h.api.get.getMockImplementation()!; let failed = false; h.api.get.mockImplementation(async path => { if (path.endsWith("/leases")) { @@ -293,7 +309,7 @@ it.each([true, false])("clears a recovered 503 cause before %s admission or obse it("bounds an unresponsive read at admission without launching replacement reads", async () => { vi.useFakeTimers(); vi.setSystemTime(0); - const h = harness(43_000); h.bootstrap.prompt("hung"); + const h = harness(REMOTE_FIXTURE_MIN_SETUP_BUDGET_MS + 1000); h.bootstrap.prompt("hung"); const original = h.api.get.getMockImplementation()!; h.api.get.mockImplementation(async path => path.endsWith("/leases") ? new Promise(() => {}) : original(path)); const delivery = h.bootstrap.bindAndRelease(h.request).catch(error => error); @@ -316,7 +332,7 @@ it.each([ ["unknown object", { message: "PRIVATE", status: 503 }, "candidate_failure"], ])("normalizes %s rejection without exposing transport diagnostics", async (_label, rejected, failureClass) => { vi.useFakeTimers(); vi.setSystemTime(0); - const h = harness(43_000); h.bootstrap.prompt("safe-errors"); + const h = harness(REMOTE_FIXTURE_MIN_SETUP_BUDGET_MS + 1000); h.bootstrap.prompt("safe-errors"); const original = h.api.get.getMockImplementation()!; h.api.get.mockImplementation(async path => { if (path.endsWith("/leases")) throw rejected; return original(path); }); const delivery = h.bootstrap.bindAndRelease(h.request).catch(error => error); @@ -335,7 +351,7 @@ it.each([[503, "transient_infrastructure"], [403, "permanent_infrastructure"], [ "normalizes actual RunnerApi HTTP %s status independently of its private body", async (status, failureClass) => { vi.useFakeTimers(); vi.setSystemTime(0); vi.stubEnv("PAPERCLIP_RUNNER_E2E_PORT", "3100"); - const h = harness(43_000); h.bootstrap.prompt("actual-api"); + const h = harness(REMOTE_FIXTURE_MIN_SETUP_BUDGET_MS + 1000); h.bootstrap.prompt("actual-api"); const original = h.api.get.getMockImplementation()!; const secret = "PRIVATE body: forbidden secret plaintext 503 timeout socket hang up ".repeat(10_000); const request = { get: vi.fn(async (path: string) => ({ @@ -364,7 +380,7 @@ it.each([ ["leases", ["PRIVATE"]], ["leases", [[{}]]], ["leases", undefined], ])("rejects malformed successful %s JSON without an unhandled continuation", async (endpoint, value) => { vi.useFakeTimers(); vi.setSystemTime(0); - const h = harness(43_000); h.bootstrap.prompt("malformed"); + const h = harness(REMOTE_FIXTURE_MIN_SETUP_BUDGET_MS + 1000); h.bootstrap.prompt("malformed"); const original = h.api.get.getMockImplementation()!; const path = endpoint === "issue" ? "/api/issues/issue" : endpoint === "run" ? "/api/heartbeat-runs/run" : "/api/environments/env/leases"; h.api.get.mockImplementation(async requested => requested === path ? value as never : original(requested)); diff --git a/tests/runner-e2e/remote-native-fixtures.test.ts b/tests/runner-e2e/remote-native-fixtures.test.ts index 5e94e5d9587..b9733b4c3d4 100644 --- a/tests/runner-e2e/remote-native-fixtures.test.ts +++ b/tests/runner-e2e/remote-native-fixtures.test.ts @@ -7,7 +7,7 @@ import { tmpdir } from "node:os"; import { join } from "node:path"; import { Script } from "node:vm"; import { describe, expect, it, vi } from "vitest"; -import { bindRemoteNativeFixture, createRemoteTargetWatch, isRemoteRunRoot, parseRemoteProcStat, remoteNativeFixtureDiagnostics, type RemoteNativeFixtureOptions, type RemoteNativeSnapshot } from "./remote-native-fixtures.js"; +import { REMOTE_FIXTURE_MIN_SETUP_BUDGET_MS, bindRemoteNativeFixture, createRemoteTargetWatch, isRemoteRunRoot, parseRemoteProcStat, remoteNativeFixtureDiagnostics, type RemoteNativeFixtureOptions, type RemoteNativeSnapshot } from "./remote-native-fixtures.js"; import { createRemoteNativeBootstrap } from "./remote-native-bootstrap.js"; @@ -47,7 +47,7 @@ function harness() { }); const get = vi.fn(async () => ({ id: "sandbox", labels, process: { executeCommand } })); const apiGet = vi.fn(async (path: string) => path.includes("/environments/") ? [structuredClone(lease)] : structuredClone(lease)); - const options: RemoteNativeFixtureOptions = { api: { get: apiGet as RemoteNativeFixtureOptions["api"]["get"] }, daytona: { get }, sdkVersion: "0.203.0", authority, nodeSha256: hash("node"), runnerdSha256: hash("runnerd"), targets: ["result.txt"], actionFile: "action.txt", deadlineAt: Date.now() + 60_000 }; + const options: RemoteNativeFixtureOptions = { api: { get: apiGet as RemoteNativeFixtureOptions["api"]["get"] }, daytona: { get }, sdkVersion: "0.203.0", authority, nodeSha256: hash("node"), runnerdSha256: hash("runnerd"), targets: ["result.txt"], actionFile: "action.txt", deadlineAt: Date.now() + REMOTE_FIXTURE_MIN_SETUP_BUDGET_MS + 18_000 }; return { options, current, labels, calls, executeCommand, apiGet, get, resolveTerminal, rejectTerminal, setLease(value: Record) { lease = value; }, lease: () => lease, override(fn: typeof override) { override = fn; } }; } @@ -93,12 +93,45 @@ describe("remote native lease admission", () => { await fixture.close(); } finally { vi.useRealTimers(); } }); + it("reserves readiness after a late lease with delayed admission and installation", async () => { + vi.useFakeTimers(); vi.setSystemTime(1_000_000); + try { + const h = harness(); h.options.deadlineAt = Date.now() + REMOTE_FIXTURE_MIN_SETUP_BUDGET_MS; + const initialGet = h.get.getMockImplementation()!; + h.get.mockImplementationOnce(async () => { await new Promise(resolve => setTimeout(resolve, 9000)); return initialGet(); }); + h.override(r => { + if (r.op === "runtime-ready" || r.op === "install") return new Promise(resolve => setTimeout(() => resolve({ + exitCode: 0, result: JSON.stringify({ ok: true, result: r.op === "runtime-ready" ? readiness() : snapshot() }), + }), r.op === "runtime-ready" ? 9000 : 24_000)); + return undefined; + }); + const pending = bindRemoteNativeFixture(h.options); + // Retain a rejected setup for the assertion below while fake clocks advance. + void pending.catch(() => {}); + await vi.advanceTimersByTimeAsync(8999); expect(h.calls).toHaveLength(0); + await vi.advanceTimersByTimeAsync(9001); expect(h.calls.map(c => c.request.op)).toEqual(["runtime-ready", "install"]); + expect(h.calls.find(c => c.request.op === "install")!.timeout).toBe(25); + await vi.advanceTimersByTimeAsync(24_000); const fixture = await pending; + expect(h.calls.map(c => c.request.op)).toEqual(["runtime-ready", "install", "wait", "arm"]); + expect(h.options.deadlineAt - Date.now()).toBe(22_000); + await fixture.publishAction("action.txt", "task"); expect(h.calls.at(-1)!.request.op).toBe("publish"); + await fixture.close(); + } finally { vi.useRealTimers(); } + }); + it.each([42_000, 43_000, REMOTE_FIXTURE_MIN_SETUP_BUDGET_MS - 1])("rejects a %ims late setup window before remote work", async budget => { + vi.useFakeTimers(); vi.setSystemTime(1_000_000); + try { + const h = harness(); h.options.deadlineAt = Date.now() + budget; + await expect(bindRemoteNativeFixture(h.options)).rejects.toThrow("insufficient_setup_budget"); + expect(h.apiGet).not.toHaveBeenCalled(); expect(h.get).not.toHaveBeenCalled(); expect(h.calls).toHaveLength(0); + } finally { vi.useRealTimers(); } + }); it("never installs on a missing runtime and reserves installation and teardown inside the original deadline", async () => { vi.useFakeTimers(); vi.setSystemTime(1_000_000); try { const h = harness(); h.override(r => r.op === "runtime-ready" ? { exitCode: 0, result: '{"ok":true,"result":{"ready":false}}' } : undefined); const outcome = bindRemoteNativeFixture(h.options).catch(error => error); - await vi.advanceTimersByTimeAsync(18_000); + await vi.advanceTimersByTimeAsync(h.options.deadlineAt - 42_000 - Date.now()); expect((await outcome).message).toContain("readiness_deadline"); expect(h.calls.every(c => c.request.op === "runtime-ready")).toBe(true); expect(Date.now()).toBe(h.options.deadlineAt - 42_000); @@ -171,7 +204,7 @@ describe("remote native lease admission", () => { it("arms before publish, binds long receipt before teardown and preserves exact final bytes", async () => { const h = harness(), f = await bindRemoteNativeFixture(h.options); expect(h.calls.map(c => c.request.op)).toEqual(["runtime-ready", "install", "wait", "arm"]); expect(f.baseline.processes.live).toEqual([21]); - expect(h.calls[2]!.timeout).toBeLessThanOrEqual(45); expect(h.calls[2]!.request.timeoutMs).toBe(h.calls[2]!.timeout! * 1000); + expect(h.calls[2]!.timeout).toBeLessThanOrEqual(67); expect(h.calls[2]!.request.timeoutMs).toBe(h.calls[2]!.timeout! * 1000); await f.publishAction("action.txt", "write only result.txt"); await expect(f.publishAction("action.txt", "retry")).rejects.toThrow("publish_bound"); const bytes = "\nUnicode 🪴 literal \\n\n"; @@ -247,11 +280,11 @@ describe("cell deadline and cleanup bounds", () => { const h = harness(), f = await bindRemoteNativeFixture(h.options); await f.publishAction("action.txt", "task"); const install = h.calls.find(c => c.request.op === "install")!, wait = h.calls.find(c => c.request.op === "wait")!; - expect(wait.timeout).toBe(45); expect(wait.request.timeoutMs).toBe(45_000); - expect(install.request.config.observerTtlMs).toBe(45_000); expect(install.timeout).toBe(25); + expect(wait.timeout).toBe(67); expect(wait.request.timeoutMs).toBe(67_000); + expect(install.request.config.observerTtlMs).toBe(67_000); expect(install.timeout).toBe(25); let settled = false; const result = f.finish().then(() => { settled = true; return "unexpected pass"; }, error => { settled = true; return error.message; }); - await vi.advanceTimersByTimeAsync(44_999); expect(settled).toBe(false); + await vi.advanceTimersByTimeAsync(66_999); expect(settled).toBe(false); await vi.advanceTimersByTimeAsync(1); expect(await result).toContain("deadline"); expect(Date.now()).toBe(h.options.deadlineAt - 15_000); h.rejectTerminal(new Error("late SDK close after host deadline")); await Promise.resolve(); @@ -262,7 +295,7 @@ describe("cell deadline and cleanup bounds", () => { vi.useFakeTimers(); vi.setSystemTime(1_000_000); try { const h = harness(), f = await bindRemoteNativeFixture(h.options); - await vi.advanceTimersByTimeAsync(42_000); + await vi.advanceTimersByTimeAsync(64_000); await f.snapshot("late-but-bounded"); const call = h.calls.at(-1)!; expect(call.timeout).toBe(3); expect(call.request.timeoutMs).toBe(3000); await vi.advanceTimersByTimeAsync(3000); @@ -273,7 +306,7 @@ describe("cell deadline and cleanup bounds", () => { it("bounds cleanup after cell expiry and rejects finish immediately after explicit close", async () => { vi.useFakeTimers(); vi.setSystemTime(1_000_000); try { - const h = harness(), f = await bindRemoteNativeFixture(h.options); await vi.advanceTimersByTimeAsync(60_000); + const h = harness(), f = await bindRemoteNativeFixture(h.options); await vi.advanceTimersByTimeAsync(82_000); h.override(r => r.op === "close" ? new Promise(() => {}) : undefined); const close = f.close().then(() => "unexpected", error => error.message); await vi.advanceTimersByTimeAsync(9999); expect(h.calls.at(-1)!.request.timeoutMs).toBe(10_000); @@ -461,7 +494,7 @@ describe("actual generated observer state machine", () => { return {exitCode:0,result:JSON.stringify({ok:true,result:request.op==='close'?{closed:true}:{}})}; } } }; try { await bindRemoteNativeFixture({ authority: ${JSON.stringify(authority)}, api:{get:async p=>p.includes('/environments/')?[lease]:lease}, daytona:{get:async()=>sandbox}, - sdkVersion:'0.203.0',nodeSha256:${JSON.stringify(hash("node"))},runnerdSha256:${JSON.stringify(hash("runnerd"))},targets:['result.txt'],actionFile:'action.txt',deadlineAt:Date.now()+60000 }); } catch {} + sdkVersion:'0.203.0',nodeSha256:${JSON.stringify(hash("node"))},runnerdSha256:${JSON.stringify(hash("runnerd"))},targets:['result.txt'],actionFile:'action.txt',deadlineAt:Date.now()+82000 }); } catch {} if(!programs) throw Error('No captured generated programs'); process.stdout.write(JSON.stringify(programs)); `; diff --git a/tests/runner-e2e/remote-native-fixtures.ts b/tests/runner-e2e/remote-native-fixtures.ts index 47b4685c714..924e7a9682a 100644 --- a/tests/runner-e2e/remote-native-fixtures.ts +++ b/tests/runner-e2e/remote-native-fixtures.ts @@ -6,7 +6,13 @@ export const REMOTE_FIXTURE_DAYTONA_SDK_VERSION = "0.203.0"; const NODE = "/opt/paperclip-runner/provider-pack/node_modules/node/bin/node"; const MAX_OUTPUT = 256 * 1024; const TEARDOWN_RESERVE_MS = 15_000; -export const REMOTE_FIXTURE_MIN_SETUP_BUDGET_MS = 27_000 + TEARDOWN_RESERVE_MS; +const LEASE_READMISSION_BUDGET_MS = 10_000; +const RUNTIME_READY_BUDGET_MS = 12_000; +const INSTALL_BUDGET_MS = 27_000; +// Lease activation can arrive late. Reserve each pre-install operation as well +// as installation and teardown; the caller subtracts this from the same deadline. +export const REMOTE_FIXTURE_MIN_SETUP_BUDGET_MS = LEASE_READMISSION_BUDGET_MS + + RUNTIME_READY_BUDGET_MS + INSTALL_BUDGET_MS + TEARDOWN_RESERVE_MS; const CLOSE_GRACE_MS = 10_000; // createRunnerdBackend stages its verified executable, pack symlink, mutable // sessions, homes and injected context beneath this exact path. Qualification @@ -331,7 +337,7 @@ export async function bindRemoteNativeFixture(options: RemoteNativeFixtureOption } async function rpc(request: Record, admitted?: Awaited>, deadlineAt = receiptDeadlineAt) { const available = request.op === "close" ? CLOSE_GRACE_MS : deadlineAt - Date.now(); - const cap = request.op === "install" ? 27_000 : request.op === "wait" ? 300_000 : 12_000; + const cap = request.op === "install" ? INSTALL_BUDGET_MS : request.op === "wait" ? 300_000 : RUNTIME_READY_BUDGET_MS; const budgetMs = Math.floor(Math.min(available, cap) / 1000) * 1000; fail(budgetMs >= 1000, "receipt_deadline"); if (request.op === "install") fail(budgetMs >= 25_000, "insufficient_setup_budget"); @@ -365,13 +371,13 @@ export async function bindRemoteNativeFixture(options: RemoteNativeFixtureOption return parsed.result; }, budgetMs); } - const sandbox = await bounded(admittedSandbox, Math.min(10_000, receiptDeadlineAt - Date.now())); + const sandbox = await bounded(admittedSandbox, Math.min(LEASE_READMISSION_BUDGET_MS, receiptDeadlineAt - Date.now())); const names = [...targets, ...(options.crossRoot ? ["@cross-root"] : [])]; const config = { root, nonce, binding, sentinel, targets, actionFile, crossRoot: options.crossRoot, runtimeRelative: RUNTIME_RELATIVE, runnerdSha256: options.runnerdSha256 }; // Lease activation precedes runner artifact staging. Observe the exact pinned // run root before spending the single installation budget. No observer or // action exists during this polling phase, and failures are never retried. - const readyDeadline = receiptDeadlineAt - 27_000; + const readyDeadline = receiptDeadlineAt - INSTALL_BUDGET_MS; let expectedRuntime: Record; while (true) { if (readyDeadline - Date.now() < 1000) throw new RemoteFixtureError("remote_native_fixture:readiness_deadline", { phase: "runtime-ready", code: "readiness_deadline" });