Skip to content

Resume in New Native Chat for Grok and OMP terminal conversations - #28049

Merged
brennanb2025 merged 4 commits into
mainfrom
brennanb2025/pr27183-resume-in-new-chat
Oct 13, 2026
Merged

brennanb2025 merged 4 commits into
mainfrom
brennanb2025/pr27183-resume-in-new-chat

Conversation

@brennanb2025

@brennanb2025 brennanb2025 commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 12 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​739 $\color{#cf222e}{\Huge{\mathbf{−}}}$​48 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​691
Prod 22 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​341 $\color{#cf222e}{\Huge{\mathbf{−}}}$​119 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​222

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

  • Final targeted suite: 138 tests in eight files passed; regular typecheck and changed code-quality checks passed.
  • orca-ci-checks passed 23/24 locally; only the known local Bun 1.3.14 bun check limitation failed. Final GitHub CI is green, including static analysis and all five Node test shards.
  • Three adversarial review rounds, an architecture re-challenge, readiness review and performance follow-up found no open defect caused by this PR. The inherited desktop ownership gap is deferred to the separate host fix. Tests cover effective account roots, Windows home precedence, current/migrated OMP layouts, streaming early exit, Grok path vectors and consumer bundling.
  • Final hidden remote UI QA: macOS Grok 1.0.52 and neutral-path OMP 18.2.7 passed all three offers, real-history import, same-session continuation, refreshed owned-row reopening and source-exit behavior. Windows OMP 18.2.1 passed account/profile import and continuation with distinct HOME/USERPROFILE; the inherited desktop gap remains explicit below.
  • OMP on current main 93e66e1f0e had 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.
  • Automated tests added/updated
  • Available platform UI checks complete; waived and untested coverage stated

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

  • Not applicable; no upstream skill-installer source was copied.

Notes

  • SSH, remote Orca servers and WSL retain the existing refusal; mobile is unchanged. No remote-call format, stream message, new dependency or persisted field was added.
  • Separate main issue: at reviewed origin/main e713bcb and the fresh QA main 93e66e1, plain Resume of an opencode2 history row builds opencode2 --session …. A host with only opencode cannot 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.
  • Separate inherited ownership gap: a stale Session History row can launch a desktop terminal without reaching the host’s resume refusal. Windows OMP QA opened two extra terminals on the chat-owned original conversation; direct host preparation of that same row correctly refused with 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.md and 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.
  • Known macOS path limit: OMP records a /tmp workspace as /tmp while 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.
  • No main merge/rebase or PR merge was performed, per the stack rules.

Checklist

  • User-facing change, mechanism and alternatives explained
  • Correctness, security, platform, remote and performance impact reviewed
  • Targeted tests and regular typecheck passed; final CI green
  • Final UI evidence and coverage recorded (see status comment)

Author: @BrennanKB5

…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.
@brennanb2025
brennanb2025 force-pushed the brennanb2025/pr27183-resume-in-new-chat branch from 7ed25ef to a1ddadf Compare October 12, 2026 22:37
@brennanb2025
brennanb2025 changed the base branch from brennanb2025/native-chat-history-all-agents to main October 12, 2026 22:37
…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.
@brennanb2025
brennanb2025 marked this pull request as ready for review October 13, 2026 04:18
@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: f5836677-5d04-44db-ac6c-48916f34ca7b
📥 Commits

Reviewing files that changed from the base of the PR and between 3d19480 and 8923eec.

📒 Files selected for processing (14)
  • config/scripts/electron-vite-output-contract.test.ts
  • src/main/grok/grok-transcript-import.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-session-cwd-lookup.ts
  • src/main/omp/omp-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-session-create-adoption.ts
  • src/shared/grok-session-paths.test.ts
  • src/shared/grok-session-paths.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.

📝 Walkthrough

The change adds Grok and OMP transcript-import configurations and connects them to ACP runtime registrations. Native session adoption now uses provider handles directly and passes launch environment and workspace information to transcript lookup. The renderer discovers CLI conversations for session history and resume actions using a shared agent allowlist. Grok cwd lookup supports long paths, and Grok bootstrap decoding recognizes complete rules and git-status sections.

Priority: ⬇️ Low

Merge Risk: 🟡 Moderate · up to 8923e

Resuming an OMP conversation in a native chat can look in the wrong account's history when OMP_CODING_AGENT_DIR is set. The conversation may then appear missing, or the chat may attach to another account's history. The change is otherwise bounded, but this should be fixed before merge.

Pre-merge checks · Passed 4 · Failed 1

Failed Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 39.13% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 46 functions across 34 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 identifies the primary user-facing change: resuming Grok and OMP terminal conversations in a new native chat.
Description check Passed The description is complete and aligned with the repository template. It explains the user impact, implementation, rationale, linked follow-up issue, visual evidence, testing, platform coverage, known…
  • Fix all pre-merge checks with AI
✨ 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: 6863b15b-89b6-497d-910b-233870b23b27
📥 Commits

Reviewing files that changed from the base of the PR and between 2233fd3 and 3d19480.

📒 Files selected for processing (26)
  • src/main/acp/acp-launch-specs.ts
  • src/main/grok/grok-transcript-import.ts
  • src/main/native-chat/agent-session-wire/structured-agent-session-adapter-router-test-support.ts
  • src/main/native-chat/agent-session-wire/structured-agent-session-adopted-import.test.ts
  • src/main/native-chat/agent-session-wire/structured-agent-session-adopted-import.ts
  • src/main/native-chat/agent-session-wire/structured-agent-session-attach.ts
  • src/main/native-chat/agent-session-wire/structured-agent-session-create-adoption.test.ts
  • src/main/native-chat/structured-agent-cli-conversation-adoption.test.ts
  • src/main/native-chat/structured-agent-session-history-adoption.test.ts
  • src/main/native-chat/structured-agent-session-history-adoption.ts
  • src/main/native-chat/transcript-line-decoders-grok.ts
  • src/main/native-chat/transcript-line-decoders.grok.test.ts
  • src/main/omp/omp-transcript-import.ts
  • src/main/runtime/orca-runtime-get-structured-agent-session-create-support.ts
  • src/main/runtime/structured-agent-runtime-registrations.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-launch.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/renderer/src/lib/ai-vault-tab-title-requests.ts
  • 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; 8 remain after this review.

Comment on lines +9 to +11
const sessionsDir = resolveOmpSessionsDir({
env: { ...process.env, PI_CODING_AGENT_DIR: accountHomePath }
})

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.

🗄️ 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 -110

Repository: 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 -160

Repository: 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 -120

Repository: 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.

Suggested change
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
}
})

@brennanb2025

Copy link
Copy Markdown
Contributor Author

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 8923eec7406. The targeted 138 tests, regular typecheck and final CI pass. Local static checks passed 23/24, with only the documented old-Bun bun check limitation.

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 opencode2 --session executable-name issue also remains separate.

Live QA used real CLIs, isolated homes, a local fake model and hidden remote Electron windows driven only by the prescribed OpenCode models:

  • Mac Grok 1.0.52 and neutral-path OMP 18.2.7 passed all three offers, real-history import, same-session continuation, refreshed-row reopening and removal of running-only actions on source exit. The History row was exercised in All scope; no Workspace-filter claim.
  • Windows OMP 18.2.1 passed import and continuation with distinct HOME/USERPROFILE and a configured profile; the inherited second-writer failure above remains explicit.
  • Main at 93e66e1f0e passed the comparison: same repository and first prompt, two terminal tabs and no takeover action on all three surfaces. The branch adds the intended third chat tab.

Known limits: macOS /tmp versus /private/tmp spelling prevents OMP takeover there; no workaround is included. An ordinary symlink source/runtime probe agreed on the physical path, but live symlink/folder flows and repository setup-script execution were not tested. Grok’s main comparison was waived by the lead; credential-required Claude/Codex controls, live SSH/Linux, packaged performance and heap/wall-time measurements remain unverified. No PR was merged.

On main (OMP tab menu):

Main OMP tab menu

On the final branch (OMP action and continued chat):

OMP tab menu after

OMP original history and chat continuation

Grok’s imported real prompt without injected context:

Grok adopted chat

@brennanb2025
brennanb2025 merged commit 8a0f1ee into main Oct 13, 2026
39 checks passed
@brennanb2025
brennanb2025 deleted the brennanb2025/pr27183-resume-in-new-chat branch October 13, 2026 23:54
brennanb2025 added a commit that referenced this pull request Oct 15, 2026
#28049's Grok session paths import @noble/hashes/blake3. Main declares
@noble/hashes 1.8.0 directly (from #27523, not picked); without it the
1.4.224 base resolves a transitive 2.x that doesn't export ./blake3.
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