Repository navigation
Migrate OpenCode integration to v2 - #69950
Conversation
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
|
✅ PR Code Quality Reviewer completed the code quality review.
|
|
✅ Design Decision Gate 🏗️ completed the design decision gate check. See the comment below for the result and any generated ADR draft. Design Decision Gate 🏗️Outcome: The agent completed and reported no action. A no-op output alone does not verify that all required work was completed or that publication was possible. Agent messages are omitted from this comment. The category uses structured run status, not interpretation of agent prose.
|
|
✅ Ponytail Reviewer completed successfully! Ponytail ReviewerOutcome: The agent completed and reported no action. A no-op output alone does not verify that all required work was completed or that publication was possible. Agent messages are omitted from this comment. The category uses structured run status, not interpretation of agent prose.
|
|
✅ Test Quality Sentinel completed test quality analysis. Test Quality SentinelOutcome: The agent completed and reported no action. A no-op output alone does not verify that all required work was completed or that publication was possible. Agent messages are omitted from this comment. The category uses structured run status, not interpretation of agent prose.
|
|
🧠 Matt Pocock Skills Reviewer has completed the skills-based review. ✅
|
Comment MemoryPeek at saved memory (pr-code-quality-reviewer)Note This comment is managed by comment memory.Expand the saved memory block to view or edit the persistent context for this thread.
|
There was a problem hiding this comment.
Verdict
Requesting changes because this migration still has two correctness regressions that can fail healthy OpenCode runs.
Blocking themes
- The new v2 MCP startup classifier promotes broad warning matches to hard failures.
- Live max-turn accounting still keys completed steps by transient part ids, so replayed completions can be double-counted.
- Static review only: I reviewed the diff and referenced source files, but I did not execute the workflow or tests.
🔎 Code quality review by PR Code Quality Reviewer · copilot · gpt54 · 39.8 AIC · ⌖ 6.01 AIC · ⊞ 12.7K
Comment /review to run again
|
@copilot run pr-finisher skill |
There was a problem hiding this comment.
Skills-Based Review 🧠
Applied /diagnosing-bugs and /codebase-design (triage fallback heuristic used — pr-triage agent was not invoked; classification derived directly from the diff/meta since this is a focused engine-migration PR). Approving: the migration is solid and well-tested, with only minor robustness/consistency nits left as inline comments.
📋 Key Themes & Highlights
Key Themes
- Inconsistent null-guarding (
opencode.mdline 221): unguardedentry.part.state.*access next to a guardedentry.part?.ida few lines later — a malformed/future CLI event could crash the harness with an unhelpfulTypeError. - Lost error context (
opencode.md~line 260): the session-exportexecFilefailure path discards the original error instead of attaching it via{ cause: error }, unlike the pattern used a few lines above for MCP-config parsing. - Scattered version-detection heuristic (
parse_opencode_log.cjsline 247, repeated at ~74/202/233): v1-vs-v2 format is inferred viatypeof part.partID === "string"checks copy-pasted at multiple call sites rather than centralized in one helper.
Positive Highlights
- ✅ Strong
/tddcoverage for the new session-export reconciliation path: valid recovery, malformed exports rejected, and explicit assertions that secrets/prompts/providerState are never leaked via export. - ✅ Max-turns detection correctly handles three distinct scenarios (live stream error, live step-count, and reconciled-steps fallback when the CLI omits all step_finish events) — each backed by a dedicated test.
- ✅ Config schema migration (
providers/agents/permissions/mcp.servers/experimental.policies) is applied consistently and documented inengines.md.
None of the findings are blocking; they are robustness/consistency improvements worth a quick follow-up.
🧠 Reviewed using Matt Pocock's skills by Matt Pocock Skills Reviewer · copilot · sonnet50 · 145.2 AIC · ⌖ 15.1 AIC · ⊞ 10.1K
Comment /matt to run again
There was a problem hiding this comment.
🔵 Needs a closer look
The major CLI migration changes runtime contracts and has unresolved correctness issues requiring human review.
5 open issues
Remove inherited PWD when running in engine.cwd · New Merge exported usage into observed steps without duplicate turns · New Enforce max-turn tool calls across all recovered steps · New Recover compaction accounting separately from assistant turns · New Include reasoning in exported output token totals · New
What changed in this PR
Migrates gh-aw’s OpenCode sample integration to v2, updating execution, MCP configuration, and session reporting.
Changes:
- Pins
@opencode/cli@2.0.26and enables standalone execution. - Adopts native v2 configuration and event parsing.
- Adds usage recovery, failure checks, tests, and migration documentation.
| File | Description |
|---|---|
pkg/workflow/opencode_workflow_test.go |
Updates package, version, and execution assertions. |
docs/src/content/docs/reference/engines.md |
Documents v2 behavior and limitations. |
actions/setup/js/parse_opencode_log.test.cjs |
Covers v2 events and export projection. |
actions/setup/js/parse_opencode_log.cjs |
Parses v2 identities, failures, and recovered steps. |
actions/setup/js/opencode_workflow.test.cjs |
Tests configuration, reconciliation, and failure handling. |
.github/workflows/smoke-opencode.md |
Updates runtime configuration checks. |
.github/workflows/smoke-opencode.lock.yml |
Regenerates the smoke workflow for v2. |
.github/workflows/shared/opencode.md |
Implements the v2 engine configuration and harness. |
.github/workflows/engine-conformance-opencode.lock.yml |
Regenerates conformance execution for v2. |
.github/workflows/daily-security-red-team.lock.yml |
Updates agent and evaluator execution. |
.changeset/patch-opencode-v2.md |
Adds the migration release note. |
Review effort: Max
Reconcile assistant replays and compaction usage without duplicate turns, normalize v2 reasoning totals, require explicit MCP failure status, and honor configured working directories. Preserve safe export diagnostics and regenerate runtime harnesses. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
|
No separate code change is needed for this status notice. The MCP failure-classification and replay-accounting findings are addressed in their respective inline threads. |
|
No ADR or code change is requested by this no-action result. I treated it as informational, not as evidence that the remaining review findings were resolved. |
|
No code change is needed for this no-action reviewer notice. The actionable findings from the other reviews are handled separately. |
|
This no-action notice needs no separate code change. Added regressions cover replayed completions, exported usage and compaction accounting, reasoning totals, working-directory handling, and transient versus terminal MCP failures. |
|
No separate change is needed for the completion notice. The defensive event guard, safe export-error context, and centralized v2 part detection are addressed in the inline threads. |
|
Addressed both recorded themes: explicit terminal MCP failure classification and stable message-based replay accounting. Left the bot-managed memory and metadata unchanged. |
|
Ran pr-finisher, fixed the actionable review findings, validated locally, and pushed the batch without merging or changing PR readiness. The prior CI snapshot contained no failed checks, only superseded cancellations; CI for the new commit remains unverified. |
Completed the finisher pass and pushed |
|
🎉 This pull request is included in a new release. Release: |

Why
OpenCode 2 changes its npm package, runtime configuration, and event behavior. Migrate the sample integration using the official v1 migration guide so workflow execution, MCP tools, and session reporting continue to work.
Approach
@opencode/cli@2.0.26and userun --standaloneto avoid reusing a background server with stale configuration or credentials.Version and migration notes
2.0.26was the newest version available from the configured npm registry during validation and is outside the three-day release cooldown. The upstream changelog lists newer releases. V2 does not run LSP servers, and v1 plugins require porting to its new API. Provider restrictions use theexperimental.policieslocation supported by this pin.Validation
make agent-report-progresspassed, including impacted Go/JavaScript tests, scoped lint, schema freshness, and workflow drift checks.make fmt,make fmt-cjs,make lint-cjs,make build, andmake recompilepassed.go test ./pkg/workflow -run '^TestOpenCodeSample' -count=1passed.npm run typecheckpassed../gh-aw compile smoke-opencode engine-conformance-opencode --strict --no-check-updatepassed with existing model-alias warnings.