Repository navigation
Resume in New Native Chat for OpenCode - #28072
Conversation
7ed25ef to
a1ddadf
Compare
4f24e9f to
fc85ef1
Compare
9973ba8 to
946684a
Compare
|
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 Known existing limitations remain: History can require a manual Refresh after adoption; plain OpenCode 2 terminal Resume still generates |
946684a to
7517d5b
Compare
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Walkthrough
Priority: ➖ Normal Merge Risk: ⚪ Minimal · up to
|
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
- Configuration used: Repository UI
- Review profile: CHILL
- Plan: Advanced
- Run ID:
b34fc8d5-0f44-405c-92ee-bb7a4913c9a4
📒 Files selected for processing: 29
config/scripts/vitest-sqlite-database-runtime-files.mjssrc/main/acp/acp-launch-specs.tssrc/main/claude/claude-cli-conversations.tssrc/main/codex/codex-cli-conversations.tssrc/main/grok/grok-transcript-import.tssrc/main/native-chat/agent-session-journal/journal-legacy-import.tssrc/main/native-chat/agent-session-wire/structured-agent-session-adopted-import.test.tssrc/main/native-chat/structured-agent-cli-conversation-adoption.test.tssrc/main/native-chat/structured-agent-cli-conversations.tssrc/main/native-chat/structured-agent-session-history-adoption.test.tssrc/main/native-chat/structured-agent-session-history-adoption.tssrc/main/omp/omp-session-cwd-lookup.test.tssrc/main/omp/omp-transcript-import.tssrc/main/opencode/opencode-structured-account-home.test.tssrc/main/opencode/opencode-structured-account-home.tssrc/main/opencode/opencode-transcript-import.tssrc/main/runtime/orca-runtime-get-structured-agent-session-create-support.tssrc/main/runtime/orca-runtime-structured-agent-session-create-intent.test.tssrc/main/runtime/structured-agent-launch-support.tssrc/main/runtime/structured-agent-session-create-adoption.tssrc/renderer/src/components/right-sidebar/ai-vault-session-launch-actions.tssrc/renderer/src/components/right-sidebar/ai-vault-session-resume-in-chat-workspace.tssrc/renderer/src/components/right-sidebar/ai-vault-session-resume-in-chat.test.tssrc/renderer/src/components/right-sidebar/ai-vault-session-resume-in-chat.tssrc/renderer/src/components/tab-bar/tab-session-history-switch.test.tssrc/renderer/src/components/tab-bar/tab-session-history-switch.tssrc/renderer/src/components/terminal-pane/TerminalPaneResumeInChatButton.test.tsxsrc/renderer/src/components/terminal-pane/TerminalPaneResumeInChatButton.tsxsrc/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.
7517d5b to
acc3789
Compare
…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.
acc3789 to
8102caa
Compare
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
opencodeandopencode2rows 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 terminal tab menu:

Imported history and a new reply:

After the source CLI exits:

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-
checklimitation; 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
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
opencode2row generatesopencode2 --session …. This machine installs onlyopencode, so the generated command cannot run here. Command generation was verified atorigin/main1182168681db; a current-main UI click has not been run. This PR does not change plain terminal Resume.Checklist
Author: @BrennanKB5