Repository navigation
Resume in New CLI for OpenCode and OMP chats - #28075
Conversation
36f6731 to
11e6498
Compare
|
Note Reviews pausedIt 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 Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
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:
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.mjssrc/main/acp/acp-conversation-copies.tssrc/main/acp/acp-conversation-copy-lifecycle.test.tssrc/main/acp/acp-conversation-copy-opencode-server.test.tssrc/main/acp/acp-conversation-copy.test.tssrc/main/acp/acp-conversation-copy.tssrc/main/acp/acp-structured-session-adapter-deps.tssrc/main/acp/acp-structured-session-adapter.tssrc/main/ai-vault/runtime-session-scanner.test.tssrc/main/ai-vault/runtime-session-scanner.tssrc/main/ai-vault/structured-chat-conversation-copy.test.tssrc/main/ai-vault/structured-chat-conversation-copy.tssrc/main/ai-vault/structured-session-ownership.test-support.tssrc/main/ipc/ai-vault-resume-chat-copy.test.tssrc/main/ipc/pty/managed-data-account-spawn-environment.test.tssrc/main/native-chat/agent-session-wire/structured-agent-session-adapter.tssrc/main/native-chat/structured-agent-configured-args.test.tssrc/main/native-chat/structured-agent-configured-args.tssrc/main/runtime/orca-runtime-conversation-copy-resume.test.tssrc/main/runtime/rpc/methods/ai-vault-copy-server-route.test.tssrc/main/runtime/rpc/methods/ai-vault.test.tssrc/main/runtime/structured-agent-runtime-registrations.tssrc/renderer/src/components/right-sidebar/ai-vault-session-cli-fork.test.tssrc/renderer/src/components/right-sidebar/ai-vault-session-cli-fork.tssrc/renderer/src/components/right-sidebar/ai-vault-session-launch-actions.test.tssrc/renderer/src/components/right-sidebar/ai-vault-session-launch-actions.tssrc/renderer/src/components/right-sidebar/ai-vault-session-launch-feedback.tssrc/renderer/src/lib/ai-vault-omp-cold-resume.test.tssrc/renderer/src/lib/ai-vault-resume-command.tssrc/renderer/src/lib/ai-vault-session-fork-startup.test.tssrc/renderer/src/lib/ai-vault-session-fork-startup.tssrc/renderer/src/lib/ai-vault-session-resume-preparation.test.tssrc/renderer/src/lib/ai-vault-session-resume-preparation.tssrc/renderer/src/runtime/web-runtime-conversation-copy-resume.test.tssrc/shared/ai-vault-resume-preparation.tssrc/shared/opencode-launch-command.test.tssrc/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.
1bfb39a to
cd2e31e
Compare
cd2e31e to
18d1eff
Compare
|
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 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 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.
d70dad8 to
c83b293
Compare
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/forkrequest. 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 ofopencode2. 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 are18d1eff0dab. Extra terminal tabs in the later screenshots are independent copies created by earlier successful QA actions.OpenCode copy retains the original turns and answers its own new prompt on final
18d1eff0dab: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: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.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
Notes
--serverdefaults 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.--serverduring 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.opencode2on installations that provide onlyopencode. Verified against this PR’s current main base; left outside the copy action.Checklist