Skip to content

Offer Resume in New CLI / Native Chat from the tab right-click menu - #26705

Merged
brennanb2025 merged 6 commits into
mainfrom
brennanb2025/tab-menu-chat-cli
Oct 9, 2026
Merged

brennanb2025 merged 6 commits into
mainfrom
brennanb2025/tab-menu-chat-cli

Conversation

@brennanb2025

@brennanb2025 brennanb2025 commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 7 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​1023 $\color{#cf222e}{\Huge{\mathbf{−}}}$​2 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​1021
Prod 15 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​651 $\color{#cf222e}{\Huge{\mathbf{−}}}$​101 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​550

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.

  • Right-click a native chat tab: Resume in New CLI (same tooltip as Session History). It opens a copy of the conversation in a new terminal tab; the chat tab stays.
  • Right-click a terminal tab running Claude or Codex: Resume in New Native Chat. It opens the conversation in a new native chat tab; the terminal tab stays.
  • Wherever the Session History row would not offer the item, the tab menu leaves it out (not disabled): plain shells, other agents, conversations with no saved messages, conversations a chat already holds, workspaces that can't run a native chat, other machines/folders.
  • The item has its own group right above Pin Tab, after the split items. It appears once the app has checked the session history (about 150 ms in QA; longer on a cold, large history), so on arrival it pushes Pin/Close down by one row.
  • "Switch to chat view" (the in-place view toggle, being removed separately) is hidden from the tab menu. A tab already in chat view keeps "Switch to terminal view" in that same group so it is never stranded.
  • Labels are the existing Session History strings; nothing new to translate.

How it works.

  • Same rule, same action, same request. The Session History row and the tab menu share one eligibility function (resolveAiVaultSessionSurfaceSwitchTargets), one input composition (resolveAiVaultHistoryRowResume), one menu-item component, and one list request (aiVaultSessionListArgs). Clicking calls the same handleResumeInNewCli / handleResumeInNewChat from useAiVaultSessionLaunchActions that the row calls. An unmocked test checks the panel and the tab reach the same answer for the same session.
  • Finding the conversation behind a tab. A chat tab by the chat session it shows; a terminal tab by the conversation id its agent reported (the same tab-to-conversation link tab titles use).
  • The lookup. Runs only while the menu is open, cancelled on close. It sends exactly the request the Session History panel sends for that workspace, so both share the host's cached list instead of evicting each other. It never writes the panel's cached results, and the menu only trusts a fresh reply (cached copies don't reflect a chat taking over a conversation). If the conversation is newer than the host's one-minute cache, at most one fresh rescan runs, drawn from the panel's existing 30-second rescan budget, local host only. SSH hosts, where neither move is ever offered, skip the lookup.

Why

  • Same code path as Session History, per the ask: a second launch path would drift from Session History's rules (eligibility, account folder, host refusals, SSH).
  • Look up the row rather than rebuild it from the tab: the rules need facts only the saved transcript has (saved message count, recorded folder, account folder).
  • Why not a new "find one session by id" lookup in the main process: it would be a second way to build the row that could drift from the one Session History shows. Sharing the panel's request and the host cache keeps one source.
  • Why only from a fresh reply: an earlier version showed a cached answer first, and QA saw it briefly offer a move a chat had already taken. Placement above Pin Tab is Brennan's call; the cost is the one-row shift when the item arrives.

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/main dec18a8. 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

before: chat tab menu

After (a): chat tab menu, "Resume in New CLI" right above Pin Tab

after: chat tab menu

After (b): Claude terminal tab menu, "Resume in New Native Chat" right above Pin Tab, no "Switch to chat view"

after: terminal tab menu

After (c): plain shell tab, neither item

after: plain shell menu

After (a) clicked: new "Claude Code" terminal tab with the conversation (--resume <id> --fork-session), chat tab kept

after: new CLI tab

After (b) clicked: new "Claude Chat" tab with the conversation, terminal tab kept

after: new chat tab

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)

after: takeover terminal menu

Testing

  • I manually tested these changes locally (hidden Electron test copy on macOS, see Visual Proof; driven through Chrome DevTools Protocol)
  • Automated tests added/updated
    • 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.
  • Ran: targeted tab-bar and Session History tests, 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

  • Not applicable, or this change copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.

Notes

  • SSH and remote: SSH tabs skip the lookup (neither move is offered there). Native chat tabs on a remote Orca server look up their row on that server; CLI-to-chat stays local, as the row's rule requires. Not tested against a real remote host.
  • Folder workspaces and WSL: treated as local, as the panel treats them.
  • Mobile and paired clients: no wire change.
  • Performance: per right-click on a Claude/Codex tab, one list request shared with the panel's host cache (a scoped scan when that cache is cold), cancelled when the menu closes. No cost on closed menus.

Checklist

  • This PR is small and focused
  • I explained what changed and why (ELI5, the user-facing before/after, the mechanism, and why over the alternatives)
  • Before/after screenshots or videos attached for UI changes, or N/A with reason
  • Self-reviewed for correctness, security, and performance
  • Cross-platform, SSH/remote, and path/shortcut impact considered (or N/A)
  • pnpm lint, pnpm typecheck, pnpm test, and pnpm build pass (or CI will cover; local preferred)

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.
@brennanb2025
brennanb2025 marked this pull request as ready for review October 9, 2026 01:13
@coderabbitai

coderabbitai Bot commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

📝 Walkthrough

Walkthrough

The 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 e33d6

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)

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 28.21% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 39 functions across 22 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ 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 main change: adding Resume in New CLI and Resume in New Native Chat to tab right-click menus.
Description check Passed The description is complete and matches the template. It explains the user-visible behavior, implementation, rationale, testing, visual proof, platform considerations, and limitations. The maintainer-…
  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Commit to this branch
  • Create a new PR
  • Autopilot · 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.

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.

@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.

🧹 Nitpick comments (1)
src/renderer/src/components/tab-bar/tab-session-history-switch.ts (1)

204-208: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Filter the forced-rescan result for resumable content.

The first list result passes through isAiVaultSessionResumableContent at Line 191. The forced-rescan result at Line 208 does not. Suppose the fresh scan still returns a zero-turn row. Then lookupTabSessionHistoryRow returns that row. The menu then calls resolveTabSessionSwitch for 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 from readCachedTabSessionHistoryRow. 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
📥 Commits

Reviewing files that changed from the base of the PR and between dec18a8 and b517cfd.

📒 Files selected for processing (22)
  • src/renderer/src/components/right-sidebar/AiVaultPanel.tsx
  • src/renderer/src/components/right-sidebar/AiVaultSessionActionMenuItems.tsx
  • src/renderer/src/components/right-sidebar/AiVaultSessionSurfaceSwitchMenuItems.tsx
  • src/renderer/src/components/right-sidebar/AiVaultVirtualRow.tsx
  • src/renderer/src/components/right-sidebar/ai-vault-host-scope.ts
  • src/renderer/src/components/right-sidebar/ai-vault-panel-session-list-request.test.tsx
  • src/renderer/src/components/right-sidebar/ai-vault-panel-session-list-request.ts
  • src/renderer/src/components/right-sidebar/ai-vault-session-list-request.ts
  • src/renderer/src/components/right-sidebar/ai-vault-session-refresh.ts
  • src/renderer/src/components/right-sidebar/ai-vault-session-resume-in-chat-workspace.ts
  • src/renderer/src/components/right-sidebar/ai-vault-session-surface-switch.test.ts
  • src/renderer/src/components/right-sidebar/ai-vault-session-surface-switch.ts
  • src/renderer/src/components/tab-bar/SortableTab.rename-shortcut.test.tsx
  • src/renderer/src/components/tab-bar/SortableTab.tsx
  • src/renderer/src/components/tab-bar/SortableTabContextMenu.test.tsx
  • src/renderer/src/components/tab-bar/SortableTabContextMenu.tsx
  • src/renderer/src/components/tab-bar/TabBarItemRow.tsx
  • src/renderer/src/components/tab-bar/TabSessionSurfaceSwitchMenuItems.test.tsx
  • src/renderer/src/components/tab-bar/TabSessionSurfaceSwitchMenuItems.tsx
  • src/renderer/src/components/tab-bar/tab-session-history-switch.parity.test.ts
  • src/renderer/src/components/tab-bar/tab-session-history-switch.test.ts
  • src/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.

@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: 54c3d6e2-e1ae-4ba7-b648-489dc45cf71c
📥 Commits

Reviewing files that changed from the base of the PR and between b517cfd and ebf7393.

📒 Files selected for processing (4)
  • src/renderer/src/components/tab-bar/TabSessionSurfaceSwitchMenuItems.test.tsx
  • src/renderer/src/components/tab-bar/TabSessionSurfaceSwitchMenuItems.tsx
  • src/renderer/src/components/tab-bar/tab-session-history-switch.test.ts
  • src/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.

Comment on lines +39 to +46
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

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.

🎯 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.tsx

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

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

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

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

Repository: 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/src

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

@brennanb2025

Copy link
Copy Markdown
Contributor Author

Review summary

Problem. "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)

  • The item first appeared ~0.2–5 s after the menu opened, above Pin Tab, pushing Pin/Close down under the pointer (misclick risk). It is now the last group of the menu, so its arrival moves nothing above it.
  • Each right-click ran its own history scan with a different request than the Session History panel: it evicted the panel's cached list and, on a miss, forced an unthrottled full rescan (bypassing the panel's 30 s rescan budget and resetting the scanner's crash breaker). It now sends the panel's exact request (shared host cache), takes any forced rescan from the panel's budget (local host only), and skips SSH hosts where neither move is ever offered.
  • The tab menu wrote its results into the panel's cached list, so a Session History panel opened later could show a pre-resume list. It no longer writes that cache.
  • A cached answer could offer "Resume in New Native Chat" on a terminal tab whose conversation a chat had already taken (click → "Another chat is already holding this conversation"), and live QA saw it flash then disappear. The menu now trusts only a fresh reply; QA confirmed it never shows in that case.
  • "Resume in New CLI" had been hidden on chat tabs in workspaces on a remote Orca server, where the row offers it; restored.
  • The resume inputs (resume target and chat eligibility) the panel and the tab feed the shared rule are now built by one function, with an unmocked parity test.

Known behavior, unchanged from main (decision with Brennan)

  • "Resume in New Native Chat" on a terminal tab whose CLI is still running opens the chat on the same conversation, not a copy; the CLI keeps running. The two then continue separately and both write to the same saved conversation. The Session History row does the same on main; the tab menu makes it the common case. A follow-up could stop the CLI first or start the chat from a copy, on both surfaces.

Deferred (minor)

  • If the menu opens upward (lower group of a top/bottom split, short window), the late item can still shift it (not reproduced).
  • A tab right-click can delay the panel's own forced rescan by up to 30 s (shared budget).
  • Each right-click on a Claude/Codex tab sends one list request; when the host cache is cold that is a scoped scan (up to 250 rows), cancelled on close.
  • Floating-terminal tabs don't show the item; new tabs open in the active split group, not next to the right-clicked tab (as from Session History).
  • The Session History row's title updates on the panel's next refresh after a resume, not immediately (existing panel refresh behavior).
  • QA saw the right sidebar's "More sidebar tabs" button covered by another control in the test copy; not checked on main and not touched here.

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, pnpm tc:web, CI-equivalent static checks; CI green on ebf7393.
Not verified: Codex sessions live, SSH/remote-server/WSL hosts, Windows/Linux, very large histories.

@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: 4f11423c-0b81-4f94-9bae-03a77caa7713
📥 Commits

Reviewing files that changed from the base of the PR and between ebf7393 and e33d61f.

📒 Files selected for processing (4)
  • src/renderer/src/components/tab-bar/SortableTabContextMenu.test.tsx
  • src/renderer/src/components/tab-bar/SortableTabContextMenu.tsx
  • src/renderer/src/components/tab-bar/TabSessionSurfaceSwitchMenuItems.test.tsx
  • src/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

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.

🎯 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.

@brennanb2025

Copy link
Copy Markdown
Contributor Author

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).

@brennanb2025
brennanb2025 merged commit d191386 into main Oct 9, 2026
51 of 53 checks passed
@brennanb2025
brennanb2025 deleted the brennanb2025/tab-menu-chat-cli branch October 9, 2026 20:18
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