Repository navigation
Resume in New Native Chat for Grok and OMP terminal conversations - #28049
Conversation
…rsations A Grok or OMP 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, like Claude and Codex: a new chat of that agent takes the conversation over, showing its history and continuing it. The host finds the conversation through the agent's transcript import and fills the chat from it, the same adoption path Claude and Codex use; the adopted handle is now any agent's, not only theirs. Both agents keep conversations per folder, so the action shows only in the workspace the conversation was recorded in, as for Claude.
7ed25ef to
a1ddadf
Compare
…akes over its conversation Grok 1.0 appends the user's rules to its runtime-context row; the decoder only knew the older shape, so a Grok chat taking over a terminal conversation showed that row as the first message.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Walkthrough
Priority: ⬇️ Low Merge Risk: 🟡 Moderate · 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:
6863b15b-89b6-497d-910b-233870b23b27
📒 Files selected for processing (26)
src/main/acp/acp-launch-specs.tssrc/main/grok/grok-transcript-import.tssrc/main/native-chat/agent-session-wire/structured-agent-session-adapter-router-test-support.tssrc/main/native-chat/agent-session-wire/structured-agent-session-adopted-import.test.tssrc/main/native-chat/agent-session-wire/structured-agent-session-adopted-import.tssrc/main/native-chat/agent-session-wire/structured-agent-session-attach.tssrc/main/native-chat/agent-session-wire/structured-agent-session-create-adoption.test.tssrc/main/native-chat/structured-agent-cli-conversation-adoption.test.tssrc/main/native-chat/structured-agent-session-history-adoption.test.tssrc/main/native-chat/structured-agent-session-history-adoption.tssrc/main/native-chat/transcript-line-decoders-grok.tssrc/main/native-chat/transcript-line-decoders.grok.test.tssrc/main/omp/omp-transcript-import.tssrc/main/runtime/orca-runtime-get-structured-agent-session-create-support.tssrc/main/runtime/structured-agent-runtime-registrations.tssrc/renderer/src/components/right-sidebar/ai-vault-session-launch-actions.tssrc/renderer/src/components/right-sidebar/ai-vault-session-resume-in-chat-launch.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/renderer/src/lib/ai-vault-tab-title-requests.tssrc/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; 8 remain after this review.
| const sessionsDir = resolveOmpSessionsDir({ | ||
| env: { ...process.env, PI_CODING_AGENT_DIR: accountHomePath } | ||
| }) |
There was a problem hiding this comment.
🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win
🔎 Supported by static analysis
🏁 Script executed:
rg -n 'OMP_CODING_AGENT_DIR|PI_CODING_AGENT_DIR|directoryAccountBinding|resolveOmpSessionsDir' src test* docs 2>/dev/null | head -180
rg -n 'accountBinding|spawn.*env|env:.*process.env|\\.\\.\\.process.env' src/main/acp src/main/runtime | head -110Repository: stablyai/orca
Length of output: 33309
🏁 Script executed:
set -e
printf '%s\n' '--- importer ---'
nl -ba src/main/omp/omp-transcript-import.ts
printf '%s\n' '--- session root ---'
nl -ba src/main/ai-vault/omp-session-root.ts | sed -n '1,110p'
printf '%s\n' '--- account binding ---'
nl -ba src/main/acp/acp-account-binding.ts | sed -n '1,180p'
printf '%s\n' '--- OMP launch spec ---'
nl -ba src/main/acp/acp-launch-specs.ts | sed -n '165,210p'
printf '%s\n' '--- structured OMP launch resolution tests ---'
nl -ba src/main/acp/acp-structured-launch-resolution-omp.test.ts | sed -n '1,125p'
printf '%s\n' '--- OMP child/session smoke references ---'
nl -ba tests/tools/omp-child-session-resume-smoke.mjs | sed -n '1,120p'
nl -ba tests/tools/omp-session-root-upstream-smoke.mjs | sed -n '1,100p'
printf '%s\n' '--- launch environment references ---'
rg -n -F --glob '*.ts' -e 'OMP_LAUNCH_SPEC' -e 'envToDelete' -e 'directoryAccountBinding' -e 'accountBinding' src/main/acp src/main/runtime src/main/native-chat | head -160Repository: stablyai/orca
Length of output: 31681
🏁 Script executed:
set -e
printf '%s\n' '--- launch spec types and scrub hooks ---'
rg -n -F --glob '*.ts' -e 'export type AcpLaunchSpec' -e 'interface AcpLaunchSpec' -e 'scrubEnvironment' -e 'function resolveAcpLaunchInvocation' src/main/acp src/main/runtime
nl -ba src/main/acp/acp-structured-launch-resolution.ts | sed -n '1,260p'
printf '%s\n' '--- launch composition and child environment ---'
nl -ba src/main/runtime/structured-agent-launch-composition.ts | sed -n '1,215p'
nl -ba src/main/runtime/structured-session-child-env.ts | sed -n '1,145p'
printf '%s\n' '--- specs with environment deletion hooks ---'
rg -n -F --glob '*.ts' -e 'scrubEnvironment:' -e 'envToDelete:' src/main/acp src/main/runtime | head -120Repository: stablyai/orca
Length of output: 36923
🏁 Script executed:
set -e
printf '%s\n' '--- scrub implementation ---'
nl -ba src/main/acp/acp-launch-specs.ts | sed -n '1,175p'
rg -n -F --glob '*.ts' -e 'function scrubOpenCodeAcpEnvironment' -e 'scrubOpenCodeAcpEnvironment' src/main
printf '%s\n' '--- process environment merge ---'
rg -n -F --glob '*.ts' -e 'function createProviderSpawnSpec' -e 'createProviderSpawnSpec' src/main/provider-process src/main | head -80
nl -ba src/main/provider-process/provider-process-supervisor.ts | sed -n '1,180p'Repository: stablyai/orca
Length of output: 25049
Scope OMP account selection in lookup and launch.
When OMP_CODING_AGENT_DIR is present, the importer and resumed child can resolve sessions outside the selected PI_CODING_AGENT_DIR. This can make the selected conversation appear missing or attach the chat to another account's history.
Clear the override in both environments. Remove it from the resolved child environment and from inherited variables.
Suggested fix
diff --git a/src/main/omp/omp-transcript-import.ts b/src/main/omp/omp-transcript-import.ts
@@
const sessionsDir = resolveOmpSessionsDir({
- env: { ...process.env, PI_CODING_AGENT_DIR: accountHomePath }
+ env: {
+ ...process.env,
+ OMP_CODING_AGENT_DIR: undefined,
+ PI_CODING_AGENT_DIR: accountHomePath
+ }
})
diff --git a/src/main/acp/acp-launch-specs.ts b/src/main/acp/acp-launch-specs.ts
@@
args: ({ pluginDir }) => ['acp', ...(pluginDir ? ['--plugin-dir', pluginDir] : [])],
env: {},
+ scrubEnvironment: (env) => {
+ delete env.OMP_CODING_AGENT_DIR
+ return ['OMP_CODING_AGENT_DIR']
+ },
dialect: OMP_ACP_DIALECT,📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| const sessionsDir = resolveOmpSessionsDir({ | |
| env: { ...process.env, PI_CODING_AGENT_DIR: accountHomePath } | |
| }) | |
| const sessionsDir = resolveOmpSessionsDir({ | |
| env: { | |
| ...process.env, | |
| OMP_CODING_AGENT_DIR: undefined, | |
| PI_CODING_AGENT_DIR: accountHomePath | |
| } | |
| }) |
|
Grok and OMP terminal conversations could not move into a new native chat through the same actions as Claude/Codex. This PR adds the action in History, the running tab menu and pane header, imports the earlier real turns, and continues the original provider conversation. The source terminal stays running, matching main’s existing behavior. Review fixes align import with the configured account environment, respect Windows USERPROFILE and OMP profiles, match Grok’s actual short/long workspace directories, and replace OMP’s account-wide traversal with a bounded workspace lookup. Grok’s injected bootstrap context is hidden; real prompts are retained. Three adversarial rounds, architecture re-challenge, readiness and performance review are complete at Known inherited P1, deferred to the lead’s separate host fix: stale desktop History Resume can bypass the host ownership check. Windows QA opened two additional OMP writers on the adopted original conversation and confirmed their exit writes in the original file; direct host preparation correctly refused. This PR does not repair that desktop gap. The main plain Live QA used real CLIs, isolated homes, a local fake model and hidden remote Electron windows driven only by the prescribed OpenCode models:
Known limits: macOS On main (OMP tab menu): On the final branch (OMP action and continued chat): Grok’s imported real prompt without injected context: |




ELI5
Grok and OMP terminal conversations lacked Resume in New Native Chat, even though Orca could run both agents in chat. This adds the same action Claude and Codex have: open a new chat with the earlier turns and continue the same conversation.
Known inherited main issue: stale desktop history rows can still start another terminal writer after a chat adopts the conversation. Windows QA confirmed it; the lead owns a separate host-side fix. This PR adds the action and history import, and does not repair that existing gap.
What Changed
The action appears in Session History, the running terminal tab’s menu, and its pane header. After refreshing History, the adopted row opens that chat and the host refuses another terminal resume when its ownership check is called. A known desktop bypass inherited from main is described below. The source terminal keeps running, matching main’s Claude/Codex behavior; adoption does not stop it.
The existing host adoption path now accepts each agent’s saved session handle and imports Grok or OMP history before publishing the chat. Import and launch use the same account environment and workspace. OMP lookup follows Windows USERPROFILE and configured profile/data roots, probing only known current and migrated workspace buckets and stopping at the first match. Grok probes the CLI’s exact workspace directory, including long hashed paths, before its existing bounded fallback. Unknown OMP locations refuse safely instead of scanning the whole account or opening a blank chat.
Grok 1.0’s injected user information and rules are hidden when importing history; real prompts mentioning those tags remain visible.
The action remains local-only, with the same workspace and running-agent rules as Claude/Codex. The pane header checks the recorded folder when clicked and may refuse then, matching main without adding a background history scan. The row menu can adopt a conversation after its source terminal exits. OpenCode and Pi support belongs to stacked #28072 and #28080.
Why
Reusing Orca’s existing adoption, ownership and reopen path avoids a second lifecycle or history store. Importing before the chat is published is an intended Orca choice: its journal owns displayed history, while provider replay is discarded on reopen. Ownership and continuation retain the common pattern of reopening the same native conversation. A host-published capability was unnecessary for this local-only action; a test keeps the shared agent list equal to registered importers.
An account-wide file search was rejected because its cost grows with unrelated history. Scoped workspace lookup uses the information already available without adding a cache, index or persisted obligation. OpenCode and Pi are temporary coverage gaps resolved by the named follow-ups, each with its own history reader.
Linked Issue
Follow-up to #27183.
Visual Proof
Final review status and main/branch screenshots include exact live coverage and known limits.
Testing
orca-ci-checkspassed 23/24 locally; only the known local Bun 1.3.14bun checklimitation failed. Final GitHub CI is green, including static analysis and all five Node test shards.93e66e1f0ehad two terminal tabs and no takeover action on all three surfaces, with the same physical repository, first prompt and actual All History scope. The branch adds the intended third chat tab. Grok main was waived by the lead; credential-required controls, live symlink/folder flows and repository setup-script execution remain unverified. Exact coverage and screenshots are in the final status comment.Review
The loop fixed account-root mismatch, Windows home precedence, Grok exact short/long workspace encoding, and OMP global traversal. Source-level work bounds were verified; wall-time/heap benchmarks and packaged-build performance were not measured.
Agent skill upstream boundary
Notes
origin/maine713bcb and the fresh QA main 93e66e1, plain Resume of anopencode2history row buildsopencode2 --session …. A host with onlyopencodecannot run that command. This PR does not fix it; Resume in New CLI for OpenCode and OMP chats #28075 addresses the distinct chat-copy command.agent_session_conflict. The same desktop path affects Claude on main. The lead owns a separate host-side fix; this PR does not repair that gap. Private evidence:~/orca-qa/pr-28049/QA-WINDOWS-FINAL.mdand the Windows QA export. The extra terminals replayed a message sent only in chat and wrote exit records to the original file; the original source remained on its earlier branch. The evidence includes direct refusal, daemon admissions, screenshots and those exit records./tmpworkspace as/tmpwhile Orca registers/private/tmp, so takeover is not offered there. An ordinary symlinked git-repo probe resolved Node, Bun and Git to the same physical path and showed no such mismatch; this was a runtime/source probe, not a live symlink conversation. Any registered and recorded path spellings that remain different still fail the same strict check. No path workaround is included.Checklist
Author: @BrennanKB5