Repository navigation
Description
Blocked by: — Tier: judgment Doc: guard plan 2026-09-18 (16-bug classification; #497 epic)
Why
The Codex driver shipped 2026-09-15/16 and its first real run found three gaps in a row: the sandbox excluded .git so no phase could commit (#1076), network was off so no phase could reach gh (#1079), and a usage-limit failure was typed unknown so --auto-wait and the billing skip never engaged (#1087). None was a Codex-specific surprise. They are the contract the Claude driver already satisfies implicitly, and nothing states that contract as tests a new driver has to pass before it ships.
Change
src/lib/workflow/drivers/__tests__/driver-conformance.test.ts, a describe.each over every registered driver, with driver-specific probes behind one adapter. Zero-cost where the vendor allows it (codex sandbox with the driver's exact config; the Claude driver's fixture transcripts), model calls only where unavoidable and skipped in CI when the key is absent.
Contract:
- Commit: inside the driver's default sandbox, in a git worktree,
git addandgit commitsucceed. - Network:
gh api rate_limitsucceeds from inside the sandbox when the run needs the platform. - Errors: a quota-exhausted message maps to
BillingErrorwith the reset time in metadata; a transient throttle maps toRateLimitError(retryable); anything else maps toSequantErrorwith the driver's code. Fixture text per driver. - Env: the phase sees
SEQUANT_ORCHESTRATOR,SEQUANT_WORKTREE,SEQUANT_PHASE,SEQUANT_ISSUE(the same set for every driver). - Outcome: the driver returns the structured outcome shape (
verdict,structuredError,tokensUsed) withtokensUsed > 0on a completed turn. - Skill load: the driver loads the project-scope
/execskill (the spike(opencode): doesopencode run --command <phase>load the sequant skill? (#862 P0 precondition, resolves OQ-8/OQ-9) #992 gate generalized).
Adding a driver without a conformance adapter fails the suite.
Release-graph plan — guard-2026-09 (2026-09-20)
Graph: guard-2026-09 Tier: judgment Wave: 2
May touch: src/lib/workflow/drivers/__tests__/driver-conformance.test.ts, src/lib/workflow/drivers/__fixtures__/ (per-driver error texts incl. the verbatim #1087 run-2 message), src/lib/workflow/drivers/index.ts (adapter registration only; the DRIVERS map is the enumeration source), a docs/ driver-authoring page, CHANGELOG.md; not codex.ts (#1087 owns the mapping in wave 3)
The npm run build && npm test AC is verified by the runner from a clean shell after the PR opens (PLAN I-1); the agent runs only the test files its ACs name. Mutation markers use failedTest starting with the test file path (I-4). AC-3's BillingError case is expected to fail until #1087 lands: mark it it.fails (or todo with the issue number) so the suite stays green, and say so in the PR body — #1087 flips it. Sandbox probes run the real codex sandbox / real gh (I-6); skip with a named reason when the binary or key is absent. Wave 2 for suite hygiene after #1086; no hard edge.
Acceptance criteria
- AC-1: the suite enumerates drivers from the registry, not a hand-written list; an unregistered adapter or a registered driver without an adapter fails — Verify:
npx vitest run src/lib/workflow/drivers/__tests__/driver-conformance.test.ts→ green. Mutation-verified per CLAUDE.md §Testing: register a stub driver with no adapter → the suite fails naming it; restore. - AC-2: the Codex commit probe runs at $0 under
codex sandboxwithsandbox_mode="workspace-write"and the driver's writable roots, and passes — Verify:-t "codex commit"→ green (skipped with a named reason whencodexis not installed). - AC-3: the Codex error-mapping cases pass for the three fixture messages, including the bug(codex): usage-limit turn failures classified 'unknown' — quality loop re-runs into the same quota, --auto-wait can't engage #1087 usage-limit text — Verify:
-t "codex errors"→ green. Mutation-verified: remove the usage-limit branch → theBillingErrorcase fails; restore. - AC-4: the Claude driver passes the same six contract items — Verify:
-t "claude-code"→ green. - AC-5: the opencode driver passes or each skipped item names the tracking issue in the skip reason — Verify:
-t "opencode"→ green with skips listed. - AC-6:
docs/driver-authoring page lists the six contract items and points at the suite — Verify:grep -c "driver-conformance" docs/**/*.md≥ 1. - AC-7:
npm run build && npm testgreen.
Not in scope
Fixing #1087 itself; this issue's AC-3 lands the test, #1087 lands the mapping. Order them accordingly when planning.
Activity
admarble commentedon Sep 20, 2026
Runner context — guard-2026-09 launch, 2026-09-20. Base:
origin/mainatda9ed6e8(2.16.0 plus the plan docs). These rules override the exec skill's defaults for this run:npm testin the worktree. Run only the test files this issue's ACs name. The runner runs the full suite once per PR from a clean shell. Undersequant runthe suite is not hermetic againstSEQUANT_*(bug(test): suite isn't hermetic against the SEQUANT_* env phases inject — exec sees red tests it didn't cause and opens no PR #1086), so a full run shows red files you did not cause.env -u SEQUANT_ORCHESTRATOR -u SEQUANT_WORKTREE -u SEQUANT_PHASE -u SEQUANT_ISSUE -u SEQUANT_RELAY -u SEQUANT_RELAY_FRAME npx vitest run <file>. If it is still red, the PR body names the issue number and the base-vs-head result for that test.<!-- SEQUANT_MUTATION: {"ac":"AC-N","mutation":"<what you deleted>","failedTest":"<test file path> > <describe> > <case>"} -->in the PR body.failedTestMUST start with the test file path, or the qa classifier reports it Failed. Commit before mutating.timeout.git commit -m "...", noCo-Authored-By. Never rebase or force-push after pushing. One AC per line in the PR body, idsAC-Nonly.Issue-specific: Judgment tier.
codex0.154.0 is on PATH (~/.local/state/fnm_multishells/.../bin/codex), so AC-2 runs the real sandbox probe; if the sandbox is unavailable, skip with a named reason, never a mock. AC-3'sBillingErrorcase is expected to fail until #1087 lands: mark itit.failswith the issue number in the name. Registry-driven enumeration only; no hand-written driver list.admarble commentedon Sep 20, 2026
Complexity: Standard (7 ACs, 3 directories)
AC Quality Check
lintAcceptanceCriteria: 7/7 passed, 0 flagged. Every AC carries a runnable— Verify:command.One parser note, not a defect in the ACs: all 7 resolve to
verificationMethod: "manual"because the ACs use prose— Verify: <cmd>rather than the houseEvidence:clause, soAC.evidenceis unset and the declared-evidence channel (#938) is dark. Harmless here — the deliverable is the test file, so testgen is skipped regardless — but it means/qa's gate-test classifier will read these as manual unless the mutation markers carry the weight. The two mutation-verified ACs (AC-1, AC-3) must shipSEQUANT_MUTATIONmarkers withfailedTeststarting with the test file path, or §6i floors the verdict.Scope Assessment
Non-Goals: Present in the issue as
## Not in scope— butparseNonGoalsonly matchesNon-Goals/Out of Scope, so the assessor reports "not found". The boundary is real and stated; the warning is a heading-vocabulary miss insrc/lib/scope/analyzer.ts:293. Not worth fixing inside this issue.Verdict: ❌ SCOPE_SPLIT_RECOMMENDED — override to proceed as one issue. The red comes from keyword clustering that mislabels AC-6 as "auth" and AC-1/AC-7 as "ui"; the actual deliverable is one test file, one fixtures dir, one additive export, one docs page. Splitting a conformance contract into per-driver issues would defeat its purpose — the point is one
describe.eachno driver can dodge. The red verdict does auto-enable the quality loop, which is kept.Acceptance Criteria
AC-1: Suite enumerates drivers from the registry, not a hand-written list
Verification: Unit Test —⚠️
npx vitest run src/lib/workflow/drivers/__tests__/driver-conformance.test.tsScenario: Given
DRIVERSholdsclaude-code,aider,opencode,codex→ When the suite builds itsdescribe.eachfrom the registry → Then each name is matched to a conformance adapter, and a name with no adapter (or an adapter with no registered name) fails naming it.Assumptions:
DRIVERSis module-private today (src/lib/workflow/drivers/index.ts:26) — nothing exports it or its keys. Registry-driven enumeration needs one additive export (listDriverNames()). ReadingObject.keysout ofgetDriver("nope")'s error string is possible and rejected: it couples the suite to a message format.Mutation: register a stub driver in
DRIVERSwith no adapter → confirm the "every registered driver has an adapter" case fails namingstub→ restore. Manual edit, per CLAUDE.md §Testing — no in-test registry mutation needed.AC-2: Codex commit probe runs at $0 under
codex sandboxand passesVerification: Integration Test —
-t "codex commit"Scenario: Given a real temp repo +
git worktree→ Whencodex sandboxrunsgit add+git commitwith the driver's ownsandbox_workspace_write.writable_roots→ Then both succeed andgit logshows the commit.Assumptions: Verified live during planning on codex-cli 0.154.0: without the writable root,
git addfails with the exact #1076 text (Unable to create '…/.git/index.lock': Operation not permitted); with it, add + commit both succeed. So the probe is discriminating, not a tautology. Two cautions: (a) assert on repo state (git log), never on an exit code read through a pipe — a pipe eats it; (b) darwin uses seatbelt, Linux CI uses landlock — skip with a named reason whencodex sandboxis unavailable, never a mock.AC-3: Codex error-mapping cases pass for three fixture messages
Verification: Unit Test —⚠️ An
-t "codex errors"Scenario: Given the verbatim #1087 usage-limit text, a transient-throttle text, and an unrecognized failure → When the driver classifies each → Then
BillingError(reset time in metadata),RateLimitError(retryable),SequantErrorwith the driver's code.Assumptions:
codex.tsmaps everything toSequantError/SubprocessErrortoday — noBillingError/RateLimitErrorbranch exists. Per the issue's scope line,codex.tsis not touched here. TheBillingErrorcase ships asit.fails("… until #1087 lands")so the suite stays green; #1087 flips it.Mutation: remove the usage-limit branch → the
BillingErrorcase fails → restore.it.failscase cannot be mutation-verified in the usual direction — record this honestly in the PR body rather than fabricating a marker.AC-4: Claude driver passes the same six contract items
Verification: Unit Test —⚠️
-t "claude-code"(SDK mocked via the existingvi.mock("@anthropic-ai/claude-agent-sdk")pattern inclaude-code.test.ts)Scenario: Given fixture message streams → When the driver runs each contract item → Then commit (no sandbox: direct git in a temp worktree), env forwarding, typed errors, outcome shape and skill resolution all pass.
Assumptions:
AgentPhaseResulthas noverdictand notokensUsedfield.verdictis parsed later inphase-executor.ts:1036; token totals live inmodelUsage(ModelUsageEntry). Item 5 must therefore assert the shape the driver boundary actually owns —{ success, output, structuredError?, modelUsage }— withtokensUsedderived asinputTokens + outputTokensby a helper, matchingtoken-utils.ts:181. Do not add atokensUsedfield to the interface to satisfy the AC's wording.AC-5: opencode driver passes, or each skipped item names its tracking issue
Verification: Unit Test —⚠️ opencode accumulates
-t "opencode", green with skips listedScenario: Given the recorded
__fixtures__/opencode-run-qa.ndjson→ When the six items run → Then each either passes or skips with a reason naming an issue.Assumptions:
costUsdonly and never setsmodelUsage(opencode.ts:161,243) — item 5'stokensUsed > 0cannot pass, and no tracking issue exists for it (searched: #862/#992/#996/#997/#1075 all miss it). One must be filed before this AC can be satisfied as written. Skill-load (item 6) is already covered byskillLoadedand passes.AC-6:
docs/driver-authoring page lists the six contract items and points at the suiteVerification: Manual Test (grep) —
grep -c "driver-conformance" docs/**/*.md≥ 1Scenario: Given the new page → When the grep runs → Then at least one file reports a non-zero count.
Assumptions: Place the page at
docs/guides/writing-an-agent-driver.md— a second-level path, so the literal AC command matches under both zsh (recursive**) and bash (docs/*/*.md); a top-leveldocs/*.mdwould fail the literal command in bash. Do not create a newdocs/subdirectory (the landing site publishes new subdirs automatically). Do not editdocs/features/codex-agent-backend.md— the in-flightdocs/2.16-release-notesbranch already modifies it. Notegrep -cover multiple files printsfile:countlines; recordgrep -rl "driver-conformance" docs/ | wc -lalongside it as the unambiguous form.AC-7:
npm run build && npm testgreenVerification: Integration Test — run by the runner from a clean shell after the PR opens (PLAN I-1).
Assumptions: The agent runs only the test files its ACs name. Under
sequant runthe suite is not hermetic againstSEQUANT_*(#1086), so an in-worktree full run shows red files the change did not cause.Implementation Plan
Phase 1: Registry enumeration + adapter shape
src/lib/workflow/drivers/index.ts— addexport function listDriverNames(): string[] { return Object.keys(DRIVERS); }. Additive only;DRIVERSstays private and stays the single enumeration source.__tests__/driver-conformance.test.ts— define the adapter interface and anADAPTERSrecord keyed by driver name. Two guard cases run beforedescribe.each: every registry name has an adapter; every adapter name is in the registry. This pair is what AC-1's mutation trips.structural: <why>(the driver has no such concept — aider has no sandbox, no skill resolution) orgap: #NNNN <what>(the driver should support it and doesn't). A dedicated case asserts every recorded skip reason matches one of the two forms — this is what makes AC-5's "names the tracking issue" enforceable instead of a convention.Phase 2: Contract items behind the adapter
sandbox?.wrap(cmd, cwd). codex wraps with realcodex sandbox+ the driver's ownbuildCodexArgsoverrides; the other three declaresandbox: null→structural:skip. Network item runsgh api rate_limit(no quota cost); skip with a named reason whenghis absent or unauthenticated.__fixtures__/— codex gets the verbatim bug(codex): usage-limit turn failures classified 'unknown' — quality loop re-runs into the same quota, --auto-wait can't engage #1087 run-2 usage-limit message; claude-code reuses theBillingError/RateLimitError/ApiErrorpaths already exercised inclaude-code.test.ts.SEQUANT_*vars, assert each driver forwards them to its child env. Sites:claude-code.ts:141,opencode.ts:553,codex.ts:560,aider.ts:57. Note opencode additively redirectsXDG_CONFIG_HOME— assert a superset, not byte equality.{ success, output, structuredError?, modelUsage }and a derivedtokensUsed > 0. opencode and aider skip asgap: #NNNN.resolvesSkillsdrivers only. opencode assertsskillLoadedfrom its NDJSON fixture; codex from__fixtures__/codex-exec-skill-hook.jsonl; aiderstructural:skip.Phase 3: Docs + timing
docs/guides/writing-an-agent-driver.md— the six items, the adapter contract, the two skip forms, and "adding a driver without an adapter fails the suite". Add aCHANGELOG.mdentry..integration.segment, so the file lands in theunitvitest project with a 5 s timeout (fix(test): tsx-spawning integration tests blow vitest's 5s default — phase-registry should use the prebuilt dist like its five siblings #842). The realcodex sandboxandghprobes will exceed that under full-suite load. Pass an explicit timeout asit's third argument on every subprocess case —vitest.config.tsis outside this issue's "may touch" set, so don't move the file into the integration project.Design Review
index.ts— the contract is expressed as tests, not as a runtime base class, because a base class a driver can override proves nothing.describe.eachoverlistDriverNames(), one adapter record, per-item probes that either run or skip with a typed reason. Rejected: aConformanceTestSuiteabstract class per driver (four files to keep in sync); rejected: a lint rule asserting adapter presence (a test already fails louder).codex.sandbox.integration.test.ts(real git repos, real worktrees, no mocks for the thing under test) andclaude-code.test.ts(SDK mocked at the module edge, fixture streams driven through the real driver loop).structural:skips (no sandbox, no skill resolution, nostructuredError, nomodelUsage), which is the honest answer and exactly what the skip-form check is for. Second challenge: "is the codex sandbox probe measuring anything?" — answered by the live planning probe recorded under AC-2, which fails without the writable root and passes with it.Feature Quality Planning
modelUsage(onlycostUsd); aider populates neithermodelUsagenorstructuredError. Nothing open covers either. One follow-up issue — "drivers: opencode and aider report no token usage and no typed errors, so conformance items 3 and 5 skip" — can back both skip reasons. Recommend filing it as step 0 of exec so the skip strings can name a real number.it.failsis invisible to a green suite. AC-3's BillingError case passes the run by failing. Name the issue in the test title (#1087) so a reader of the output sees why, and state it in the PR body — a future reader who deletes it will not notice.codexandghwill both be absent or unauthenticated in some environments. Every skip there isstructural:-adjacent but environmental — use a third form (unavailable: <binary>) rather than stretchingstructural:, so a missing binary is never mistaken for a driver that legitimately lacks the capability.Derived ACs
structural:/gap: #NNNN/unavailable:aiderhas an adapter; its skips are typed, not absentConflict Risk Analysis
No file overlap. All feature worktrees (#1053, #1070, #1086, #1095, #1104, #1106) sit at base
da9ed6e8with no diff.docs/2.16-release-notestouchesdocs/features/codex-agent-backend.mdandsrc/lib/settings.ts— avoided by placing the new page indocs/guides/.Dependencies: #1087 owns the codex
BillingErrormapping (AC-3 lands the test, #1087 flipsit.fails). #1086 (SEQUANT_* hermeticity) affects only how AC-7 is run, not what this change contains.Open Questions
export function listDriverNames()within "index.ts: adapter registration only"? — Recommendation: yes, it is the minimal additive export that makes registry-driven enumeration possible at all. Impact if wrong: the suite has to scrapegetDriver's error message, which couples AC-1 to a string format.gap: #TBD? — Recommendation: file it first; a#TBDskip reason passes the format check while naming nothing. Impact if wrong: one extra issue.unitproject at all? — Recommendation: keep the AC-named path and set per-test timeouts, so AC-1's literal command stays true. Impact if wrong: a 5 s flake under load, visible immediately.Recommended Workflow
Phases: exec → qa
Quality Loop: enabled
Reasoning: No prior
/assesscomment on this issue.testgenis skipped deliberately: the deliverable is the test file, so generated stubs would collide with it, and all 7 ACs resolve tomanualwith no declaredEvidence:clause. Quality loop is enabled because the scope assessment returnedSCOPE_SPLIT_RECOMMENDED, and because two ACs are mutation-gated — a first pass that records a malformedfailedTestneeds a second.Label Review
Current:
enhancement,multi-agentRecommended: add nothing; optionally
no-browser-test(no UI surface — makes the skip explicit rather than inferred)Reason: No
.tsx/.jsxanywhere in the change.multi-agentalready reflects the cross-driver scope.Quality Loop: auto-enabled by the red scope verdict, and kept — see Reasoning above.
admarble commentedon Sep 20, 2026
Runner note for the qa phase (2026-09-20). Do not run the full
npm testin the worktree: under seven concurrent phase agents it exceeds the 30-minute no-progress wall and the phase is killed (this happened to the first qa run of this issue). The runner runs the full suite once per PR from a clean shell and records the result on the PR. Verify each AC by its own command, run only the test files the ACs name, and read the PR body's mutation marker withparseMutationMarkers. The PR is already open; do not push or rebase.admarble commentedon Sep 20, 2026
QA Verdict: AC_MET_BUT_NOT_A_PLUS
AC coverage: 0/2 met
Gaps:
it.failserror cases do not gate their fixture payloads (Finding 1, below).docs/README.md(Finding 2).docs(#1096): index the driver-authoring guide in docs/README.md
chore(#1096): merge origin/main
chore(#1096): merge origin/main
test(#1096): driver conformance suite — registry-enumerated, six cont…
chore: release v2.17.0 (#1130)