Repository navigation
Offer Resume in New CLI / Native Chat from the tab right-click menu - #26705
Conversation
Right-clicking a native chat tab now offers "Resume in New CLI", and right-clicking a terminal tab running Claude or Codex offers "Resume in New Native Chat": the same items, gating and handlers the Session History row menu uses. The tab finds its Session History row through the existing mappings (the chat tab's session id against the row's structuredSession, and a terminal tab's agent-reported provider session, the mapping tab titles use, against the row's agent and session id), read from the Session History list scoped to the tab's workspace and host. Both surfaces now share one gate, resolveAiVaultSessionSurfaceSwitchTargets, one menu-item component, and call handleResumeInNewCli / handleResumeInNewChat from useAiVaultSessionLaunchActions.
The tab menu looked its history row up with its own list request, so it never shared the panel's cached list (and evicted it), forced a full rescan on every miss outside the panel's rescan budget, and inserted the item above Pin/Close seconds after the menu opened. - One list request (scope paths, depth, host, Antigravity flag) and one renderer-cache read/write, used by the panel and the tab lookup; the tab builds the panel's own request for its workspace. - A warm menu answers from the panel's cached list at first paint with no IPC; a cold one sends the panel's non-forced request and keeps its result in the panel's cache. - A forced rescan on a miss now takes the panel's shared forced-rescan budget; no other force. - No lookup on hosts where neither move can ever be offered (non-local). - The item moves to the end of the menu, so a late insert shifts nothing. - The panel and the tab compose the row's resume inputs through one function; parity is pinned by unmocked tests.
…r chats - The cached first paint is always replaced by the fresh list answer, so a conversation a chat has since taken no longer offers Resume in New Native Chat from a stale cached row. - Native chat tabs in a remote Orca server workspace look their row up on that server (it projects chat ownership), so Resume in New CLI shows there as it does on the row. CLI tabs stay local-only; SSH stays skipped. - A menu that closed between the two list calls no longer starts the forced rescan or spends the shared budget; forced rescans stay local.
A tab lookup wrote its list into the Session History panel's renderer cache, so a panel opened afterwards could paint that pre-launch list without asking the host and show a chat-adopted row under its old title. The tab now only reads that cache for its first paint; the host's cached list is already shared through the identical request.
📝 WalkthroughWalkthroughThe change adds session-history lookup and resume actions for switching between native chat and CLI tabs. Tab menus resolve matching resumable sessions and show the applicable action. AI Vault session-list requests, caching, and forced-rescan throttling use shared helpers. AI Vault row resume handling also uses shared resume-target resolution. Priority: ⬇️ Low Merge Risk: 🔵 Low · up to The new resume item can appear after the menu opens and shift Pin and Close, which risks a mis-click. The effect is small and easy to fix by placing the item in the final menu group. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
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. Comment |
The panel's renderer cache never carries current chat ownership (the host projects it per reply), so painting the menu item from it first flashed "Resume in New Native Chat" on a terminal tab whose conversation a chat had taken, and missed the move on that chat's own tab. The item now appears only once the fresh (non-forced) list answer lands.
There was a problem hiding this comment.
🧹 Nitpick comments (1)
src/renderer/src/components/tab-bar/tab-session-history-switch.ts (1)
204-208: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueFilter the forced-rescan result for resumable content.
The first list result passes through
isAiVaultSessionResumableContentat Line 191. The forced-rescan result at Line 208 does not. Suppose the fresh scan still returns a zero-turn row. ThenlookupTabSessionHistoryRowreturns that row. The menu then callsresolveTabSessionSwitchfor it. The gate currently hides empty rows for both moves, so users see no wrong action. However, the return contract differs from the first path and fromreadCachedTabSessionHistoryRow. Apply the same filter on both paths.♻️ Proposed fix
- return findTabSessionHistoryRow(fresh.sessions, subject) + const freshRow = findTabSessionHistoryRow(fresh.sessions, subject) + return freshRow && isAiVaultSessionResumableContent(freshRow) ? freshRow : null
ℹ️ Review info
⚙️ Run configuration
- Configuration used: Repository UI
- Review profile: CHILL
- Plan: Advanced
- Run ID:
13ee22dd-2be2-4ee2-ab5b-a14ab01d2a33
📒 Files selected for processing (22)
src/renderer/src/components/right-sidebar/AiVaultPanel.tsxsrc/renderer/src/components/right-sidebar/AiVaultSessionActionMenuItems.tsxsrc/renderer/src/components/right-sidebar/AiVaultSessionSurfaceSwitchMenuItems.tsxsrc/renderer/src/components/right-sidebar/AiVaultVirtualRow.tsxsrc/renderer/src/components/right-sidebar/ai-vault-host-scope.tssrc/renderer/src/components/right-sidebar/ai-vault-panel-session-list-request.test.tsxsrc/renderer/src/components/right-sidebar/ai-vault-panel-session-list-request.tssrc/renderer/src/components/right-sidebar/ai-vault-session-list-request.tssrc/renderer/src/components/right-sidebar/ai-vault-session-refresh.tssrc/renderer/src/components/right-sidebar/ai-vault-session-resume-in-chat-workspace.tssrc/renderer/src/components/right-sidebar/ai-vault-session-surface-switch.test.tssrc/renderer/src/components/right-sidebar/ai-vault-session-surface-switch.tssrc/renderer/src/components/tab-bar/SortableTab.rename-shortcut.test.tsxsrc/renderer/src/components/tab-bar/SortableTab.tsxsrc/renderer/src/components/tab-bar/SortableTabContextMenu.test.tsxsrc/renderer/src/components/tab-bar/SortableTabContextMenu.tsxsrc/renderer/src/components/tab-bar/TabBarItemRow.tsxsrc/renderer/src/components/tab-bar/TabSessionSurfaceSwitchMenuItems.test.tsxsrc/renderer/src/components/tab-bar/TabSessionSurfaceSwitchMenuItems.tsxsrc/renderer/src/components/tab-bar/tab-session-history-switch.parity.test.tssrc/renderer/src/components/tab-bar/tab-session-history-switch.test.tssrc/renderer/src/components/tab-bar/tab-session-history-switch.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.
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:
54c3d6e2-e1ae-4ba7-b648-489dc45cf71c
📒 Files selected for processing (4)
src/renderer/src/components/tab-bar/TabSessionSurfaceSwitchMenuItems.test.tsxsrc/renderer/src/components/tab-bar/TabSessionSurfaceSwitchMenuItems.tsxsrc/renderer/src/components/tab-bar/tab-session-history-switch.test.tssrc/renderer/src/components/tab-bar/tab-session-history-switch.ts
💤 Files with no reviewable changes (1)
- src/renderer/src/components/tab-bar/tab-session-history-switch.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.
| structuredSessionId | ||
| }) | ||
| ) | ||
| // Only a fresh reply carries current chat ownership, so nothing is offered before it lands. | ||
| const [resolved, setResolved] = useState<ResolvedTabSessionSwitch | null>(null) | ||
| useEffect(() => { | ||
| if (!subject) { | ||
| return |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
🔎 Supported by static analysis
🏁 Script executed:
sed -n '1,125p' src/renderer/src/components/tab-bar/TabSessionSurfaceSwitchMenuItems.tsx
sed -n '65,105p' src/renderer/src/components/tab-bar/tab-session-history-switch.ts
rg -n 'TabSessionSurfaceSwitchMenuItems|structuredSessionId' src/renderer/src/components/tab-bar/SortableTabContextMenu.tsx src/renderer/src/components/tab-bar/SortableTab.tsxRepository: stablyai/orca
Length of output: 6590
🏁 Script executed:
set -o pipefail
printf '%s\n' '--- changed file diff ---'
git diff 59b9bdeb901538a5e1e0cb731fd2f4a85148dff2..ebf73933bb7422ec30ea3fe35845cdac672779a3 -- src/renderer/src/components/tab-bar/TabSessionSurfaceSwitchMenuItems.tsx src/renderer/src/components/tab-bar/SortableTabContextMenu.tsx src/renderer/src/components/tab-bar/SortableTab.tsx src/renderer/src/components/tab-bar/tab-session-history-switch.ts
printf '%s\n' '--- context menu owner ---'
sed -n '100,180p' src/renderer/src/components/tab-bar/SortableTabContextMenu.tsx
sed -n '235,285p' src/renderer/src/components/tab-bar/SortableTabContextMenu.tsx
printf '%s\n' '--- tab caller ---'
sed -n '35,115p' src/renderer/src/components/tab-bar/SortableTab.tsx
sed -n '375,415p' src/renderer/src/components/tab-bar/SortableTab.tsx
printf '%s\n' '--- focused tests and references ---'
rg -n -F --glob '*.{test,spec}.{ts,tsx}' -- 'TabSessionSurfaceSwitchMenuItems|structuredSessionId|cancelListSessions|lookupTabSessionHistoryRow' src/renderer/src
printf '%s\n' '--- relevant store/update references ---'
rg -n -F --glob '*.{ts,tsx}' -- 'structuredSessionId' src/renderer/src/components/tab-bar src/renderer/src/store src/renderer/src | head -200Repository: stablyai/orca
Length of output: 30812
🏁 Script executed:
set -o pipefail
printf '%s\n' '--- TabBarItemRow and parent identity ---'
sed -n '1,190p' src/renderer/src/components/tab-bar/TabBarItemRow.tsx
rg -n -F --glob '*.tsx' -- 'TabBarItemRow' src/renderer/src/components/tab-bar
rg -n -F --glob '*.tsx' -- 'item.data.entityId' src/renderer/src/components/tab-bar
printf '%s\n' '--- focused menu test ---'
sed -n '1,340p' src/renderer/src/components/tab-bar/TabSessionSurfaceSwitchMenuItems.test.tsx
printf '%s\n' '--- context menu test relevant section ---'
sed -n '1,290p' src/renderer/src/components/tab-bar/SortableTabContextMenu.test.tsxRepository: stablyai/orca
Length of output: 24493
🏁 Script executed:
set -o pipefail
printf '%s\n' '--- row comparator and surface keys ---'
sed -n '180,220p' src/renderer/src/components/tab-bar/TabBarItemRow.tsx
sed -n '1,175p' src/renderer/src/components/tab-bar/tab-bar-item-surface.tsx
printf '%s\n' '--- agent-session entity model and writes ---'
rg -n -F --glob '*.{ts,tsx}' -- 'entityId' src/renderer/src src/shared | head -240
printf '%s\n' '--- title request mapping and ownership updates ---'
rg -n -F --glob '*.{ts,tsx}' -- 'collectAiVaultTitleRequests' src/renderer/src
sed -n '1,260p' src/renderer/src/lib/ai-vault-tab-title-requests.ts
printf '%s\n' '--- menu mount/open conditions ---'
rg -n -F --glob '*.tsx' -- 'SortableTabContextMenu' src/renderer/src/components/tab-bar/SortableTab.tsx src/renderer/src/components/tab-barRepository: stablyai/orca
Length of output: 41741
🏁 Script executed:
set -o pipefail
printf '%s\n' '--- SortableTab subscriptions and menu mount ---'
sed -n '82,145p' src/renderer/src/components/tab-bar/SortableTab.tsx
sed -n '350,410p' src/renderer/src/components/tab-bar/SortableTab.tsx
printf '%s\n' '--- agent status/provider session state writes ---'
rg -n -F --glob '*.{ts,tsx}' -- 'agentStatusByPaneKey' src/renderer/src | head -160
rg -n -F --glob '*.{ts,tsx}' -- 'providerSession' src/renderer/src/store src/renderer/src/hooks src/renderer/src/runtime | head -180
printf '%s\n' '--- title sync update path ---'
sed -n '95,190p' src/renderer/src/lib/ai-vault-title-sync.tsRepository: stablyai/orca
Length of output: 41441
🏁 Script executed:
set -o pipefail
printf '%s\n' '--- exact reviewed hook and menu lifecycle ---'
nl -ba src/renderer/src/components/tab-bar/TabSessionSurfaceSwitchMenuItems.tsx | sed -n '28,68p'
nl -ba src/renderer/src/components/tab-bar/SortableTabContextMenu.tsx | sed -n '140,158p;260,274p'
printf '%s\n' '--- exact SortableTab subscription ---'
nl -ba src/renderer/src/components/tab-bar/SortableTab.tsx | sed -n '95,116p;374,410p'
printf '%s\n' '--- provider-session update contract ---'
nl -ba src/renderer/src/store/slices/agent-status-live-reducer.ts | sed -n '1,82p'
nl -ba src/renderer/src/store/slices/agent-status-runtime.ts | sed -n '80,112p'Repository: stablyai/orca
Length of output: 10456
🏁 Script executed:
set -o pipefail
printf '%s\n' '--- provider-session action implementation ---'
rg -n -F --glob '*.{ts,tsx}' -- 'recordAgentProviderSession' src/renderer/src
rg -n -F --glob '*.{ts,tsx}' -- 'agentStatusByPaneKey:' src/renderer/src/store/slices/agent-status* | head -120
printf '%s\n' '--- activity resolver binding ---'
rg -n -F --glob '*.{ts,tsx}' -- 'function resolveTerminalTabActivityStatus|const resolveTerminalTabActivityStatus|resolveTerminalTabActivityStatus' src/renderer/srcRepository: stablyai/orca
Length of output: 7067
🏁 Script executed:
set -o pipefail
printf '%s\n' '--- bound dropdown menu implementation ---'
rg -n -F --glob '*.{ts,tsx}' -- 'export.*DropdownMenuContent|function DropdownMenuContent|const DropdownMenuContent' src/renderer/src/components/ui src/renderer/src
rg -n -F --glob '*.{ts,tsx}' -- 'DropdownMenuContent' src/renderer/src/components/ui/dropdown-menu*Repository: stablyai/orca
Length of output: 338
🏁 Script executed:
nl -ba src/renderer/src/components/ui/dropdown-menu.tsx | sed -n '1,75p'Repository: stablyai/orca
Length of output: 4398
Refresh the terminal subject when provider ownership changes.
When a terminal tab changes its providerSession.id while its menu remains open, useTabSessionSwitch keeps the subject captured at mount. The lookup can therefore resolve the previous conversation, and the existing resolved value remains available. The menu can then launch an action for a conversation that the tab no longer owns.
Derive the subject from a subscribed store selector. When it changes, cancel the previous lookup, clear resolved, and start a lookup for the new subject.
Review summaryProblem. "Resume in New CLI" (native chat → terminal) and "Resume in New Native Chat" (terminal agent → chat) existed only on the Session History row menu. This PR adds them to the tab right-click menu, through the same code path as that row. What changes for users. Right-click a Claude/Codex chat or terminal tab and the move is offered at the bottom of the menu, in exactly the cases the Session History row offers it. Clicking opens a new tab and keeps the original. Fixed during review (2 rounds + live QA)
Known behavior, unchanged from main (decision with Brennan)
Deferred (minor)
Verified: live on macOS (hidden test copy, real Claude Code vs a local fake model, no credentials): chat-tab, terminal-tab and plain-shell menus, both click results, the takeover case, before/after (Visual Proof). Code review of parity with the Session History row, perf and architecture; targeted tests, |
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:
4f11423c-0b81-4f94-9bae-03a77caa7713
📒 Files selected for processing (4)
src/renderer/src/components/tab-bar/SortableTabContextMenu.test.tsxsrc/renderer/src/components/tab-bar/SortableTabContextMenu.tsxsrc/renderer/src/components/tab-bar/TabSessionSurfaceSwitchMenuItems.test.tsxsrc/renderer/src/components/tab-bar/TabSessionSurfaceSwitchMenuItems.tsx
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 4 remain after this review.
| </DropdownMenuItem> | ||
| </> | ||
| ) : null} | ||
| <TabSessionSurfaceSwitchMenuItems |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
Move the session action to the final menu group.
When a lookup finds an eligible session, this component inserts its item above Pin Tab. Pin and Close then shift while the menu is open. Place the component after the tab-color group, and update the placement test that currently requires the opposite order. This also matches the stated goal of keeping Pin and Close in place.
|
Update (e33d61f), per Brennan: the chat/CLI move now sits in its own group right above Pin Tab on both chat and terminal tabs, and "Switch to chat view" is hidden from the tab menu while that toggle is removed (a tab already in chat view keeps "Switch to terminal view" in the same group, so it isn't stranded; the terminal pane's own right-click menu is unchanged). Trade-off: the item appears once the history check returns (~150 ms in QA, longer on a cold large history), so Pin/Close move down one row when it lands. Placement screenshots in the PR body are recaptured on this head; click results and the takeover check are from ebf7393 (same behavior). |
ELI5
The Session History panel already lets you move a conversation between native chat and a terminal ("Resume in New Native Chat" on a terminal agent's row, "Resume in New CLI" on a native chat's row). You could only do that from Session History. Now you can also right-click the tab itself and pick the same item.
What Changed
The problem. To continue a "Claude Chat" tab in a terminal (or a Claude/Codex terminal tab in a native chat), you had to open Session History, find that conversation's row, and open its menu. Brennan asked for the move on the tab's right-click menu, using "the same exact code path as the button we already have in the agent sidebar".
What you see now.
How it works.
resolveAiVaultSessionSurfaceSwitchTargets), one input composition (resolveAiVaultHistoryRowResume), one menu-item component, and one list request (aiVaultSessionListArgs). Clicking calls the samehandleResumeInNewCli/handleResumeInNewChatfromuseAiVaultSessionLaunchActionsthat the row calls. An unmocked test checks the panel and the tab reach the same answer for the same session.Why
Linked Issue
N/A (maintainer request).
Visual Proof
Hidden test copy of the app on macOS, real Claude Code against a local fake model server (no credentials). BEFORE =
origin/maindec18a8. Menu placement = PR head e33d61f; click results and the takeover check = ebf7393 (same behavior, the item was then at the bottom of the menu).Before (main): chat tab menu, no switch item
After (a): chat tab menu, "Resume in New CLI" right above Pin Tab
After (b): Claude terminal tab menu, "Resume in New Native Chat" right above Pin Tab, no "Switch to chat view"
After (c): plain shell tab, neither item
After (a) clicked: new "Claude Code" terminal tab with the conversation (
--resume <id> --fork-session), chat tab keptAfter (b) clicked: new "Claude Chat" tab with the conversation, terminal tab kept
After (b), once the chat holds the conversation: the terminal tab no longer offers the move (never shown in frames at 0/150/400/1000/2000 ms, twice)
Testing
tab-session-history-switch.test.ts/.parity.test.ts: tab-to-conversation mapping, host skips (SSH, CLI tabs on remote servers), shared request with the panel, no renderer-cache writes, budgeted rescan, cancel before the rescan, and an unmocked panel-vs-tab parity check.TabSessionSurfaceSwitchMenuItems.test.tsx: nothing before the fresh reply, a stale cached row never shown, clicks call the Session History handlers, late/failed/cancelled replies.ai-vault-panel-session-list-request.test.tsx: the panel's request is unchanged.ai-vault-session-surface-switch.test.ts,SortableTabContextMenu.test.tsx: shared rule, placement above Pin Tab, hidden "Switch to chat view", the kept way back from chat view, separators.pnpm tc:web,oxlint,pnpm run check:code-quality:changed,orca-ci-checks --no-typecheck(22/22). CI re-running on e33d61f.AI Disclosure
Review
Agent skill upstream boundary
Notes
Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)