From 0065d06474ddc3245d8fee83bf3fbc108c9a0165 Mon Sep 17 00:00:00 2001 From: Dotta Date: Tue, 13 Oct 2026 12:38:48 -0500 Subject: [PATCH] Bound the existing Codex onboarding eval before task admission Co-Authored-By: Paperclip --- doc/plans/2026-10-06-default-agent-runner.md | 6 ++ maps/agent-access-map/onboarding.md | 3 + maps/feature-map/onboarding.md | 4 + tests/runner-e2e/first-task-fixtures.ts | 45 +++++++- tests/runner-e2e/first-task-flow.ts | 13 ++- tests/runner-e2e/first-task.test.ts | 106 +++++++++++++++++++ 6 files changed, 173 insertions(+), 4 deletions(-) diff --git a/doc/plans/2026-10-06-default-agent-runner.md b/doc/plans/2026-10-06-default-agent-runner.md index 335498e4ac7..c9e59c4dc64 100644 --- a/doc/plans/2026-10-06-default-agent-runner.md +++ b/doc/plans/2026-10-06-default-agent-runner.md @@ -1687,3 +1687,9 @@ The frozen30bc candidate passes all current-head required CI and fresh5/5 review The correction skips project instruction discovery only in the new empty setup workspace through the supported trusted Codex configuration. It retains the generated security arguments, read-only permission profile, approval-never, no dynamic tools, existing bounded hello turn and teardown deadlines. Ordinary task instruction discovery and saved agent configurations remain unchanged. Pinned official Codex0.160 source confirms the zero instruction limit precedes filesystem probes. Eight inert baseline failures become23 passing source/cleanup neighbors; direct runner/server TypeScript and maps pass. This does not establish hosted treatment. The existing managed first-task fixture now snapshots and restores its prior instance default and managed-only setting before deletion, including lost setup responses. Unconfirmed default restoration blocks deletion and remains red; other restoration/deletion errors remain inspectable and retry only outstanding cleanup. Three reproduced baseline failures become129 passing first-task controls, with direct E2E TypeScript passing. Independent source review finds no actionable runtime/permission P1/P2; the required source-comment cleanup is applied. Final source needs fresh CI/review, package artifacts and successful ordinary Mac/managed journeys before normal merge. The one owned Core preview deployment for30bc completes through its existing exact-source check/deploy path; actual readiness is independently checked next. No fleet default is changed. + +Corrected product source ca31623d36a3d63204077e2e951ff9cdcf2664cf passes all48 ordinary hosted CI jobs, required verify/E2E and fresh5/5 review with26 resolved threads. Its hosted package artifact11834160973 has verified ZIP digest d5d60bf5056f5573461f8d4bd873da78a0204c7f7295d03d5aa7234e55d4af69. The second isolated Mac consumer verifies all18 tarballs, no bundled Codex, official npm Codex0.160, all four daemon bindings and zero-turn native startup/cleanup. Normal install hooks include third-party optional C++ addons; no Paperclip runner/Cargo/Rust/Docker source build occurs locally. The source-bound preview completes one-target deployment38438245490 to the existing pinned QA stack, without default promotion; independent result admission remains separate. + +Before paid cell38435063658 entered its matrix job, an admission audit found that ordinary onboarding timeout0 and agent concurrency20 did not satisfy this campaign's retained180-second/single-run bounds. Cancelled the campaign before its live cell started; image/build costs remain unknown and held. Extend the existing first-task fixture with a normal operator configuration PATCH and independent read-back before Get started. Only the timeout/concurrency bounds may change; runner/account/model/environment/permissions remain the wizard's original selection. This is a fixture correction, not a production default or API change. Its first iteration passes149 controls but independent review identifies the concurrency gap. The final combined bound reproduces three functional failures with the previous helper, then passes153 controls and direct E2E TypeScript. Independent review confirms that the timeout reaches the native turn deadline and the queue uses the saved single-run cap; exact source review closes before publication or further live eval admission. No failing or cancelled attempt is relabeled as passed. + +The owned local3136 server is updated from30bc to literal ca316 hosted packages after an idle snapshot and stopped-data/home backup. All existing full execution configurations and recorded run projections match before/after, with no provider tasks during upgrade. The fresh Mac company's saved draft resumes with its agent name retained. Ordinary OpenAI API-key Connect creates native Codex with gpt-5.6-sol without a runner override; only the existing QA timeout/concurrency settings are then bounded before Get started. Actual useful task/artifact/follow-up proof is still pending. The staging immutable QA environment is selected temporarily as the instance default, with the prior Paperclip Computer value recorded for restoration. Its normal server credential fallback has not yet been verified. No direct provider-key extraction or production rollout is attempted. diff --git a/maps/agent-access-map/onboarding.md b/maps/agent-access-map/onboarding.md index 23fa9610253..485350eacbf 100644 --- a/maps/agent-access-map/onboarding.md +++ b/maps/agent-access-map/onboarding.md @@ -168,6 +168,9 @@ remaining operations before qualifying the whole capability. Gaps: Task creation is agent-accessible where permitted; scheduling/readiness does not follow from successful creation. +The Codex first-task fixture's operator cost guard uses the existing board +agent-configuration PATCH before admitting work. This is not evidence of agent +permission to update its runtime; the listed agent-context checks remain not-run. ## `resume` diff --git a/maps/feature-map/onboarding.md b/maps/feature-map/onboarding.md index e2782e56452..b6fd3ccc692 100644 --- a/maps/feature-map/onboarding.md +++ b/maps/feature-map/onboarding.md @@ -56,6 +56,10 @@ also permits Legacy. Do not switch runners after onboarding when claiming proof of that default. Test the selected runtime and account, then complete a bounded useful task and follow-up with an independently checked file artifact. Saved execution configuration and recorded run identity must match after reload. +The Codex first-task eval applies operator QA bounds before Get started through +the existing agent configuration API. It verifies that only timeout and +concurrency change; automatic runner, account and environment choices remain. +These campaign bounds are separate from production creation defaults. Use [runner validation](./runs-adapters.md#adapter-setup) and [environment qualification](./execution-environments.md#environment-settings) for the prerequisites; a successful login alone is insufficient. diff --git a/tests/runner-e2e/first-task-fixtures.ts b/tests/runner-e2e/first-task-fixtures.ts index dfa8e5ab2e5..45f1d39df68 100644 --- a/tests/runner-e2e/first-task-fixtures.ts +++ b/tests/runner-e2e/first-task-fixtures.ts @@ -1,4 +1,5 @@ import { normalizePaperclipOperationalSkillPreference } from "../../packages/adapter-utils/src/server-utils.js"; +import { isDeepStrictEqual } from "node:util"; import type { RunnerApi } from "./api.js"; import { deleteDaytonaEnvironment, installFixtureDaytonaProvider, type LiveFixtureValues } from "./live-fixtures.js"; import { isImmutableDaytonaImage } from "./catalog.js"; @@ -9,6 +10,48 @@ export function isManagedFirstTask(execution: Pick): bool return execution.id === MANAGED_FIRST_TASK_CELL; } +interface FirstTaskRuntimeBound { + timeoutSec: 180; + maxConcurrentRuns: 1; + before: Record; + after: Record; +} + +export type FirstTaskFixtureValues = LiveFixtureValues & { + onboardingRuntimeBound?: FirstTaskRuntimeBound; +}; + +export async function startFirstTaskWithRuntimeBound(input: { + api: Pick; + execution: MatrixExecution; + agent: Record; + observe: (bound: FirstTaskRuntimeBound) => void; + start: () => Promise; +}): Promise { + if (input.execution.profile.id === "runner-codex") { + const snapshot = (agent: Record) => structuredClone(Object.fromEntries([ + "id", "companyId", "adapterType", "adapterConfig", "runtimeConfig", "permissions", "defaultEnvironmentId", "budgetMonthlyCents", "metadata", + ].map(key => [key, agent?.[key]]))) as Record; + const before = snapshot(input.agent); + if (!before.id || !before.companyId || before.adapterType !== "paperclip_runner" || before.adapterConfig?.provider !== "codex") { + throw new Error("First-task runtime bound requires the wizard's original native Codex selection"); + } + const agentPath = `/api/agents/${encodeURIComponent(before.id)}`; + if (!isDeepStrictEqual(snapshot(await input.api.get(agentPath)), before)) { + throw new Error("The automatic wizard configuration changed before the first-task runtime bound"); + } + const runtimeConfig = { ...before.runtimeConfig, heartbeat: { ...before.runtimeConfig?.heartbeat, maxConcurrentRuns: 1 } }; + await input.api.patch(agentPath, { adapterConfig: { timeoutSec: 180 }, runtimeConfig }); + const after = snapshot(await input.api.get(agentPath)); + const expected = { ...before, adapterConfig: { ...before.adapterConfig, timeoutSec: 180 }, runtimeConfig }; + if (!isDeepStrictEqual(after, expected)) { + throw new Error("The first-task runtime bound was not confirmed with the original execution and account settings"); + } + input.observe({ timeoutSec: 180, maxConcurrentRuns: 1, before, after }); + } + await input.start(); +} + export async function provisionFirstTaskFixtures(input: { api: Pick & Partial>; execution: MatrixExecution; @@ -16,7 +59,7 @@ export async function provisionFirstTaskFixtures(input: { daytonaImage?: string; company: LiveFixtureValues["company"]; credentials: Partial>; -}): Promise { +}): Promise { const { api, execution, nonce, company, credentials } = input; const managed = isManagedFirstTask(execution); if ( diff --git a/tests/runner-e2e/first-task-flow.ts b/tests/runner-e2e/first-task-flow.ts index fba8c205066..b190c824254 100644 --- a/tests/runner-e2e/first-task-flow.ts +++ b/tests/runner-e2e/first-task-flow.ts @@ -11,6 +11,8 @@ import { firstTaskNativeRuntimePatch, provisionFirstTaskFixtures, isManagedFirstTask, + startFirstTaskWithRuntimeBound, + type FirstTaskFixtureValues, } from "./first-task-fixtures.js"; import { execFileSync } from "node:child_process"; import { expect, type Page, type Request, type Response } from "@playwright/test"; @@ -275,7 +277,7 @@ export async function setupFirstTaskFixtures(input: { daytonaImage?: string; deadlineAt?: number; observe: (fixtures: LiveFixtureValues) => void; -}): Promise { +}): Promise { const { page, api, execution, nonce } = input; await api.patch("/api/instance/settings/experimental", { enableClassicTaskInterface: false, @@ -409,14 +411,18 @@ export async function setupFirstTaskFixtures(input: { expect(persisted.adapterType).toBe("paperclip_runner"); expect(persisted.adapterConfig?.provider).toBe("codex"); } - await page.getByRole("button", { name: "Get started", exact: true }).click(); + await startFirstTaskWithRuntimeBound({ + api, execution, agent: agents[0], + observe: bound => { fixtures.onboardingRuntimeBound = bound; input.observe(fixtures); }, + start: () => page.getByRole("button", { name: "Get started", exact: true }).click(), + }); return fixtures; } export async function runFirstTaskFlow(input: { page: Page; api: RunnerApi; - fixtures: LiveFixtureValues; + fixtures: FirstTaskFixtureValues; execution: MatrixExecution; nonce: string; deadlineAt?: number; @@ -611,6 +617,7 @@ export async function runFirstTaskFlow(input: { e.runtimeSettings = { completionDeliveryProbe: runsCompletionUpdateProbe(execution), onboardingRuntime: fixtures.onboardingRuntime, + ...(fixtures.onboardingRuntimeBound ? { onboardingRuntimeBound: fixtures.onboardingRuntimeBound } : {}), adapterType: agent.adapterType, adapterConfig: agent.adapterConfig, runtimeConfig: agent.runtimeConfig, diff --git a/tests/runner-e2e/first-task.test.ts b/tests/runner-e2e/first-task.test.ts index 7eab98151c4..a5b30654497 100644 --- a/tests/runner-e2e/first-task.test.ts +++ b/tests/runner-e2e/first-task.test.ts @@ -13,6 +13,7 @@ import { fixtureRuntimeCostCoverage, selectFixtureRuntimeLeases } from "./live-f import { firstTaskNativeRuntimePatch, provisionFirstTaskFixtures, + startFirstTaskWithRuntimeBound, MANAGED_FIRST_TASK_CELL, } from "./first-task-fixtures.js"; import { describe, expect, it, vi } from "vitest"; @@ -233,6 +234,7 @@ describe("first-task public result projection", () => { adapterConfig: { provider: "codex", model: "gpt-5.6-sol", env: { OPENAI_API_KEY: sentinel }, codexHome: sentinel }, runtimeConfig: { accountId: sentinel }, permissions: { privateTrace: sentinel }, onboardingRuntime: { mode: "production-wizard", originalAdapterType: "paperclip_runner", testedAdapterType: "paperclip_runner", accountId: sentinel }, + onboardingRuntimeBound: { timeoutSec: 180, maxConcurrentRuns: 1, before: { runtimeConfig: { accountId: sentinel } }, after: { runtimeConfig: { accountId: sentinel } } }, }; for (const checkpoint of e.checkpoints) { checkpoint.tasks.forEach(t => Object.assign(t, { executionState: { sessionId: sentinel }, responsibleUserId: sentinel })); @@ -818,6 +820,110 @@ Accept the card above and I write it. This task stays in review until then.`; expect(postSensitive).toHaveBeenCalledTimes(1); }); + describe("bounded automatic Codex onboarding admission", () => { + function harness(environment = "local", profile = "runner-codex") { + const execution = runnerMatrix.find(entry => entry.task.flow === "first_task" && entry.profile.id === profile && entry.environment.id === environment)!; + const original = { + id: "agent", companyId: "company", adapterType: "paperclip_runner", + adapterConfig: { provider: "codex", timeoutSec: 0, model: "gpt-5.6-sol", modelReasoningEffort: "high", codexPermissionMode: "readOnly", + env: { OPENAI_API_KEY: { type: "secret_ref", secretId: "encrypted-key", version: "latest" } }, paperclipSkillSync: { desiredSkills: ["paperclipai/paperclip/first-task"] } }, + runtimeConfig: { aiConnection: { provider: "openai", method: "api_key", mode: "responsible_user" }, + heartbeat: { maxConcurrentRuns: 20, enabled: false, intervalSec: 0, wakeOnAssignment: true, customHeartbeatSetting: "retained" }, customSetting: "retained" }, + permissions: { canCreateAgents: true }, defaultEnvironmentId: environment, budgetMonthlyCents: 500, metadata: { ownerUserId: "qa-user" }, + }; + let stored = structuredClone(original); + const calls: string[] = []; + const api = { + get: vi.fn(async (_path: string) => { calls.push("GET"); return structuredClone(stored); }), + patch: vi.fn(async (_path: string, data: any) => { + calls.push("PATCH"); + stored.adapterConfig = { ...stored.adapterConfig, ...data.adapterConfig }; + if (data.runtimeConfig) stored.runtimeConfig = structuredClone(data.runtimeConfig); + return structuredClone(stored); + }), + }; + const observe = vi.fn(() => { calls.push("OBSERVE"); }); + const start = vi.fn(async () => { calls.push("START"); }); + const admit = () => startFirstTaskWithRuntimeBound({ api: api as any, execution, agent: original, observe, start }); + return { api, original, calls, observe, start, admit, stored: () => stored }; + } + + it.each(["local", "daytona"])("bounds %s without choosing a runner, provider, model, or account", async environment => { + const h = harness(environment); + const original = structuredClone(h.original); + const expected = { ...original, adapterConfig: { ...original.adapterConfig, timeoutSec: 180 }, + runtimeConfig: { ...original.runtimeConfig, heartbeat: { ...original.runtimeConfig.heartbeat, maxConcurrentRuns: 1 } } }; + await h.admit(); + expect(h.stored()).toEqual(expected); + expect(h.api.patch).toHaveBeenCalledExactlyOnceWith("/api/agents/agent", { adapterConfig: { timeoutSec: 180 }, runtimeConfig: expected.runtimeConfig }); + expect(h.calls).toEqual(["GET", "PATCH", "GET", "OBSERVE", "START"]); + expect(h.original).toEqual(original); + expect(h.observe).toHaveBeenCalledExactlyOnceWith({ timeoutSec: 180, maxConcurrentRuns: 1, before: original, after: expected }); + }); + + it.each(["read-failure", "patch-failure", "verification-failure", "missing-timeout", "missing-concurrency"])("does not admit task execution after %s", async mode => { + const h = harness(); + if (mode === "read-failure") h.api.get.mockRejectedValue(new Error("Agent read failed")); + if (mode === "patch-failure") h.api.patch.mockRejectedValue(new Error("Timeout patch failed")); + if (mode === "verification-failure") h.api.get.mockResolvedValueOnce(structuredClone(h.original)).mockRejectedValueOnce(new Error("Verification read failed")); + if (mode === "missing-timeout") h.api.patch.mockImplementation(async (_path, data) => { + h.stored().runtimeConfig = structuredClone(data.runtimeConfig); + return structuredClone(h.stored()); + }); + if (mode === "missing-concurrency") h.api.patch.mockImplementation(async (_path, data) => { + h.stored().adapterConfig = { ...h.stored().adapterConfig, ...data.adapterConfig }; + return structuredClone(h.stored()); + }); + await expect(h.admit()).rejects.toThrow(); + expect(h.start).not.toHaveBeenCalled(); + expect(h.observe).not.toHaveBeenCalled(); + if (mode === "read-failure") expect(h.api.patch).not.toHaveBeenCalled(); + }); + + it.each(["legacy", "wrong-provider", "foreign-agent", "changed-account"])("rejects %s before changing the automatic wizard choice", async mode => { + const h = harness(); + if (mode === "legacy") h.original.adapterType = "codex_local"; + if (mode === "wrong-provider") h.original.adapterConfig.provider = "claude"; + if (mode === "foreign-agent") h.api.get.mockResolvedValue({ ...h.original, companyId: "another-company" }); + if (mode === "changed-account") h.api.get.mockResolvedValue({ ...h.original, runtimeConfig: { ...h.original.runtimeConfig, + aiConnection: { ...h.original.runtimeConfig.aiConnection, method: "subscription" } } }); + await expect(h.admit()).rejects.toThrow(); + expect(h.api.patch).not.toHaveBeenCalled(); + expect(h.start).not.toHaveBeenCalled(); + expect(h.observe).not.toHaveBeenCalled(); + }); + + it.each(["runner", "provider", "model", "account", "permissions", "environment", "instructions", "heartbeat-policy", "other-runtime", "missing-heartbeat"])("refuses a persisted %s change instead of treating the bound PATCH as proof", async field => { + const h = harness(); + const altered = structuredClone(h.original); + altered.adapterConfig.timeoutSec = 180; + altered.runtimeConfig.heartbeat.maxConcurrentRuns = 1; + if (field === "runner") altered.adapterType = "codex_local"; + if (field === "provider") altered.adapterConfig.provider = "claude"; + if (field === "model") altered.adapterConfig.model = "another-model"; + if (field === "account") altered.runtimeConfig.aiConnection.mode = "fixed"; + if (field === "permissions") altered.permissions.canCreateAgents = false; + if (field === "environment") altered.defaultEnvironmentId = "another-environment"; + if (field === "instructions") altered.adapterConfig.paperclipSkillSync.desiredSkills = []; + if (field === "heartbeat-policy") altered.runtimeConfig.heartbeat.wakeOnAssignment = false; + if (field === "other-runtime") altered.runtimeConfig.customSetting = "lost"; + if (field === "missing-heartbeat") delete (altered.runtimeConfig as Partial).heartbeat; + h.api.get.mockResolvedValueOnce(structuredClone(h.original)).mockResolvedValueOnce(altered); + await expect(h.admit()).rejects.toThrow("runtime bound was not confirmed"); + expect(h.start).not.toHaveBeenCalled(); + expect(h.observe).not.toHaveBeenCalled(); + }); + + it.each(["legacy-codex", "legacy-claude", "runner-acpx-claude"])("leaves %s admission unchanged", async profile => { + const h = harness("local", profile); + await h.admit(); + expect(h.api.get).not.toHaveBeenCalled(); + expect(h.api.patch).not.toHaveBeenCalled(); + expect(h.observe).not.toHaveBeenCalled(); + expect(h.start).toHaveBeenCalledTimes(1); + }); + }); + it.each(["runner-codex", "runner-acpx-claude"])( "switches only the runtime for %s, preserving onboarding assets and the default model", (id) => {