Skip to content

feat(opencode): open OpenCode 2.x in the structured chat too - #26395

Merged
brennanb2025 merged 3 commits into
mainfrom
brennanb2025/acp-opencode-2x
Oct 8, 2026
Merged

brennanb2025 merged 3 commits into
mainfrom
brennanb2025/acp-opencode-2x

Conversation

@brennanb2025

@brennanb2025 brennanb2025 commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 8 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​114 $\color{#cf222e}{\Huge{\mathbf{−}}}$​19 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​95
Prod 6 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​18 $\color{#cf222e}{\Huge{\mathbf{−}}}$​20 $\color{#cf222e}{\Huge{\mathbf{−}}}$​2

ELI5

With Settings > Chat UI > "Use updated structured native chat" on, OpenCode 1.x already opens in Orca's own chat view. OpenCode 2.x (what Homebrew's opencode installs today) still fell back to the terminal chat. This lets stable OpenCode 2.x open in the chat view too.

What Changed

The problem. The OpenCode chat view (#25845) refused every OpenCode 2.x on purpose. It assumed 2.x's opencode acp runs inside the user's shared OpenCode background service, which a chat's own settings (environment, account) cannot reach. That assumption was wrong. OpenCode 2.x's acp command starts its own private opencode serve --stdio as a child process. That child inherits the chat's environment and ends when the chat closes. This was verified in OpenCode's 2.x source and by running the installed 2.0.14.

What is different for you.

  • OpenCode 2.x from 2.0.14 opens in the chat view, with the same setup as 1.x: the Command setting, the per-agent environment, and Orca-managed accounts.
  • OpenCode 1.x from 1.18.31 is unchanged.
  • Older 2.x, pre-releases and anything unreadable keep the terminal chat.
  • The separate opencode2 agent (a binary named opencode2) is unchanged and keeps its terminal chat.
  • Permission cards now show OpenCode's own words for its "always" option, "Always allow". They used to show Orca's own "Allow until OpenCode restarts", which is wrong on 2.x: live QA showed the 2.x grant carries over to new chats.

How.

  • acp-launch-specs.ts: OpenCode's version check now accepts two release lines, stable 1.x from 1.18.31 and stable 2.x from 2.0.14, using the existing shared version helper.
  • The OpenCode-only relabel hook for permission options (permissionOptionLabel) is removed. Every ACP agent's option names now come from the agent, as Grok's already did.
  • Restart recovery needed no change. The stored-message reader already reads 2.x's session_v2 tables first. New tests cover a database an upgrade left with both table generations, and a 2.x message table with an unknown shape (it finds nothing and raises no error).

Why

The common pattern runs opencode acp for every OpenCode release with no version gate, and shows the agent's own permission options in its generic way.

Differences from the common pattern:

  • Intended: a minimum version is still required: 1.18.31 on 1.x, and 2.0.14 on 2.x. 2.0.14 is the release verified to start the private server. Releases 2.0.0–2.0.13 are untested, so they keep the terminal chat; lowering the minimum is a one-line change once one is checked.
  • Temporary: on 2.x, OpenCode's question tool cannot be switched off (1.x honours OPENCODE_ENABLE_QUESTION_TOOL=false; 2.x has no such switch). Asking it to use that tool ends the turn after about 2 seconds as "Interrupted". It doesn't hang, and the chat keeps working. Supporting OpenCode's questions over the Agent Client Protocol is the follow-up.

Linked Issue

Follow-up to #25845 (OpenCode over the Agent Client Protocol); no separate issue.

Visual Proof

Live QA in a hidden Orca build of 71fbef50061 (the version change; the label change came after it) on macOS, with OpenCode 2.0.14 selected through the Command setting. The QA machine's real ~/.codex, ~/.claude, ~/.orca, ~/.grok and OpenCode login were hashed before and after every check, and none of them changed.

Check Result Screenshot
New tab > OpenCode opens the chat view; Orca logs --version: 2.0.14 is supported; opencode acp runs with its own opencode serve --stdio child and no new shared service; replies V2-OK Pass Q1
Shell command printf hi; exit 3: the permission card is approved; the row shows hi and exit code 3 Pass Q2
File edit: card approved, the file lands with its content, no stray rows Pass Q4
Stop during sleep 30: "Interrupted", file never written, both OpenCode processes end within 1 s, the next message runs on new processes and remembers the conversation Pass Q6
Quit Orca mid-chat, relaunch, reopen: history shown once, the remembered word is recalled, no leftover OpenCode processes Pass Q7
"Always" approval: later commands in that chat and in a NEW chat run without a card (the grant is OpenCode's, kept beyond the chat), which is why the label now says "Always allow" Found, fixed after QA n/a
Asking OpenCode to use its question tool: the turn ends as "Interrupted after 2s", no hang, the chat keeps working Known (see Why) Q5

Not verified live: OpenCode 2.0.0–2.0.13, an Orca-managed OpenCode account on 2.x, Windows, Linux, SSH and mobile. The "Always allow" label change was not re-run live; the dialect and recording tests cover it.

Testing

  • I manually tested these changes locally

  • Automated tests added/updated, or explained why not below

  • Version gate: a table of admitted and refused versions (structured-agent-launch-support.test.ts); 2.0.21 launches opencode acp and 3.0.0 is refused before spawning (acp-structured-launch-resolution-opencode.test.ts); a real --version probe against stand-in binaries admits 2.0.21 (structured-agent-launch-support-probe.test.ts, structured-agent-create-support-opencode-rig.test.ts).

  • Recovery: an upgraded database returns only the live 2.x message; an unknown 2.x table shape returns nothing (opencode-acp-stored-messages.test.ts).

  • Labels: OpenCode's own option names show on the card (acp-timeline-opencode-dialect.test.ts, acp-structured-opencode-recordings.test.ts).

  • CI on the final head 0c0179dd398: every check passed (18 passed, 17 skipped). That head also lists the recovery test file among the tests that use a real SQLite database, as the repo requires.

  • Locally on e7f2035278f: node typecheck, lint, and the changed-code quality gate pass. 47 of 48 test files pass (all ACP tests plus launch support, version probe and recovery). The 48th, structured-agent-launch-support-probe.test.ts, failed once under heavy machine load (it runs a real --version with a time limit) and passed 5/5 on its own.

`opencode acp` on stable 2.x starts its own private `opencode serve --stdio`
child with the chat's environment and ends it when stdin closes, so the
chat's account pin reaches it just as it does on 1.x. Admit stable 2.x from
2.0.14 beside stable 1.x from 1.18.31; pre-releases, older releases, and
other major lines keep the terminal chat. The `opencode2` agent is unchanged.

Restart recovery already reads a 2.x session's own tables first; tests now
cover a database an upgrade left with both generations, and one whose 2.x
message table has an unknown shape (nothing found, no error).
@brennanb2025
brennanb2025 marked this pull request as ready for review October 8, 2026 02:58
@brennanb2025

Copy link
Copy Markdown
Contributor Author

Status: ready. OpenCode 2.x (from 2.0.14) now opens in the structured chat, with the same setup as 1.x.

  • Live QA on OpenCode 2.0.14 passed. The chat opens, with OpenCode's own private server and not your shared one. Shell output and exit codes show in tool rows. Edits land. Stop ends both OpenCode processes. A chat survives an Orca restart. Screenshots are in the description.
  • Found in QA and fixed here: OpenCode's "always" option was relabelled "Allow until OpenCode restarts", which is wrong on 2.x, where the grant carries into new chats. Cards now show OpenCode's own "Always allow".
  • Known and tracked as temporary: on 2.x, asking OpenCode to use its question tool ends that turn as "Interrupted" after about 2 seconds, because 2.x has no switch to turn the tool off. It doesn't hang, and the chat keeps working.
  • CI on 0c0179dd398 passed every check. The first run failed one guard test, because the new recovery tests use a real SQLite database and weren't yet in the list of tests that do. Fixed in that commit.

@coderabbitai

coderabbitai Bot commented Oct 8, 2026

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: c20eb4b5-bebb-43dd-b510-86e6d3bbfbe2
📥 Commits

Reviewing files that changed from the base of the PR and between b0fbcfd and 0c0179d.

📒 Files selected for processing (14)
  • config/scripts/vitest-sqlite-runtime-files.mjs
  • src/main/acp/acp-dialects/acp-dialect.ts
  • src/main/acp/acp-dialects/opencode-dialect.ts
  • src/main/acp/acp-launch-specs.ts
  • src/main/acp/acp-structured-launch-resolution-opencode.test.ts
  • src/main/acp/acp-structured-opencode-recordings.test.ts
  • src/main/acp/acp-timeline-opencode-dialect.test.ts
  • src/main/acp/acp-timeline-requests.ts
  • src/main/opencode/opencode-acp-stored-messages.test.ts
  • src/main/opencode/opencode-acp-stored-messages.ts
  • src/main/runtime/structured-agent-create-support-opencode-rig.test.ts
  • src/main/runtime/structured-agent-launch-support-probe.test.ts
  • src/main/runtime/structured-agent-launch-support.test.ts
  • src/main/runtime/structured-agent-runtime-registrations-acp.test.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 8 remain after this review.


📝 Walkthrough

Walkthrough

OpenCode ACP support now accepts stable 1.x releases from 1.18.31 and stable 2.x releases from 2.0.14. Permission-option presentations use the option name instead of a dialect-specific label. New stored-message tests cover 2.x message selection and an unrecognized 2.x message-table schema.

Priority: ➖ Normal

Merge Risk: ⚪ Minimal · up to 0c017

The OpenCode support changes are mergeable after normal checks; the unverified platforms and releases do not establish a current failure.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 28.57% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 7 functions across 14 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the main change: enabling OpenCode 2.x in the structured chat.
Description check ✅ Passed The description is detailed and mostly complete. It includes the user impact, implementation, rationale, linked issue reference, visual proof, testing results, limitations, and platform coverage. Some…
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Commit to this branch
  • Create a new PR
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@brennanb2025
brennanb2025 merged commit b1e0092 into main Oct 8, 2026
59 checks passed
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.

1 participant