Skip to content

feat(#862): opencode agent driver — fixture-proven NDJSON parser, skill-load gate, init/doctor/resume wiring - #1011

Merged
admarble merged 18 commits into
mainfrom
feature/862-feat-add-opencode-agent-driver-first-backend-that-
Sep 8, 2026
Merged

admarble merged 18 commits into
mainfrom
feature/862-feat-add-opencode-agent-driver-first-backend-that-

Conversation

@admarble

@admarble admarble commented Sep 8, 2026 •

Copy link
Copy Markdown
Contributor

Summary

First non-Claude agent driver: sequant run <n> --agent opencode dispatches every phase through a driver whose NDJSON parser was built against the recorded fixture from the #992 spike (src/lib/workflow/drivers/__fixtures__/opencode-run-qa.ndjson), never the README. Closes #862 (the P0 slice, graph-2026-09 node 12; P1 fidelity and the dogfood gate are #996 / #997).

  • src/lib/workflow/drivers/opencode.ts (new) + one registry line: concatenates text events into output, maps error events to a structured failure, and returns success only when the skill-load marker is present — a stream with no marker yields the distinct skill-not-loaded error (AC-4), not a parsed verdict.
  • run.opencode: { model, variant, extraArgs, reasoningMaxTokens } settings seam, passed through config-resolver untouched; ExecutionConfig gains opencodeSettings and the producer-parity test asserts it (AC-9).
  • Spawn applies the spike(opencode): does opencode run --command <phase> load the sequant skill? (#862 P0 precondition, resolves OQ-8/OQ-9) #992 mitigations (AC-8): reasoning budget via OPENCODE_CONFIG_CONTENT, detached: true, per-run XDG_CONFIG_HOME. No /tmp allow/deny rule is injected — the spike refuted that trap on 1.18.27 (OQ-19, accepted), and the AC-8 test asserts its absence.
  • sequant init --agent opencode writes .opencode/commands/<phase>.md for every phase entrypoint from a single template (AC-5); doctor checks the binary and the pinned 1.18.27 floor (AC-7); resume handles round-trip and are rejected from a different cwd (AC-6).
  • Live smoke (AC-2) skips — never passes — when the binary or a provider key is absent; on this machine it ran against real opencode 1.18.27 with the model pinned so it tests the driver, not the machine.

Provenance

The exec phase's first attempt was killed by the MCP launcher's 30-minute no-progress ceiling at 05:02Z and its worktree deleted; the committed work (8 commits) was pushed and the re-dispatch resumed on it. After QA the branch was rebased onto main (post-#935), which diverged from the pushed lineage; rather than force-push, c7b30367 is an -s ours merge that makes the pushed lineage an ancestor with the tree unchanged. Squash on merge.

Acceptance criteria — runner-verified at c7b30367 (tree identical to the QA'd e60c7164 rebased onto bdf32be6)

AC Verify (verbatim from node 12) Result
AC-1 npx vitest run src/lib/workflow/drivers/opencode.test.ts -t "862" 29 passed
AC-2 opencode.live.integration.test.ts 1 passed, 2 skipped (skip contract exercised; binary present here)
AC-3 node dist/bin/cli.js run 1 --agent opencode --dry-run (from an initialized checkout, after npm run build); drivers/index.test.ts -t "862" prints Driver: opencode per phase, no spawn; 3 passed
AC-4 opencode.test.ts -t "862 AC-4" 6 passed (skill-not-loaded distinct error)
AC-5 init --agent opencode in a temp repo; grep -rl 'opencode/commands' src/commands/init.ts templates | wc -l 9 wrappers written (exec loop merger qa security-review spec test testgen verify); template lives in exactly 1 place
AC-6 resume-semantics.test.ts -t "opencode" 5 passed
AC-7 doctor.test.ts -t "opencode" 5 passed
AC-8 opencode.test.ts -t "862 AC-8" 5 passed
AC-9 execution-config-parity.test.ts 11 passed

Mutation verification (gate-test ACs)

Performed by the QA session on the QA'd commit e60c7164 (tree restored clean after each; the QA agent could not record them because no PR existed at the time), re-stated here as the record:

Mutation-verified: AC-1 — emptied __fixtures__/opencode-run-qa.ndjson; src/lib/workflow/drivers/opencode.test.ts failed; restored.

Mutation-verified: AC-2 — skipReason() no longer returns the SKIPPED token; src/lib/workflow/drivers/opencode.live.integration.test.ts failed; restored.

Mutation-verified: AC-4 — disabled the !parsed.skillLoaded guard in evaluateOpencodeRun; src/lib/workflow/drivers/opencode.test.ts failed (2 tests); restored.

QA

AC_MET_BUT_NOT_A_PLUS (iteration 1, commit e60c7164). The single reason it was not READY_FOR_MERGE was the missing mutation record above, which this body supplies.

🤖 Generated with Claude Code

…e machine (AC-2)

Opted in on a machine whose default OpenRouter model lacks tool use, the live
smoke failed 404 at the provider before generating a token — a red tick that
said nothing about this driver. OPENCODE_LIVE_MODEL pins a tool-capable model,
and the assertion now surfaces PhaseResult.error instead of 'expected 0 to be
greater than 0'.

Verified live against opencode 1.18.27: 3 passed, real NDJSON, real resume handle.

Entire-Checkpoint: 529a87e4e77c
@admarble
admarble merged commit 56ed196 into main Sep 8, 2026
6 checks passed
@admarble
admarble deleted the feature/862-feat-add-opencode-agent-driver-first-backend-that- branch September 8, 2026 06:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: add opencode agent driver — first backend that can inherit the full skill methodology

1 participant