Skip to content

gate(#497): dogfood the Codex driver on a real /qa — human verdict decides P2/P3 #1060

Open

Description

@admarble

Epic: #497 Blocked by: #1079 Tier: human gate — not an agent run Doc: docs/investigations/codex-driver-probe-2026-09.md "Gaps" Graph: pre-2.16.0 release blockers, node 4 of 4 Subject issue: #1064

Why this is a gate and not an AC

The probe validated the harness mechanics with a 6-line skill. Whether sequant's real skills produce an acceptable phase through Codex is a paid, judgment-heavy experiment: an agent running it inside an exec phase would report NEEDS_VERIFICATION, and the vid-gen dogfood showed that verdict hid real defects 4/4. A human reads the transcript.

Setup (owner)

  • Codex auth on the machine: codex login (ChatGPT plan) or CODEX_API_KEY. Record which — the plan-auth path through exec is inferred from SDK source, never exercised.
  • A small, real, open issue in this repo (docs- or test-sized) as the subject.
  • sequant init --agent codex applied; project trusted per node 2.

Questions the gate answers

  • G-1: end-to-end — sequant run <issue> --agent codex through spec → exec → qa completes; record wall time, usage totals, and $ from the provider dashboard.
  • G-2: skill-body fidelity — does /qa act on deep sections (verdict-floor phrases, §6i mutation record), or does the body get clamped on read? Compare the transcript's skill read against wc -c .claude/skills/qa/SKILL.md.
  • G-3: harness-specific references — list each stall or improvisation caused by Task(, Agent(subagent_type, AskUserQuestion, or nested Skill(skill: "sequant:…") (7 of 21 skills reference these). Output: the list of skills needing harness-neutral wording, or "none".
  • G-4: gh under the sandbox — gh issue comment succeeds with network_access = true under [sandbox_workspace_write]; note whether danger-full-access was needed.
  • G-5: hook deny path end-to-end — a deliberate git push --force inside a phase is blocked (exit 2 → Codex refuses the command), visible in the JSONL.
  • G-6: resume across phases — spec→exec in the same worktree resumes the thread (canResume true); a forced cwd change does not.

Verdict (owner posts as a comment)

  • GO → file P2/P3 as separate issues: Codex [mcp_servers] for sequant serve; .codex/agents mapping for the subagent-spawning skills (or harness-neutral wording); sequant as a Codex marketplace plugin (distribution, independent of the driver).
  • NO-GO → record the blocking finding on feat: add OpenAI Codex CLI agent driver #497 and park it; the driver stays shippable behind --agent codex as experimental.

Related

#497 (epic) · #1058 · #1059 · #1057 (probe doc) · #972 (NEEDS_VERIFICATION hid bugs)


Release-graph plan — pre-2.16.0 blockers (2026-09-17)

Run 1 — 2026-09-16 (recorded 2026-09-17)

Subject #1064. Spec success (74s). Exec failure (805s): "exec left 5 file(s)
uncommitted and made no commits" — codex's workspace-write sandbox excluded .git/
(#1076, fixed on main by #1077 @ 34ddaa4). The uncommitted work was auto-committed to
archive/1064-gate-run1. Read against the #1064 matrix, its code is correct (forms
A–D pass, a bad message still blocks) and its test is weak (covers $(cat <<EOF),
not the -F - form that is the bug). Run log:
.sequant/logs/run-2026-09-16T06-04-25-6dc90bb3-*.json — at slot 99 of 100, copy it
before run 2 starts.

Run 2 — setup

Added gate question

  • G-7: worktree trust — record whether the phase worktree needed its own
    [projects."<path>"] entry in ~/.codex/config.toml (for run 2 it pre-exists; note
    what happens for a path that does not), and whether sequant should write it during
    worktree setup.

Reject route / fallback

NO-GO or a codex-caused failure → record the blocking finding on #497, keep the README's
"experimental, not a supported backend" wording for 2.16.0, and run #1064 as a Claude
issue salvaging archive/1064-gate-run1's code (fix known; ~1h). The 2.16.0 tag is not
blocked by the verdict either way — the verdict decides the release-note wording.

Activity

  1. added
    planned
    multi-agent
    on Sep 14, 2026
  2. admarble commented on Sep 16, 2026

    @admarble
    ContributorAuthor

    Gate prep — environment is ready, subject is #1064 (posted by graph-run)

    #1059 merged as 59bd9a89. Everything below was verified against the merged build on main.

    Verified

    • codex-cli 0.154.0 — exactly CODEX_MIN_VERSION; resolves on a clean login shell, so spawned phases will find it.
    • codex login status → Logged in using ChatGPT, so this run exercises the plan-auth path through exec, which the probe never ran (that is G-1's "record which"). ~/.codex/auth.json is machine-level, so every phase inherits it — no env-var plumbing needed.
    • doctor with run.agent: "codex" → both checks green (CLI + auth).
    • Global sequant (2.15.1) resolves to /Users/tony/Projects/sequant/dist/bin/cli.js, i.e. the merged dev build, not a published tarball.
    • Trust entries in ~/.codex/config.toml for the main checkout and the bug(hooks): commit validator strips # from a git commit -F - heredoc subject, blocking every type(#N): message sent via stdin #1064 worktree path (backup at ~/.codex/config.toml.bak).
    • Repo provisioned by hand: .agents/skills -> ../.claude/skills and .codex/config.toml (copied from templates/codex/config.toml). Deliberately not via sequant init --agent codex — initCommand calls createDefaultSettings() unconditionally, which would overwrite .sequant/settings.json and wipe the tuned phase policy (spec=sonnet, exec=sonnet/medium, qa=opus, timeout 5400). Worth its own issue.

    Step 1 before launching — commit the provisioning

    .agents/ and .codex/ are untracked. Worktrees are created from main, so exec and qa would run without them and Codex would load no hooks — silently voiding G-5. From the main checkout:

    git switch -c chore/codex-provisioning
    git add .agents .codex
    git commit -m "chore(#497): commit codex provisioning so worktree phases inherit skills and hooks"
    

    Then merge it (or run the gate on that branch). Nothing else blocks the launch.

    Step 2 — launch

    env -u CODEX_API_KEY sequant run 1064 --agent codex
    

    env -u drops the API key that is exported in your interactive shell, so the plan-auth path is unambiguous and the run cannot silently bill the API account instead. Expected branch/worktree: feature/1064-bug-hooks-commit-validator-strips-from-a-git-commi.

    Two things to expect: phases dispatched over MCP die at a hard 30-minute wall (this is a CLI run, so run.timeout 5400 applies instead), and the transcript JSONL lands under ~/.codex/sessions/<date>/ — that directory does not exist yet, so the newest file after the run is the one:

    find ~/.codex/sessions -name '*.jsonl' -newermt '-2 hours' | sort | tail -3
    

    Recording sheet

    • G-1 end-to-end. spec → exec → qa completes. Record wall time and turn.completed.usage totals from the JSONL. On plan auth there is no per-run dollar figure in a provider dashboard — record tokens and note the auth path instead of a $ number.

    • G-2 skill-body fidelity. The yardstick is measured: .claude/skills/qa/SKILL.md is 176,271 bytes. Compare against what the transcript shows Codex actually read. Context: opencode truncated a skill body at ~51K of 175K, so a clamp here is a live possibility — if it clamps, does /qa still act on the deep sections (verdict-floor phrases, §6i mutation record)?

    • G-3 harness-specific references. Pre-answered for free — 7 of 21 skills, matching the issue's count:

      assess      AskUserQuestion
      exec        Agent(subagent_type
      fullsolve   nested Skill(skill: "sequant:…")
      improve     AskUserQuestion
      qa          Agent(subagent_type
      testgen     Agent(subagent_type
      verify      AskUserQuestion
      

      For this run only exec and qa matter. What remains for you: note whether each reference caused a stall or improvisation in the transcript, versus being read past harmlessly. That is the part the grep cannot answer.

    • G-4 gh under the sandbox. Did gh issue comment succeed with network_access = true under [sandbox_workspace_write], or did it need danger-full-access?

    • G-5 hook deny path. A deliberate git push --force inside a phase must exit 2 and be refused, visible in the JSONL. Requires step 1 — without the committed .codex/config.toml in the worktree, the hooks never load and a pass here is meaningless.

    • G-6 resume across phases. spec → exec in the same worktree should resume the thread (canResume true); a forced cwd change must not.

    Verdict

    Post GO/NO-GO here. GO files P2/P3 (Codex [mcp_servers] for sequant serve; .codex/agents or harness-neutral wording for the subagent-spawning skills; marketplace distribution). NO-GO records the blocking finding on #497 and parks it, with the driver staying shippable as experimental behind --agent codex.

  3. added a commit that references this issue on Sep 16, 2026
  4. admarble commented on Sep 16, 2026

    @admarble
    ContributorAuthor

    Gate run 1 — exec failed. Root cause: codex's workspace-write sandbox cannot write a git worktree's index

    env -u CODEX_API_KEY sequant run 1064 --agent codex, 2026-09-16. spec 1:14 ✓ → exec 13:26 ✗ (exec left 5 file(s) uncommitted and made no commits). Log: run-2026-09-16T06-04-25-6dc90bb3-*.json. Transcript: ~/.codex/sessions/2026/09/16/rollout-2026-09-16T01-06-04-01a0a8d2-*.jsonl.

    This is a harness incompatibility, not a model failure. Codex did the work correctly.

    The finding

    A git worktree keeps its metadata in the main repo: .git in the worktree is a pointer file reading

    gitdir: /Users/tony/Projects/sequant/.git/worktrees/1064-bug-hooks-…
    

    workspace-write makes only the workspace (the worktree) writable, so every index write lands outside the sandbox. From the transcript, cell 25:

    fatal: Unable to create '/Users/tony/Projects/sequant/.git/worktrees/1064-…/index.lock': Operation not permitted
    fatal: Unable to create '/Users/tony/Projects/sequant/.git/worktrees/1064-…/index.lock': Operation not permitted
    

    Two fatals: one for git add, one for git commit. The agent saw them, tried again, and ended the phase with correct work it was structurally unable to commit. Sequant's #1032 guard then auto-committed it as 8176c659.

    Reproduced deterministically at $0, no model call, using codex sandbox:

    $ codex sandbox -- /bin/sh -c 'cd <worktree> && git add probe.txt && echo ADD_OK || echo ADD_FAILED'
    fatal: Unable to create '…/index.lock': Operation not permitted
    ADD_FAILED
    
    $ codex sandbox -c 'sandbox_mode="danger-full-access"' -- /bin/sh -c '… git add probe.txt …'
    ADD_OK
    

    -c 'sandbox_workspace_write.writable_roots=["…/.git"]' did not help — the override appears not to reach the sandbox subcommand, so writable_roots still needs testing through codex exec before being ruled out.

    What this means for the driver

    CodexDriver defaults to DEFAULT_SANDBOX_MODE = "workspace-write" (codex.ts:83), and run.codex.sandboxMode already accepts "danger-full-access" (settings.ts:161). So the gate can be re-run today by setting:

    "run": { "codex": { "sandboxMode": "danger-full-access" } }
    

    That trades away the sandbox entirely, which is a real cost: sequant's guard hooks were meant to be the safety net inside a sandbox, not instead of one. Worth resolving before any GO:

    1. Does sandbox_workspace_write.writable_roots work through codex exec? If the main repo's .git can be added, workspace-write survives and this becomes a driver default rather than a retreat.
    2. If not, a clone instead of a worktree makes the git dir local and keeps workspace-write intact — a bigger change to sequant's isolation model, but it fits the sandbox rather than fighting it.

    Answers so far

    • G-1 end-to-end: ✗ not yet. spec completed; exec produced correct edits but could not commit. Auth path: ChatGPT plan (codex login), as intended. Exec turn usage: 1,944,723 total tokens (1,844,480 cached input, 8,617 output). Rate-limit metadata in the transcript reports "plan_type": "free" and has_credits: false — worth checking against what you expect to be billed.
    • G-3 harness references: pre-answered by grep — 7 of 21 skills. Nothing in this transcript shows a stall caused by them; exec read .claude/skills/exec/SKILL.md in six sequential chunks (sed -n '1,240p', '241,520p', … '1901,2300p') and acted on it. That is a genuine signal for G-2: no clamp, and the skill body was consumed in full, by paging rather than one read.
    • G-5 hook deny path: untested — the run never got far enough.
    • G-4 / G-6: untested.

    Not the cause (checked)

    • The fnm noise on every command (error: Can't create the symlink for multishells …) is harmless: npm run lint completes normally under the same sandbox.
    • Sequant's pre-tool.sh did not block the commit — fed the exact command it ran, the hook exits 0 in 0.13s.
    • Output capture worked throughout: the async exec/wait pair returned every command's output, including both fatals.
  5. admarble commented on Sep 16, 2026

    @admarble
    ContributorAuthor

    Correction to the run-1 analysis — the cause is narrower, and the fix is a one-liner

    Two errors in my previous comment, both from trusting codex sandbox as a $0 oracle without checking its defaults.

    1. codex sandbox defaults to read-only, not workspace-write. So the "reproduction" I reported was a read-only denial, where everything fails — it did not reproduce the exec policy. Re-tested with -c 'sandbox_mode="workspace-write"', which is what the driver actually passes.

    2. The cause is not "the worktree's git dir lives outside the workspace." Under workspace-write, codex makes the workspace writable but excludes .git/:

    $ codex sandbox -c 'sandbox_mode="workspace-write"' -- sh -c 'touch plain_ok; touch .git/probe'
    plain file: WRITABLE
    .git/: DENIED
    

    That is a deliberate protection, and it means no git repo can be committed to under workspace-write — worktree or not. I verified a plain git clone, with its .git directly inside the workspace, fails identically. So "use a clone instead of a worktree", which I floated as remedy 2, does not help at all.

    Verified matrix (all $0, no model calls)

    Setup sandbox_mode Result
    worktree read-only (subcommand default) denied — not a valid reproduction
    worktree workspace-write fatal: Unable to create '…/index.lock'
    plain clone, .git inside the workspace workspace-write same failure
    plain file in the workspace workspace-write writable
    worktree + writable_roots=["<main>/.git"] workspace-write ADD_OK
    worktree danger-full-access ADD_OK

    The fix

    writable_roots works, contrary to what I reported — my earlier attempts failed because codex sandbox ignores the flag while defaulting to read-only, not because the key is unsupported. Passing the repo's git dir as a writable root keeps the sandbox intact and needs no settings change from users:

    codex exec … -c 'sandbox_workspace_write.writable_roots=["<git-common-dir>"]' …
    

    CodexDriver can derive that per run (git rev-parse --git-common-dir, which resolves to the main .git for a worktree) and pass it whenever sandboxMode is workspace-write. danger-full-access stops being necessary, which matters: the guard hooks were designed to run inside a sandbox, not instead of one.

    This is a blocking defect in the driver — without it, every codex phase ends unable to commit — so it should be fixed and the gate re-run before any GO/NO-GO judgment. The G-2 signal from run 1 still stands: exec read the full exec/SKILL.md in six sequential chunks with no clamp.

  6. added 2 commits that reference this issue on Sep 16, 2026
  7. admarble commented on Sep 18, 2026

    @admarble
    ContributorAuthor

    Gate runs 2 + 3 — record (verdict left to the owner)

    Run 2 — env -u CODEX_API_KEY sequant run 1064 --agent codex, 2026-09-18 12:31Z. spec ✓ 146s → testgen ✓ 96s → exec ✗ 349s: codex turn failed: You've hit your usage limit … try again at Oct 16th. The ChatGPT account is on the free plan (plan_type: "free", 30-day window); run 1 had already spent part of it and spec left it at 52%. Exec committed 819d30c0 itself before the limit hit.

    Run 3 — sequant run 1064 --agent codex --phases exec,qa with CODEX_API_KEY exported (API billing; the transcripts carry no plan rate-limits, confirming the key was used). Model gpt-6-astra. exec ✓ 1,353s → qa ✗ 735s, AC_NOT_MET.

    Logs: run-2026-09-18T12-31-04-2ea6990e-*.json, run-2026-09-18T13-28-01-357f0888-*.json. Transcripts: ~/.codex/sessions/2026/09/18/rollout-2026-09-18T07-3* (run 2), rollout-2026-09-18T08-* (run 3).

    What QA said

    AC-1…AC-5 MET (351/351 hook tests, build, three identical mirrors); no implementation defect found. AC-6 NOT_MET plus missing AC-1/AC-2 mutation records — both because no PR exists to hold them. Exec declined to open one because its broad verification did not pass (see "Exec's red suite" below). The verdict is correct for the state it was given, and the report is thorough and honest: it ran independent mutation smoke checks, labelled them supplemental rather than a substitute for the required record, and emitted a structured SEQUANT_QA_GAPS marker.

    Gate answers

    Gate Answer
    G-1 end-to-end ✗ — spec → testgen → exec → qa all ran, but no PR. Wall: spec 146s, testgen 96s, exec 1,353s, qa 735s. Tokens (API): exec 4.17M total (4.09M cached input, 10.5K output); qa 2.04M + 0.23M across 3 subagents. Run 2 (plan): spec 0.53M, testgen+exec 2.52M. $ from the OpenAI dashboard. Auth: plan auth works through exec, but the free tier cannot carry one full run.
    G-2 skill-body fidelity ✅ with a caveat. A single cat of a skill is clamped at max_output_tokens: 12000 (qa/SKILL.md is 176,271 bytes / 3,754 lines). The agent then builds a heading index (rg -n '^#{1,4} ') and reads deep sections by line range — Small-Diff Fast Path (l.1126), §6j (l.2554), §7 verdict (l.2597+), §8 (l.2904) — and demonstrably acts on them. Run 2 instead paged exec/SKILL.md in 7 sequential sed chunks. No section went unread for lack of access.
    G-3 harness references ✅ Agent(subagent_type maps onto Codex's native subagents: qa spawned type_checks, scope_checks, security_checks; testgen spawned parse_criteria. No stall or improvisation traced to Task(/AskUserQuestion/nested Skill( in exec or qa. List of skills needing harness-neutral wording: none required by this run.
    G-4 gh under the sandbox ✅ network_access = true under workspace-write suffices — gh issue view and gh issue comment worked (spec + testgen comments on #1064). danger-full-access not needed.
    G-5 hook deny path ✅ observed organically rather than via the planned force-push: exec ran `printenv
    G-6 resume ✅ testgen → exec → loop continued one thread in the worktree (run 2). spec, in the main checkout, got its own thread. qa always starts fresh — by design (#982), not a resume failure.
    G-7 worktree trust Not exercised — the [projects."<worktree>"] entry pre-existed. Open question stands.

    Exec's red suite — not the sandbox

    Exec reported 7 failures in files the diff never touched and timed out lint/build. I first read this as sandbox damage; that was wrong. Measured at $0:

    • The same three files under codex sandbox with the driver's exact workspace-write + writable_roots + network_access config: 76/76 pass.
    • Outside any sandbox, but with the phase env the orchestrator injects for every driver (phase-executor.ts:1458): 2 fail — prompt-wait.test.ts breaks on SEQUANT_ORCHESTRATOR=sequant-run, batch-executor.test.ts ("returns the input config unchanged when onProgress is undefined") on SEQUANT_WORKTREE. The suite is not hermetic against the env its own phases run under; this is driver-agnostic.
    • The other 5 (2 cli-ui minimal-mode, 3 slow batch-executor cases at 7–10s) did not reproduce in isolation; exec had several vitest runs plus lint in flight concurrently, which fits the timeouts. Unexplained, not attributed.

    Other finding

    Run 2's usage-limit failure was classified category: "unknown", isRetryable: false — the driver wraps any turn.failed as a generic SequantError (codex.ts:323), so the orchestrator cannot tell quota exhaustion from a code failure, and the spec-requested quality loop ran straight into the same limit 4.7s later.

    Recommendation

    Every harness mechanic the gate asked about works, and skill fidelity is good — QA under Codex caught exactly what it should. Nothing observed is a Codex-caused NO-GO. The one thing that kept G-1 from a clean pass is sequant-side (non-hermetic tests). My read is GO, driver stays experimental until a clean end-to-end run produces a PR — but the verdict is yours.

    Follow-ups filed and #1064's PR: see the next comment.

  8. admarble commented on Sep 18, 2026

    @admarble
    ContributorAuthor

    Follow-ups from the run 2 + 3 record above:

    G-1 remains open: no run has yet gone spec → exec → qa → PR unaided. #1086 is the blocker for that; the GO/NO-GO verdict is still the owner's.

  9. admarble commented on Oct 17, 2026

    @admarble
    ContributorAuthor

    Checklist line for this gate (from graph-2026-10-freeze-c planning, #1492; not a graph node):

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    multi-agentplanned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions