Skip to content

Resume in New CLI for OpenCode and OMP chats - #28075

Merged
brennanb2025 merged 7 commits into
mainfrom
brennanb2025/pr27183-fork-opencode-omp
Oct 14, 2026
Merged

brennanb2025 merged 7 commits into
mainfrom
brennanb2025/pr27183-fork-opencode-omp

Conversation

@brennanb2025

@brennanb2025 brennanb2025 commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 13 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​511 $\color{#cf222e}{\Huge{\mathbf{−}}}$​40 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​471
Prod 27 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​612 $\color{#cf222e}{\Huge{\mathbf{−}}}$​90 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​522

ELI5

OpenCode and OMP native chats had no Resume in New CLI action because their terminal commands have no copy flag. Opening the original conversation would give the chat and terminal two writers.

Both Session History and the original chat tab’s menu now offer the action. Clicking it saves an independent copy and opens that copy in a new terminal. The original chat keeps its conversation and can continue separately.

What Changed

The machine running the chat makes the copy through the Agent Client Protocol’s session/fork request. A temporary agent uses the chat’s launch settings, checks copy support, and returns a new conversation identifier. It never loads or prompts the original conversation. Preparation has a 60-second deadline, and temporary children remain owned until exit is observed or shutdown retries cleanup.

The existing preparation response carries the new identifier and actual agent. An OpenCode 2 history row therefore launches opencode, with its standalone mode when appropriate, instead of opencode2. OMP returns the copied transcript’s absolute path so the terminal can find it across profile-directory changes. Local and paired terminal paths then use ordinary resume.

Invalid, original, and already chat-owned returned identifiers are refused. Unsupported agents, older Orca hosts, account mismatches, and explicit OpenCode server routes report through the existing action-error toast. Failure never falls back to opening the original conversation.

Why

The common pattern checks provider copy support and uses the returned new identity. A separate copy connection works for running and stopped chats while leaving the original connection alone. The copied terminal belongs to the CLI; it needs no second durable native-chat owner.

Reusing host preparation and terminal launch keeps credentials on the execution host and avoids a new generic command, environment, or account-identity payload. Old clients do not offer this action; new clients refuse a host response that contains no copy. SSH history rows without a native-chat owner retain their existing behavior.

Linked Issue

Maintainer follow-up to #27183, which left OpenCode and OMP without Resume in New CLI.

Visual Proof

Same original chats and conversation content, captured through hidden-renderer CDP. Main is 1b9a408b8c0; final menus and OpenCode copy are 18d1eff0dab. Extra terminal tabs in the later screenshots are independent copies created by earlier successful QA actions.

OpenCode — main: action absent Final: action available
OpenCode before OpenCode after
OMP — main: action absent Final: action available
OMP before OMP after

OpenCode copy retains the original turns and answers its own new prompt on final 18d1eff0dab:

Independent OpenCode copy

OMP copy retains the original turns and answers its own new prompt on cd2e31e448b; OMP copy behavior is unchanged by the final OpenCode parser integration:

Independent OMP copy

Original full-window PNGs were hash-verified after transfer and personally checked for private usernames/home paths. No cropping or image editing.

Testing

The kept tests cover independent copies from running and stopped OpenCode and OMP chats, copy identity and temporary-child cleanup, actual OpenCode launch mode and OMP transcript paths, paired-host responses, older-host refusal, and both menu entry points. All 173 focused tests across 16 suites and the regular full typecheck passed; local static checks passed except for the documented Bun 1.3.14 environment lacking bun check, and the earlier live macOS evidence remains applicable because production behavior is unchanged.

  • Agent-driven hidden Electron checks on remote macOS.
  • Automated tests added/updated.

Review

Three adversarial rounds, architecture challenges before implementation and after round three, final independent readiness, and a fresh rebase-integration review repaired routing, profile, identity-validation, timeout, and cleanup defects. The first authorized rebase adapted one test to main’s native-chat lookup. An additional explicitly authorized sync after the separate main CI fix retained main’s OpenCode command parser and its sleep-prefix regression test; the copy guard and other three feature commits replayed unchanged. No new P0/P1 remained in the final source reviews.

Agent skill upstream boundary

  • Not applicable: this change copies no upstream skill-installer source or resources.

Notes

  • Intended: installed-agent copy support is checked on click by the execution host. No second capability store or unsolicited notice is added.
  • Temporary: select the OpenCode account used by the original chat before copying. A different selected account causes a plain refusal; an account-specific host terminal route is the follow-up.
  • Temporary: If you switch OpenCode accounts while a copy is being made, the terminal may not find the copy; switch back and use Resume in New CLI again.
  • Temporary: a paired host with OpenCode --server defaults can refuse the copy even when explicit client terminal arguments would replace them. The original is unaffected. A follow-up must check the terminal’s effective command and arguments before refusing.
  • Temporary: changing OpenCode arguments to --server during copying can leave a saved copy whose terminal fails to open. Keep launch settings stable during the action; argument selection across preparation needs a follow-up.
  • Separate main issue: plain Resume of an OpenCode 2 history row still builds opencode2 on installations that provide only opencode. Verified against this PR’s current main base; left outside the copy action.
  • Windows, Linux, SSH/network-loss behavior, live paired-host UI, managed-account UI, OpenCode 1.x, older peer binaries, and Pi/Grok regression UI have not received live coverage in this loop.
  • Author: @BrennanKB5

Checklist

  • Focused on copying OpenCode and OMP native chats into terminals.
  • Problem, user-facing change, mechanism, and alternatives explained.
  • Matching final before/after visual proof attached.
  • Correctness, security, resource ownership, performance, folder, paired-host, SSH, path, and mixed-version impact reviewed.
  • Final tab QA and hosted CI outcome recorded (CI blocked as described).

@brennanb2025
brennanb2025 force-pushed the brennanb2025/pr27183-fork-opencode-omp branch from 36f6731 to 11e6498 Compare October 12, 2026 22:58
@brennanb2025
brennanb2025 changed the base branch from brennanb2025/native-chat-history-all-agents to main October 12, 2026 22:58
@brennanb2025
brennanb2025 marked this pull request as ready for review October 13, 2026 04:19
@coderabbitai

coderabbitai Bot commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

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: aef6b7fe-fb80-433f-a631-3b7388f12245
📥 Commits

Reviewing files that changed from the base of the PR and between 18d1eff and d70dad8.

📒 Files selected for processing: 8
  • config/scripts/vitest-sqlite-runtime-files.mjs
  • src/main/acp/acp-conversation-copy.test.ts
  • src/main/ai-vault/runtime-session-scanner.test.ts
  • src/main/ai-vault/structured-chat-conversation-copy.test.ts
  • src/main/ipc/ai-vault-resume-chat-copy.test.ts
  • src/renderer/src/components/right-sidebar/ai-vault-session-launch-actions.test.ts
  • src/renderer/src/components/tab-bar/tab-session-history-switch.test.ts
  • src/renderer/src/lib/ai-vault-session-resume-preparation.test.ts

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

📝 Walkthrough

The changes add ACP session forking and chat-mediated conversation copying for OpenCode, OpenCode 2.x, and OMP. Resume preparation now carries copied-session details through runtime and IPC responses. Renderer launch preparation uses the copied session’s agent and startup data, with OpenCode local-store checks and copied-session launch handling. Tests cover ACP copying, ownership, resume result propagation, and copied-session startup.

Priority: ➖ Normal

Merge Risk: ⚪ Minimal · up to d70da

No actionable merge-blocking issue is established for these changes. Complete the remaining CI checks before merging.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 35.71% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 42 functions across 48 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 Issue #28265 is closed and supplies historical context only. The PR objectives state that no active directly linked issue targets remain. Therefore, no active linked-issue coding requirements apply.
Out of Scope Changes check Passed The reported changes stay within the stated Resume in New CLI feature. They add ACP conversation copying, forked-session preparation, OpenCode and OMP launch handling, UI actions, error handling, clea…
Title check Passed The title clearly and concisely identifies the main change: adding Resume in New CLI support for OpenCode and OMP chats.
Description check Passed The description is complete and directly addresses the template. It explains the user impact, implementation, rationale, linked issue context, visual proof, testing, review findings, limitations, and …
✨ Finishing Touches: 💡 1
📝 Generate docstrings: 💡
  • 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: 390cb577-e4ed-4390-bea5-ebee7077ae20
📥 Commits

Reviewing files that changed from the base of the PR and between 0702e2a and 1bfb39a19eedcc9dad66c418468ebafdd8403ca6.

📒 Files selected for processing (37)
  • config/scripts/vitest-sqlite-runtime-files.mjs
  • src/main/acp/acp-conversation-copies.ts
  • src/main/acp/acp-conversation-copy-lifecycle.test.ts
  • src/main/acp/acp-conversation-copy-opencode-server.test.ts
  • src/main/acp/acp-conversation-copy.test.ts
  • src/main/acp/acp-conversation-copy.ts
  • src/main/acp/acp-structured-session-adapter-deps.ts
  • src/main/acp/acp-structured-session-adapter.ts
  • src/main/ai-vault/runtime-session-scanner.test.ts
  • src/main/ai-vault/runtime-session-scanner.ts
  • src/main/ai-vault/structured-chat-conversation-copy.test.ts
  • src/main/ai-vault/structured-chat-conversation-copy.ts
  • src/main/ai-vault/structured-session-ownership.test-support.ts
  • src/main/ipc/ai-vault-resume-chat-copy.test.ts
  • src/main/ipc/pty/managed-data-account-spawn-environment.test.ts
  • src/main/native-chat/agent-session-wire/structured-agent-session-adapter.ts
  • src/main/native-chat/structured-agent-configured-args.test.ts
  • src/main/native-chat/structured-agent-configured-args.ts
  • src/main/runtime/orca-runtime-conversation-copy-resume.test.ts
  • src/main/runtime/rpc/methods/ai-vault-copy-server-route.test.ts
  • src/main/runtime/rpc/methods/ai-vault.test.ts
  • src/main/runtime/structured-agent-runtime-registrations.ts
  • src/renderer/src/components/right-sidebar/ai-vault-session-cli-fork.test.ts
  • src/renderer/src/components/right-sidebar/ai-vault-session-cli-fork.ts
  • src/renderer/src/components/right-sidebar/ai-vault-session-launch-actions.test.ts
  • src/renderer/src/components/right-sidebar/ai-vault-session-launch-actions.ts
  • src/renderer/src/components/right-sidebar/ai-vault-session-launch-feedback.ts
  • src/renderer/src/lib/ai-vault-omp-cold-resume.test.ts
  • src/renderer/src/lib/ai-vault-resume-command.ts
  • src/renderer/src/lib/ai-vault-session-fork-startup.test.ts
  • src/renderer/src/lib/ai-vault-session-fork-startup.ts
  • src/renderer/src/lib/ai-vault-session-resume-preparation.test.ts
  • src/renderer/src/lib/ai-vault-session-resume-preparation.ts
  • src/renderer/src/runtime/web-runtime-conversation-copy-resume.test.ts
  • src/shared/ai-vault-resume-preparation.ts
  • src/shared/opencode-launch-command.test.ts
  • src/shared/opencode-launch-command.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.

@brennanb2025
brennanb2025 force-pushed the brennanb2025/pr27183-fork-opencode-omp branch from 1bfb39a to cd2e31e Compare October 13, 2026 08:13
@brennanb2025
brennanb2025 force-pushed the brennanb2025/pr27183-fork-opencode-omp branch from cd2e31e to 18d1eff Compare October 13, 2026 09:44
@brennanb2025

Copy link
Copy Markdown
Contributor Author

OpenCode and OMP native chats lacked Resume in New CLI because their terminal commands have no copy flag. The action now appears in Session History and the original chat tab’s menu, saves an independent conversation, and opens it in a new terminal. The original chat keeps its own conversation.

The review fixed actual OpenCode executable routing, OMP profile-file selection, malformed or already-owned copy identities, timeout handling, temporary-child cleanup, standalone mode and explicit server-route refusal. A broad account/environment launch extension introduced during the loop was removed; the final design uses execution-host preparation and ordinary terminal resume. Three adversarial rounds, two architecture challenges, independent readiness and narrow integration checks found no remaining P0/P1.

Verified: 416 focused tests across 28 suites and full regular typecheck passed on final 18d1eff0dab; required local static checks passed 22/23, with only the documented Bun environment exception. Hosted static/type checks, Linux/Windows packaging, cross-version wire compatibility, relay integration, persistence, repository guards and completed Node shards passed. CI is blocked only by main’s #28231 transcript fixture, which expects zero known replay differences but has 12; the separate fix is #28286. The failure reproduced locally and the coordinator reproduced it on another main-based worktree. Two Node shards remained pending at fail-fast exit; no retry or unrelated fix is carried here. Real OpenCode 2.0.21 and OMP 18.2.7 passed both copy entry points through the prescribed first-choice OpenCode driver in hidden remote Electron. Copies retained prior turns, replied independently, and left normalized source records unchanged at each boundary. OMP also passed in a genuine non-Git folder. Same-source main comparison showed all four actions absent; final branch matching menus showed them present. Final 18d1eff0dab recheck passed all four menus and a real OpenCode tab copy; OMP copy behavior passed on the preceding revision and was unchanged by the final OpenCode parser integration. Hash-verified, privacy-inspected visual proof is in the PR body.

Deferred, accepted: select the OpenCode account used by the original before copying. If you switch OpenCode accounts while a copy is being made, the terminal may not find the copy; switch back and use Resume in New CLI again. Paired host server defaults can cause a safe false refusal; changing arguments during copying can leave a saved copy whose terminal fails to open. Account-specific host launch and checking the effective terminal route remain follow-ups.

Separate main issue: plain Resume of an OpenCode 2 row still builds opencode2 on installations providing only opencode; verified in main source and left outside this copy action.

Unverified live: Windows/Linux, SSH/network loss, paired-host and managed-account UI, older peers, OpenCode 1.x, Pi/Grok regression UI and native focus. No merge performed. Remote rig teardown and worker release are complete; the coordinator will obtain fresh CI after the main fix.

OpenCode's and OMP's CLIs have no copy flag, but their chat protocol copies a
conversation (ACP session/fork). For a fork of one of their chats, the chat's
host now has a short-lived agent, launched exactly as the chat's own, copy the
conversation; the terminal then opens the copy with a plain resume. The chat
keeps its own conversation, so the CLI is never a second writer on it.

The copy travels on the existing aiVault.prepareSessionResume fork request as
an optional forkedSessionId; a host that predates it answers without one, and
the client asks for an Orca update instead of resuming the original.
…encode2

The copy kept the row's agent, so Resume in New CLI ran `opencode2 --standalone --session <copy>`,
which OpenCode 2.x doesn't install. The chat's host now answers the copy with the agent whose CLI
opens it: the chat's own.
@brennanb2025
brennanb2025 force-pushed the brennanb2025/pr27183-fork-opencode-omp branch from d70dad8 to c83b293 Compare October 14, 2026 08:00
@brennanb2025 brennanb2025 reopened this Oct 14, 2026
@brennanb2025 brennanb2025 reopened this Oct 14, 2026
@brennanb2025
brennanb2025 merged commit 850e71e into main Oct 14, 2026
111 of 121 checks passed
@brennanb2025
brennanb2025 deleted the brennanb2025/pr27183-fork-opencode-omp branch October 14, 2026 23:56
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