Skip to content

Resume in New Native Chat for OpenCode - #28072

Merged
brennanb2025 merged 7 commits into
mainfrom
brennanb2025/pr28049-adopt-opencode
Oct 14, 2026
Merged

brennanb2025 merged 7 commits into
mainfrom
brennanb2025/pr28049-adopt-opencode

Conversation

@brennanb2025

@brennanb2025 brennanb2025 commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 9 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​281 $\color{#cf222e}{\Huge{\mathbf{−}}}$​130 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​151
Prod 19 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​228 $\color{#cf222e}{\Huge{\mathbf{−}}}$​76 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​152

Stacked on #28049; #28080 is stacked on this PR.

ELI5

OpenCode conversations started in a terminal could not continue in Orca’s native chat, even though Claude and Codex conversations could. This adds Resume in New Native Chat for OpenCode 1.x and 2.x Session History rows, using the existing chat adoption path.

What Changed

The action appears in Session History, the running terminal’s tab menu, and its pane header. It opens a new OpenCode chat with the earlier messages and continues the same conversation. Session History then opens the owning chat; a new terminal resume of that owned conversation is refused.

OpenCode keeps history in a database and pins an account by identity rather than a folder. The shared importer now accepts either account form. OpenCode reads the exact database its resumed chat will open, using the same shell environment, per-agent settings, and managed account precedence as the launch. The existing SQLite reader supplies stable message identities to the saved chat history. Both opencode and opencode2 rows map to the OpenCode chat provider, including terminal history lookup and pane availability.

The source must be local, have messages, and belong to the current workspace folder. The workspace must support an OpenCode chat. The tab and pane action require a running agent. The pane header checks recorded history and folder compatibility on click, as Claude/Codex already do; it can refuse then. Adoption leaves the source terminal running, also matching main’s Claude/Codex behavior.

Why

This extends one existing adoption path instead of adding an OpenCode-only creation flow or a second way of populating chat history. The host chooses the account and database; the client supplies only the conversation id. Looking through every sibling database would find conversations the installed chat process cannot reopen, so a sibling-only conversation is safely refused.

Intended UI choice: expand Orca’s existing terminal-to-chat control to OpenCode under the same rules, which is the requested parity change.

Intended limitations: a row’s OpenCode version may differ from the installed opencode; unsupported cross-version reopening can fail. A conversation only in a sibling/channel database is refused unless the chat’s effective environment selects it. Pi support comes in #28080.

Linked Issue

Follow-up to #27183 and #28049: every agent’s resume options should work like Claude/Codex.

Visual Proof

Hidden M4Air QA at 9973ba8dc993, using real OpenCode 2.0.21 with a local fake model and the prescribed OpenCode driver. The rebase onto #28049 preserves the renderer and OpenCode behavior; its internal argument rename and conflict resolutions were reviewed separately.

Running terminal header:
Running OpenCode header action

Running terminal tab menu:
Running OpenCode tab action

Imported history and a new reply:
OpenCode chat preserves and continues the conversation

After the source CLI exits:
Terminal resume action is absent after exit

Testing

The retained tests cover OpenCode chat creation with imported history, configured-database import/launch agreement, managed-account precedence, and the OpenCode 2 history lookup and pane action regressions; duplicate import cases and resolver/mock plumbing were removed. Focused tests and the full normal typecheck pass, and all local static checks pass except the documented Bun missing-check limitation; the earlier remote UI evidence and its stated limits remain unchanged.

Review

Independent correctness and architecture review, a dedicated performance/platform/mobile pass, fixes and a fresh final review. The shared design remains one coherent user action. Long-conversation import latency and peak memory are unmeasured; existing transcript capture bounds were verified in source.

Agent skill upstream boundary

  • No upstream skill source is copied into this change.

Notes

No new required wire field, stream operation, mobile route, account schema, dependency, or native module. SSH and WSL sources remain ineligible for this action. Folder workspaces are supported. Windows/Linux database paths use the existing resolver; live coverage is macOS.

Known existing History limitation: QA needed Refresh Session History before the adopted row showed its new count and Jump to Original Pane. Source comparison confirms the same generic refresh path on main for Claude/Codex; this PR preserves it.

Separate pre-existing main issue: plain Resume of an opencode2 row generates opencode2 --session …. This machine installs only opencode, so the generated command cannot run here. Command generation was verified at origin/main 1182168681db; a current-main UI click has not been run. This PR does not change plain terminal Resume.

Checklist

  • Focused on OpenCode terminal-to-chat adoption
  • User-facing change, mechanism and alternatives explained
  • Screenshots attached
  • Security, folder workspace, remoting and compatibility reviewed
  • Final verification recorded

Author: @BrennanKB5

@brennanb2025 brennanb2025 mentioned this pull request Oct 12, 2026
5 tasks done
@brennanb2025
brennanb2025 force-pushed the brennanb2025/pr27183-resume-in-new-chat branch from 7ed25ef to a1ddadf Compare October 12, 2026 22:37
@brennanb2025
brennanb2025 force-pushed the brennanb2025/pr28049-adopt-opencode branch 2 times, most recently from 4f24e9f to fc85ef1 Compare October 13, 2026 04:16
@brennanb2025
brennanb2025 marked this pull request as ready for review October 13, 2026 04:18
@brennanb2025
brennanb2025 force-pushed the brennanb2025/pr28049-adopt-opencode branch from 9973ba8 to 946684a Compare October 13, 2026 05:47
@brennanb2025

Copy link
Copy Markdown
Contributor Author

OpenCode terminal conversations had no path into a new native chat because the shared adoption flow accepted directory accounts and file transcripts. This PR extends that flow to OpenCode’s account identity and database, so a terminal conversation can continue in a chat with its earlier turns.

The full review loop fixed the configured-database mismatch between import and launch, plus the OpenCode 2 pane availability check. The earlier terminal-to-History alias fix was retained and passed live re-check. The parent rebase preserves its Grok/OMP context fields; a fresh narrow review found no production issue. No open PR findings remain.

Ready for review at 946684a9d0e, based on #28049 at 8923eec7406a; no merge. Verification: 180 affected tests and the full normal typecheck pass, and all 39 final PR checks are complete (21 passed, 18 skipped). An unchanged browser concurrency test initially failed because it assumes a file read finishes in 5 ms; a controlled read delay reproduced it, and one named job retry passed. That test reliability issue remains documented. Hidden M4Air QA used real OpenCode 2.0.21 with an isolated fake model and the prescribed OpenCode driver. Header and History-row adoption, new replies, owned-row navigation, duplicate terminal-resume refusal and post-exit controls passed; the tab item was observed, not clicked separately. Screenshots are attached in the PR description. The remote rig and temporary worktree are removed, and protected configuration hashes are unchanged.

Known existing limitations remain: History can require a manual Refresh after adoption; plain OpenCode 2 terminal Resume still generates opencode2 on main and fails on installations providing only opencode. OpenCode 1.x, credentialed model replies and Windows/Linux GUI were not tested live; large-history performance is unmeasured. The local static suite’s sole failure is the documented missing Bun check command; the normal typecheck passes.

@brennanb2025
brennanb2025 changed the base branch from brennanb2025/pr27183-resume-in-new-chat to main October 13, 2026 21:47
@brennanb2025
brennanb2025 force-pushed the brennanb2025/pr28049-adopt-opencode branch from 946684a to 7517d5b Compare October 13, 2026 21:51
@coderabbitai

coderabbitai Bot commented Oct 13, 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: 4290a42a-726f-4245-aef4-99daa9fd823c
📥 Commits

Reviewing files that changed from the base of the PR and between acc37898693ec8b4be0cf708076d41a2b57ecbe1 and 8102caa.

📒 Files selected for processing: 2
  • src/renderer/src/components/right-sidebar/ai-vault-session-resume-in-chat-launch.test.ts
  • src/renderer/src/components/right-sidebar/ai-vault-session-resume-in-chat-launch.ts

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

📝 Walkthrough

OpenCode now has a transcript importer that locates sessions in its configured database and supports journal import. Transcript adoption uses typed account-home values and launch environments. CLI history agents map to chat agents, including mapping opencode2 sessions to opencode for resume and history matching. Tests cover OpenCode transcript selection, adoption, import, and renderer behavior.

Priority: ➖ Normal

Merge Risk: ⚪ Minimal · up to 8102c

OpenCode 2 history rows map to the OpenCode chat agent, and resume is offered only when the target is supported. No incremental merge-blocking issue remains.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 20 functions across 31 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
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.
Title check Passed The title clearly and concisely identifies the main change: adding Resume in New Native Chat support for OpenCode.
Description check Passed The description is complete and focused. It covers the user impact, implementation, rationale, linked issues, visual proof, testing, limitations, compatibility considerations, and review status. The A…
  • Fix all pre-merge checks with AI
✨ Finishing Touches: 💡 2
📝 Generate docstrings: 💡
  • Commit to this branch
  • Create a new PR
🛠️ Fix failing CI checks: 💡
  • Commit to this branch
  • Create a new PR
  • Autofix · 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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1


ℹ️ Review info
⚙️ Run configuration
  • Configuration used: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: b34fc8d5-0f44-405c-92ee-bb7a4913c9a4
📥 Commits

Reviewing files that changed from the base of the PR and between 8a6d6ea and 7517d5b.

📒 Files selected for processing: 29
  • config/scripts/vitest-sqlite-database-runtime-files.mjs
  • src/main/acp/acp-launch-specs.ts
  • src/main/claude/claude-cli-conversations.ts
  • src/main/codex/codex-cli-conversations.ts
  • src/main/grok/grok-transcript-import.ts
  • src/main/native-chat/agent-session-journal/journal-legacy-import.ts
  • src/main/native-chat/agent-session-wire/structured-agent-session-adopted-import.test.ts
  • src/main/native-chat/structured-agent-cli-conversation-adoption.test.ts
  • src/main/native-chat/structured-agent-cli-conversations.ts
  • src/main/native-chat/structured-agent-session-history-adoption.test.ts
  • src/main/native-chat/structured-agent-session-history-adoption.ts
  • src/main/omp/omp-session-cwd-lookup.test.ts
  • src/main/omp/omp-transcript-import.ts
  • src/main/opencode/opencode-structured-account-home.test.ts
  • src/main/opencode/opencode-structured-account-home.ts
  • src/main/opencode/opencode-transcript-import.ts
  • src/main/runtime/orca-runtime-get-structured-agent-session-create-support.ts
  • src/main/runtime/orca-runtime-structured-agent-session-create-intent.test.ts
  • src/main/runtime/structured-agent-launch-support.ts
  • src/main/runtime/structured-agent-session-create-adoption.ts
  • src/renderer/src/components/right-sidebar/ai-vault-session-launch-actions.ts
  • src/renderer/src/components/right-sidebar/ai-vault-session-resume-in-chat-workspace.ts
  • src/renderer/src/components/right-sidebar/ai-vault-session-resume-in-chat.test.ts
  • src/renderer/src/components/right-sidebar/ai-vault-session-resume-in-chat.ts
  • src/renderer/src/components/tab-bar/tab-session-history-switch.test.ts
  • src/renderer/src/components/tab-bar/tab-session-history-switch.ts
  • src/renderer/src/components/terminal-pane/TerminalPaneResumeInChatButton.test.tsx
  • src/renderer/src/components/terminal-pane/TerminalPaneResumeInChatButton.tsx
  • src/shared/structured-agent-cli-conversation-adoption.ts

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

Comment thread src/main/opencode/opencode-transcript-import.ts
@brennanb2025
brennanb2025 force-pushed the brennanb2025/pr28049-adopt-opencode branch from 7517d5b to acc3789 Compare October 14, 2026 05:41
…ions

An OpenCode conversation started in the terminal now offers "Resume in New Native Chat" in its
Session History row menu and its tab's right-click menu, as Claude, Codex, Grok and OMP do: a new
OpenCode chat takes it over, showing its history and continuing it. OpenCode 2.x rows
(`opencode2`) and 1.x rows both open an OpenCode chat.

Two pieces kept OpenCode off the shared adoption path. Its account is a locator, not a folder, so
the transcript import now works over the account the chat pins, whatever its kind; the folder
agents wrap their lookups in directoryTranscriptImport, unchanged. Its conversations live in a
database, so the journal import reads the found database with the reader the OpenCode transcript
view already uses. OpenCode refuses to reopen a session from another folder, so the workspace rule
covers it too.
The pane reports `opencode` while Session History lists the conversation as `opencode2`, so the pane
header's and tab menu's Resume in New Native Chat found no row. Match by the chat agent that takes the
conversation over.
… chat starts

Both Resume in New Native Chat callers repeated the row-to-chat agent lookup. The launch now
takes the row agent and maps it once, so the Session History actions file stays unchanged.
@brennanb2025
brennanb2025 force-pushed the brennanb2025/pr28049-adopt-opencode branch from acc3789 to 8102caa Compare October 14, 2026 05:53
@brennanb2025 brennanb2025 reopened this Oct 14, 2026
@brennanb2025 brennanb2025 reopened this Oct 14, 2026
@brennanb2025 brennanb2025 reopened this Oct 14, 2026
@brennanb2025
brennanb2025 merged commit 76d1c68 into main Oct 14, 2026
116 of 139 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