## Thinking Path > - Paperclip is the open source app people use to manage AI agents for work. > - The first task helps a new user define and approve useful work. > - That workflow needs reusable instructions and tests against the production experience. > - Native Codex and Claude must load the assigned skill, including after resume. > - Maintainers need recorded conversations and precise failed checks to judge regressions. > - This pull request adds the first-task skill and a suite in the shared Runner E2E harness. > - It keeps behavior results separate from informational quality scores and incomplete recordings. ## Linked Issues or Issue Description **What existing behavior does this improve?** The first onboarding task and the Runner E2E report used to review it. **Current behavior** Onboarding embeds its policy in a hidden brief. Native Codex drops the skill-instructions setting at the Rust boundary. The shared E2E harness has no onboarding suite or full conversation view. **Proposed behavior** Assign and invoke `/first-task` for the onboarding task. Send selected Codex skills as structured protocol inputs. Run twelve scenarios across legacy Codex, legacy Claude, native Codex, and native ACPX Claude. Include all 48 cells in full campaigns. Show recorded chat, question and approval cards, exact checks, instructions, and billing in the shared dashboard. **Reason and benefit** Measure the real onboarding experience before changing prompts. Distinguish infrastructure failures, behavior failures, and unexercised journey steps. **Breaking changes** No database migration or production API change. First-task instructions now live in an assigned skill. The user-edited persona is preserved; the skill includes the maintainer-approved proposal-mode mapping and saved-plan requirement. Related: #11043 is earlier onboarding work. #13422 already fixes native Claude model pinning, context delivery, and read permissions on master; this branch includes those fixes through its base. The new Claude recovery test supplements them. ## What Changed - Extract and assign the first-task skill while retaining the production greeting and opening question. - Carry the Codex skill-instructions flag through thread start and resume. Resolve explicit task skill references only against assigned skills and send native skill inputs. - Invoke an unambiguously selected assigned skill through Claude ACPX’s native slash-command parser on initial and resumed turns, retaining the entire task/wake envelope as its argument. Do not carry that invocation into ordinary tasks. - Restore the saved single-task proposal modes: confirmation card, or saved plan with revision-targeted checkbox approval. Explicit plan requests also require a saved plan. - Add first-response and complete-journey cases with fixed user facts, acceptance checkpoints, durable outcome checks, and accounting for child runs. - Fail the eval when choice questions have fewer than two real options. Recognize planning documents without treating them as completed work. - Add optional, bounded quality judging as explicit post-processing. - Render full conversations and static interaction cards in the shared report. Conversations start folded. Show original and regraded results and incomplete journeys distinctly. - Keep credential-persistence scanning outside the first-task behavioral suite; retain public evidence redaction. - Refresh generated capability references after the API-reference edits. - Correct shared native question guidance and tool schemas: choices need at least two meaningful options; open-ended questions use canonical text fields with the required compatibility payload. Verify both formats through real tool-authority persistence. - Disable announcements automatically for every isolated Runner E2E process and label the gallery environment/provider/target explicitly. - Remove CI races in the GitHub connection browser test and native session recovery test by waiting for the actual async work before asserting its results. ## Verification - `pnpm exec vitest run server/src/services/onboarding-first-task-assets.test.ts server/src/__tests__/issue-onboarding-first-task-routes.test.ts`: 19 passed. - `pnpm --dir packages/paperclip-runner exec vitest run src/drivers/acpx/runtime-host.test.ts src/drivers/acpx/native-skill-prompt.test.ts src/cli/acpx-runtime-sidecar.test.ts`: 70 passed. Native command forwarding and the 1 MiB input boundary both failed before their fixes and passed afterward. Coverage includes changed skills on reopen, approval context, and an ordinary subsequent task. - Runner E2E unit suite: 306 passed. Harness typecheck passed. The 64 first-task fixture and grader tests also pass. - Full repository typecheck and build passed locally. Server typecheck and Runner build passed again after the native-command change. - Full GitHub Actions CI passed on `23e56447b`: all server/workspace/browser shards, Runner verification, typecheck/release registry, build, canary, policy, and Docker checks. Greptile reviewed this exact head at 5/5 with no unresolved threads. The earlier broad local run had database startup/timing failures that passed isolated retries; the complete remote suite is green. - Merge verification against current master: 312 harness tests and 13 native recovery tests passed. Regenerated semantic contracts and fixture hashes pass their consistency check. Full local typecheck and build also passed on the stacked queue branch. After merging the latest master and preserving the GitHub setup timing regression in the split browser suite, both focused GitHub browser tests passed. Three CI timing/startup flakes passed local verification and one remote retry; all latest-head checks are green. - Real pinned Claude SDK and Claude ACP JSON-RPC probes against a local mock API confirmed that `/skill-name` expands the assigned skill body before the model request and retains the task arguments. A prose mention does not. The probes made no paid model calls. The ACP probe used the current first-task skill body and retained the wake arguments. - [Full 48-case campaign and report](https://pages.paperclip.ing/runner-e2e-first-task-35053063880/): 44 passed after three interrupted Codex cases completed in targeted reruns. Original results, regrades, and all 51 executions remain in the report provenance. - [Claude campaign after the shared-question fix](https://pages.paperclip.ing/runner-e2e-first-task-claude-35099525201/): 10/12 passed with zero single-option failures. All 12 recorded the current assigned skill and corrected guidance. The failures exposed skipped skill invocation and a missing saved plan. This PR adds native command invocation and explicit saved-plan instructions; the subsequent report below still shows behavior failures. - [Fresh 12-case Claude report](https://pages.paperclip.ing/runner-e2e-first-task-claude-35102737804/) at `78452129e`: 10/12 pass after correcting two false proposal-matcher failures. The recordings said “Here is the task I will create and run/complete” in approval cards; the old matcher missed that word order. Regression tests failed before the fix and pass after it. Original results and offline regrade provenance remain linked. No agent rerun was needed. Zero single-option-question failures; two behavior failures remain: direct work before acceptance on a plain first message, and an explicit plan request without a saved plan. Neither check was relaxed. The follow-up `82087ac7e` fixes command-prefix size accounting; `94aefb1f3` fixes only that proposal matcher. - Report browser checks confirm folded conversations, rendered cards, explicit Local/Daytona labels, and no page errors. The published-object audit scanned 1,306 text files across 2,154 objects with no credential-format findings or prohibited files. Image pixels and unknown token formats are outside that scan. ## Risks - Model behavior is nondeterministic. One campaign is evidence, not a guarantee. The two remaining Claude behavior failures are visible in the report and require further product work; this PR does not claim all onboarding scenarios pass. - The suite checks persisted Paperclip effects. It cannot prove the absence of arbitrary external effects. - Historical recordings can miss later journey steps. These remain incomplete, never passes. - Native profiles switch runtime after the production onboarding wizard because it does not yet expose a native option. - Quality scores are informational and cannot override behavioral failures. ## Model Used OpenAI Codex, GPT-6, with reasoning, repository tools, and code execution. The exact deployed model identifier and context-window size are not exposed in this session. ## Checklist - [x] I have included a thinking path that traces from project context to this change - [x] I have specified the model used (with version and capability details) - [x] I have checked ROADMAP.md and confirmed this PR does not duplicate planned core work - [x] I have searched GitHub for duplicate or related PRs and linked them above - [x] I have either (a) linked existing issues with `Fixes: #` / `Closes #` / `Refs #` OR (b) described the issue in-PR following the relevant issue template - [x] I have not referenced internal/instance-local Paperclip issues or links (only public GitHub `#NNN` / `github.com/paperclipai/paperclip` URLs) - [x] My branch name describes the change (e.g. `docs/...`, `fix/...`) and contains no internal Paperclip ticket id or instance-derived details - [x] I have run tests locally and they pass - [x] I have added or updated tests where applicable - [x] I have updated relevant documentation to reflect my changes - [x] I have considered and documented any risks above - [x] All Paperclip CI gates are green - [x] Greptile is 5/5 with no open P2s, recommendations, or follow-ups - [x] I will address all Greptile and reviewer comments before requesting merge --------- Co-authored-by: Paperclip <noreply@paperclip.ing>
10 KiB
Codex Skillless Codex Driver
Scope
Codex implements a direct Codex app-server v2 driver behind the package's
existing HarnessDriver contract. The driver, mock core, example CLI, tests,
and evidence stay inside packages/paperclip-runner/. They do not import or
change Paperclip server, UI, database, or production control-plane behavior.
The app-server process is local to the execution environment and uses newline delimited JSON-RPC over stdio. It is not exposed as a network service.
Identity mapping
| Runner identity | Codex source | Persistence rule |
|---|---|---|
| run ID | mock-core input | Never replaced during recovery. |
| normalized session ID | controller-owned mock-core input | A distinct identity, independent of the run and provider IDs, that stays stable across transport/process recovery. |
| driver session ID | thread.id |
Resumed by exact ID. A different returned ID fails recovery. |
| provider session ID | thread.sessionId |
Kept separately from the driver thread ID. |
| turn ID | turn.id |
Required by steer and interrupt preconditions. |
| item ID | item.id, request ID, or deterministic turn/kind key |
Preserved on lifecycle and delta events. |
| source event ID | runner instance + run + source sequence | Source sequence continues from the persisted snapshot. |
The persisted session snapshot records run, normalized session, driver session, provider session, the exact active turn, committed semantic-result content/call binding, observed terminal-turn fingerprints, and the last source sequence. Recovery starts a new local app-server transport, reads the exact persisted thread to validate identity and working directory, resumes that thread, and then reads it again for reconciliation. Reconciliation considers only the persisted active turn: it retains that turn when active, terminalizes that turn when terminal, and fails recoverably when it is missing or a different active turn appears. Historical terminal turns never substitute for the persisted active turn, and a terminal already in the durable snapshot is not emitted again.
App-server operations
| Driver operation | App-server method | Degradation |
|---|---|---|
| initialize | initialize, then initialized |
Startup fails visibly. |
| create | thread/start |
Required. |
| resume | thread/resume |
recovered: false with a redacted reason. |
| read | thread/read |
Explicit HarnessCapabilityUnavailableError. |
| start turn | turn/start |
Required. |
| steer | turn/steer with expectedTurnId |
Explicit unsupported diagnostic; no stdin fallback. |
| interrupt | turn/interrupt |
Explicit unsupported diagnostic; session is not killed. |
| usage | thread/tokenUsage/updated |
Returns the last snapshot or explicit unsupported error. |
| reconcile | thread/read plus session.reconciled |
Disabled when read is unavailable. |
Capability flags are descriptive and executable. Unsupported operations emit
canonical harness.diagnostic events with secret-redacted detail. No
harness-specific branch is required in the mock core.
Skillless context boundary
The model receives one text input containing paperclip.skillless_task.v1:
- objective;
- completion-contract revision and criteria;
- task constraints; and
- the expected canonical result schema name.
The thread config explicitly disables automatic skill and app instruction
blocks. Codex's built-in collaboration instructions are enabled by default so
interactive runs receive native commentary and tool preambles; a driver caller
may explicitly disable them for a specialized deterministic fixture. This
does not enable skills, apps, plugins, memories, or extra model-input kinds.
The model input accepts only text, never a Codex skill input. The driver
captures the returned instruction-source list and requires it to be empty for
the skillless assertion.
The trusted app-server process has an allowlisted environment. It retains host
HOME and CODEX_HOME only so the provider can authenticate. Model-issued
commands have a separate boundary: an empty-by-default environment with no
HOME or CODEX_HOME, no network, and a named Codex
permission profile requesting read-only minimal runtime files, no host-home or
Codex-home access, and write access to the assigned workspace. The driver
refuses filesystem-root workspaces, workspaces containing host HOME, and any
workspace overlapping host CODEX_HOME. A workspace below host HOME is
valid, but when PAPERCLIP_WORKSPACE_CWD is present its canonical path must be
equal to or below that assigned workspace so sibling and symlink escapes fail
before provider startup.
The returned sandbox facts remain authoritative. Codex 0.132.0 may inject a
provider-managed writable root such as ~/.codex/memories after a first run,
even with features.memories=false and an explicit Codex-home deny. That makes
the Codex-home directory discoverable in a warmed environment, so Codex does
not claim whole-directory unreadability. Its authenticated proof instead
requires each readable auth.json/config.toml file and an unrelated host
secret to remain unreadable and unwritable, while recording any injected root
in context.sandbox.legacyPolicy.
Paperclip bearer values, OPENAI_API_KEY, arbitrary skill paths, and other
inherited variables are not passed. Diagnostics redact bearer/basic
credentials, credentialed proxy URLs, secret query parameters, sensitive JSON
keys, and common key assignments.
The context snapshot records configuration and environment key names, not secret values.
Semantic completion
The provider-facing structured-output schema covers done and needs_review.
It uses the strict OpenAI shape: every object rejects additional properties and
the constant schema field includes both type: "string" and const.
Two dynamic semantic tools are registered when supported:
paperclip_finishacceptsdoneorneeds_review;paperclip_blockacceptsblockedand requires a blocker owner, action, reason, and scope.
Both normalize through the canonical paperclip.run_result.v1 validator. The
first valid result is proposed. Any canonically identical result retry is
idempotent even when the provider assigned a new call ID; the original call
binding remains persisted for audit, while changed content is rejected. Tool
calls and provider notifications must name the exact opened thread and active turn. Missing,
pre-turn, cross-thread, cross-turn, and post-terminal bindings fail the provider
session closed. Canonically identical terminal replays are no-ops; conflicting
terminal facts are rejected. Process exit or prose alone never implies
completion.
The provider cannot commit controller state. It emits run.result.proposed and
a provider turn terminal; the mock core validates the proposal against its
task envelope, emits run.result.accepted or run.result.rejected, and alone
emits run.terminal.
Canonical event mapping
- thread lifecycle ->
session.started,session.resumed,session.reconciled; - turn lifecycle ->
turn.submitted,turn.accepted,turn.started, and one terminal turn event; - messages, reasoning, plans, commands, file changes, dynamic tools, and diffs
->
item.started,item.delta,item.completed; - model selection -> a completed
modelitem; - app-server decisions ->
runtime_request.createdandruntime_request.resolvedwith redacted detail; - token snapshots -> completed
usageitems; - semantic verification rows -> completed
verificationitems; - provider completion -> at most one
run.result.proposedand one turn terminal; - controller decision -> one
run.result.acceptedorrun.result.rejected, followed by onerun.terminal.
The JSON-RPC transport limits each input line, pending client requests, in-flight server requests, queued notification count and bytes, diagnostic lines, and retained provider payloads. Malformed or oversized messages close the transport and reject pending work.
The existing Replay reducer consumes the live stream. Replay crosses a serialized JSONL boundary that validates byte and event counts, line size, schema, run/session binding, unique source event IDs, continuous per-source sequence, and exactly one final run terminal before reducing. The Codex tracer requires byte-equivalent live and replay snapshots.
Runnable example
trace:codex starts a real local codex app-server session through the mock
core. Its safe task creates hello.txt with network disabled. The evidence
recorder additionally probes all readable host Codex credential/config files
and an unrelated host secret, requiring reads and writes to be denied while
workspace output and app-server authentication still succeed. It gates output
reads on an accepted done result and reports missing files by name rather
than surfacing a raw filesystem ENOENT. See the
Codex tutorial.
This phase changes no browser surface, so no new browser screenshot applies. The canonical events are proved through the existing reducer/replay path and JSON trace evidence.
Explicit assigned skills in native tasks
A task description can explicitly invoke an assigned skill with /skill-name
or $skill-name. The native Codex backend resolves these references against
that run's assigned runtime context; assignment alone does not invoke a skill.
Selections are recomputed from the current task description on each wake,
including approval replies and recovered sessions. Ordinary tasks without an
explicit reference receive no structured skill invocation.
The driver sends both the $skill-name text reference and Codex's structured
{ type: "skill", name, path } input on every requested turn. Runnerd validates
the assigned source path, maps it to the provider's isolated
codex-home/skills/<name>/SKILL.md (including remote runners), and preserves it
through the durable turn.start command. turn.submitted.skillInputs records
the controller's selected inputs for inspection; protocol tests separately
verify the outgoing provider request and mapped path.
includeSkillInstructions is forwarded to Codex on both thread/start and
thread/resume. Old persisted configurations without the field retain their
provider default until a fresh, settled run supplies an explicit value. That
one-time upgrade reopens the same thread with the new setting. OpenCode does
not receive Codex's skill configuration or structured skill inputs.
These are delivery guarantees, not guarantees of model adherence. The onboarding
first-task skill uses this generic mechanism; its prompt and persona are not
changed by the wiring.