Skip to content

feat(native-chat): offer actions for what you right-click in chat - #28729

Merged
AmoabaKelvin merged 3 commits into
stablyai:mainfrom
AmoabaKelvin:feat/native-chat-richer-context-menu
Oct 16, 2026
Merged

AmoabaKelvin merged 3 commits into
stablyai:mainfrom
AmoabaKelvin:feat/native-chat-richer-context-menu

Conversation

@AmoabaKelvin

@AmoabaKelvin AmoabaKelvin commented Oct 14, 2026 •

Copy link
Copy Markdown
Collaborator
Files Added Deleted Net
Test 7 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​365 $\color{#cf222e}{\Huge{\mathbf{−}}}$​32 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​333
Prod 25 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​661 $\color{#cf222e}{\Huge{\mathbf{−}}}$​235 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​426

ELI5

Right-clicking in a chat used to offer almost nothing about the thing you clicked. Now the menu offers what makes sense for it: open or copy a link, copy a code block or a whole message, quote a selection back into the chat, rewind to a prompt, or open Find. A chat running over a terminal also gets the terminal menu's Copy Context and Clear Pane Title.

What Changed

Before: the chat right-click menu offered Copy image, Copy (only with a selection), Paste (only in a text field), plus the session and pane items. Right-clicking a link, a code block or a message gave no actions for it. The "Add to chat" quote button hid itself while the menu was open, and Copy Context and Clear Pane Title from the terminal menu were missing in a terminal-backed chat.

After: the menu offers rows for whatever was right-clicked, each running the action that target's own button or click already runs:

  • Selected text in a reply: Copy (unchanged) plus Add to chat, offered under the same rule and label as the selection quote popover.
  • Web link: the same destinations as the link click popover (Orca Browser / System Browser), plus Copy link.
  • File link: Open file, Open with default app, Reveal in Finder/Explorer (same rows as the file link popover), plus Copy Path.
  • Code block: Copy code, the same text as the block's copy button.
  • Message: Copy message, only where the hover copy button shows, with the same text.
  • Your prompt in a chat tab: Rewind to here, only where the hover rewind button shows, disabled with the same reason when that button is, and through the same confirm dialog.
  • Anywhere in the chat (desktop app): Find in chat, with its ⌘F / Ctrl+F label from the user's keybindings.
  • Chat over a terminal: Copy Context, and Clear Pane Title when the pane has a title. Both run the terminal pane's own handlers for that pane.

Copy, Paste and the other rows still show only where they apply (#26207). Select All, Quick Commands, Clear Screen and Reset Terminal stay terminal-only. The transcript is windowed, so a select-all would copy only part of it. Quick Commands would type into the agent's terminal behind the composer. Clear Screen and Reset Terminal change nothing you can see in chat.

Mechanism: when the menu opens, it reads what was right-clicked (native-chat-context-menu-target.ts). Rows carry only ids in the DOM, never copy text. Message text comes from the transcript's own rows through the message list's handle (messageCopyText), using the same text derivation as the hover copy buttons. Link rows come from one builder, native-chat-link-target-actions.ts, that the click popover now uses as well, so click and right-click can't drift apart. Hand Off, Copy Context and Clear Pane Title render through components shared with the terminal menu. The find hook exposes the open step its shortcut already ran.

Reviewing: the first commit is a pure move. The existing split/expand/title/ID/close rows go unchanged into NativeChatPaneMenuItems.tsx, because the menu hook hit the 400-line limit. Check it with git diff --color-moved; the second commit is the new behavior.

Why

Every new row reuses an existing handler (hover copy, quote popover, link popover, rewind button, find shortcut, terminal pane menu), so the menu adds no new behavior that could disagree with the button next to it. The alternatives were storing copy text in DOM attributes or recomputing message text from the host's raw message list. The first duplicates large text in every row. The second misses rows the list builds itself: pending sends, the launch prompt, merged tool runs.

Linked Issue

No issue; internal request to make the chat right-click menu richer and bring over the terminal items that apply.

Visual Proof

Hidden dev build over CDP (macOS, a Claude chat tab and a Claude chat over a terminal pane):

Target Menu
Selected reply text tb-selection.png
Web link tb-link.png
File link tb-file.png
Code block tb-code.png
Your prompt tb-user.png
Empty area tb-empty.png
Chat over a terminal, pane titled tb-bridge-titled.png

Before: the same right-clicks showed only Copy/Paste where they applied plus the pane items (no link, code, message, quote, Find, Copy Context or Clear Pane Title rows).

Testing

  • I manually tested these changes locally

  • Automated tests added/updated, or explained why not below

  • Live (macOS, hidden dev build): Copy code and Copy message put exactly the hover buttons' text on the clipboard. Add to chat quoted the selection into the composer. Find opened and focused the find bar. Copy Context copied the agent transcript and showed "Context copied". Clear Pane Title appeared only after Set Title and removed the title. The terminal pane's own menu still shows Copy Context.

  • New tests: use-native-chat-context-menu.targets.test.tsx (links, file links, Add to chat, rewind enabled and disabled, empty area, Find, Copy Context, Clear Pane Title), NativeChatResolvedView.context-menu.test.tsx (copy a real rendered reply, its code block and a prompt, matched against the hover copy button; no Copy message on a reply still being written), and TerminalPaneNativeChatPortal.test.tsx (the new actions target the chat's pane). All 9 new behavior tests fail with the production files reverted to main.

  • Ran: pnpm tc, oxlint and oxfmt on changed files, and the focused test files for the changed modules.

Not verified:

  • Rewind to here in the live app: the test chat offered no hover rewind button, so the menu correctly offered none. Covered by unit tests only.
  • Windows and Linux: not run. Shortcut labels come from the keybinding formatter, so they show Ctrl+ there.
  • An SSH workspace: not run live. Link rows come from the same builder the click popover uses, which already routes by the link's owning host.
  • Lint on this head: pnpm tc, check:code-quality:changed, check:react-doctor:changed and the focus-read ratchet pass, and repo-wide oxlint is clean except max-lines on two test files this PR does not touch (src/shared/git-binary-compatibility.test.ts 820/800, mobile/src/session/MobileNativeChatView.test.ts 806/800), which both fail on a clean origin/main too. pnpm lint stops at that oxlint step, so its later audit steps last passed one rebase earlier.

Notes

  • Cross-platform: Find's shortcut label comes from the user's keybindings (⌘F on macOS, Ctrl+F elsewhere). Find is hidden in the web client, where the browser keeps its own find.
  • SSH and folder workspaces: link rows route through the same owner-aware builder as the click popover. Nothing here assumes a git worktree.
  • The focus-read ratchet baseline entry moved from use-native-chat-link-actions.ts to native-chat-link-target-actions.ts, because the same read moved with the builder.

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)

@AmoabaKelvin
AmoabaKelvin force-pushed the feat/native-chat-richer-context-menu branch from 3ce6ed0 to 5a7f589 Compare October 14, 2026 19:39
@AmoabaKelvin
AmoabaKelvin marked this pull request as ready for review October 14, 2026 20:39
@AmoabaKelvin AmoabaKelvin changed the title Offer actions for what was right-clicked in chat feat(native-chat): offer actions for what you right-click in chat Oct 14, 2026
@coderabbitai

coderabbitai Bot commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Important

Review skipped

Review was skipped as selected files did not have any reviewable changes.

⚙️ Run configuration
  • Configuration used: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 142c6714-bf96-467f-92db-8ea7536c1d75
📥 Commits

Reviewing files that changed from the base of the PR and between c37236877215de80ea33ab53a22b826b27f302de and abe8d26.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

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: c07cc3f9-c85c-46f4-931b-8553bf40d6aa
📥 Commits

Reviewing files that changed from the base of the PR and between d96ec1fe0595598e96e90fb8e7f2a1f2570aedf0 and c37236877215de80ea33ab53a22b826b27f302de.

📒 Files selected for processing: 5
  • src/renderer/src/components/native-chat/use-native-chat-context-menu.find.test.tsx
  • src/renderer/src/components/native-chat/use-native-chat-context-menu.targets.test.tsx
  • src/renderer/src/components/native-chat/use-native-chat-context-menu.tsx
  • src/renderer/src/components/native-chat/use-native-chat-find.ts
  • src/renderer/src/components/native-chat/use-native-chat-root-input-routing.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 4 remain after this review.

📝 Walkthrough

Native-chat context menus now support quoting selected text, copying links, code, and messages, opening link targets, requesting rewind, and opening Find. Chat views pass the required target and action context to the menu. Terminal-pane menus use reusable items for copying agent-session context and clearing pane titles. Link-routing and file-opening helpers are shared by click and context-menu actions.

Priority: ⬇️ Low

Merge Risk: ⚪ Minimal · up to c3723

No actionable merge-blocking issue is established. Complete normal validation before merging.

Pre-merge checks: Passed 3 · Failed 2

Failed Failed checks: 2 warnings

Check name Status Explanation Resolution
Description check Warning The description provides a detailed user-facing summary, implementation details, visual proof, testing results, limitations, and checklist status. However, it does not provide the required linked issu… Add an actual linked issue under "Linked Issue" instead of stating "No issue." Add the missing "Review" and "Agent skill upstream boundary" sections, or explicitly mark them as not applicable. Confirm whether the AI Disclosure section is ap…
Docstring Coverage Warning Docstring coverage is 57.14% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 42 functions across 33 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 3 passed
Check name Status Explanation
Title check Passed The title clearly and concisely describes the main change: adding context-menu actions for native chat targets.
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.
Full details: Description check

Explanation

The description provides a detailed user-facing summary, implementation details, visual proof, testing results, limitations, and checklist status. However, it does not provide the required linked issue and omits the Review and Agent skill upstream boundary sections.

Resolution

Add an actual linked issue under "Linked Issue" instead of stating "No issue." Add the missing "Review" and "Agent skill upstream boundary" sections, or explicitly mark them as not applicable. Confirm whether the AI Disclosure section is applicable and complete it if required.

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

@AmoabaKelvin
AmoabaKelvin force-pushed the feat/native-chat-richer-context-menu branch from 5a7f589 to d96ec1f Compare October 16, 2026 01:31
…component

Moves the split, expand, title, ID and close rows unchanged out of
use-native-chat-context-menu.tsx so the hook stays under the file size limit.
The chat's right-click menu only knew about selections and images, so links,
code blocks and messages offered nothing, and the terminal menu's Copy
Context and Clear Pane Title were missing over a terminal-backed chat.

The menu now reads what was right-clicked and offers the action that
target's own surface already runs: the link popover's rows plus Copy link or
Copy Path, the code block's and message's hover copy text, the selection
quote's Add to chat, the hover rewind button, and Find in chat. Rows carry
only ids in the DOM; message text comes from the transcript through the
message list handle. Click and right-click now share one link-action builder,
and the terminal and chat menus share the Hand Off, Copy Context and Clear
Pane Title rows.
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