Repository navigation
feat(opencode): open OpenCode 2.x in the structured chat too - #26395
Conversation
`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).
|
Status: ready. OpenCode 2.x (from 2.0.14) now opens in the structured chat, with the same setup as 1.x.
|
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configuration
📒 Files selected for processing (14)
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 8 remain after this review. 📝 WalkthroughWalkthroughOpenCode 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 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)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
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. Comment |
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
opencodeinstalls 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 acpruns 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'sacpcommand starts its own privateopencode serve --stdioas 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.
opencode2agent (a binary namedopencode2) is unchanged and keeps its terminal chat.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.permissionOptionLabel) is removed. Every ACP agent's option names now come from the agent, as Grok's already did.session_v2tables 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 acpfor every OpenCode release with no version gate, and shows the agent's own permission options in its generic way.Differences from the common pattern:
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,~/.grokand OpenCode login were hashed before and after every check, and none of them changed.--version: 2.0.14 is supported;opencode acpruns with its ownopencode serve --stdiochild and no new shared service; repliesV2-OKprintf hi; exit 3: the permission card is approved; the row showshiand exit code 3sleep 30: "Interrupted", file never written, both OpenCode processes end within 1 s, the next message runs on new processes and remembers the conversationNot 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 launchesopencode acpand 3.0.0 is refused before spawning (acp-structured-launch-resolution-opencode.test.ts); a real--versionprobe 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--versionwith a time limit) and passed 5/5 on its own.