Repository navigation
feat(native-chat): offer the link-action popover for chat links - #19130
Conversation
A plain click on an http(s) link in a native chat transcript opened the system browser outright, ignoring the link-routing preference the same link honors in the terminal. Chat now shows the terminal's destination popover, with the modifier chords routing straight to a destination. The popover, its request type, the destination policy and the routed open move out of terminal-pane so both surfaces share one implementation; the catalog keys keep their original namespace because they carry shipped translations. Chat resolves its link owner from the session workspace (runtime, then SSH, unresolved stays unknown) so a remote transcript only offers Orca Browser when that host's managed browser route is eligible. The existing toggle now governs both surfaces, so it is retitled; with it off a chat link still opens on a plain click instead of going dead.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Team Run ID: 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (1)
Included review availability: Your plan provides up to 10 included reviews per hour; 4 remain after this review. 📝 WalkthroughWalkthroughThe change adds shared link-action types and a reusable popover for terminal and native chat links. HTTP destination selection moves into shared routing helpers. Native chat links now resolve source ownership, support destination actions, restore focus, and preserve file-link handling. Terminal link handling adopts the shared routing contracts. Settings text and search metadata now include chat transcript links. Tests cover routing, ownership, modifiers, popovers, and integration paths. Merge Risk: ⚪ Minimal · up to This change updates shared link-action coverage configuration without an identified current-head merge risk. 🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
Full details: Description checkExplanation The description gives a detailed change summary and testing information, but it omits most required template sections. It has no linked issue, ELI5, Why, AI Disclosure, Review, Notes, Agent skill boundary, or Checklist section. Required visual proof is also not attached; it says screenshots will follow. Full details: Docstring CoverageExplanation Docstring coverage is 24.24% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 33 functions across 25 files. (1 skipped: 1 unsupported.)
✨ 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 |
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Team
Run ID: 07e207df-8142-4d62-8357-1ae15c9eaca9
📒 Files selected for processing (26)
src/renderer/src/components/link-actions/LinkActionPopover.test.tsxsrc/renderer/src/components/link-actions/LinkActionPopover.tsxsrc/renderer/src/components/link-actions/link-action-request.tssrc/renderer/src/components/native-chat/NativeChatResolvedView.tsxsrc/renderer/src/components/native-chat/NativeChatStructuredSession.test.tsxsrc/renderer/src/components/native-chat/NativeChatStructuredSession.tsxsrc/renderer/src/components/native-chat/native-chat-http-link-source-owner.test.tssrc/renderer/src/components/native-chat/native-chat-http-link-source-owner.tssrc/renderer/src/components/native-chat/native-chat-web-link-actions.test.tssrc/renderer/src/components/native-chat/native-chat-web-link-actions.tssrc/renderer/src/components/native-chat/use-native-chat-link-actions.test.tsxsrc/renderer/src/components/native-chat/use-native-chat-link-actions.tssrc/renderer/src/components/settings/BrowserTerminalLinkActionsSetting.tsxsrc/renderer/src/components/settings/browser-link-routing-copy.tssrc/renderer/src/components/settings/browser-search.test.tssrc/renderer/src/components/settings/browser-search.tssrc/renderer/src/components/terminal-pane/TerminalPaneSurface.tsxsrc/renderer/src/components/terminal-pane/terminal-link-action-request.tssrc/renderer/src/components/terminal-pane/terminal-link-open-hints.test.tssrc/renderer/src/components/terminal-pane/terminal-link-open-hints.tssrc/renderer/src/components/terminal-pane/terminal-pane-mount-preparation.tssrc/renderer/src/components/terminal-pane/terminal-url-link-hit-testing.tssrc/renderer/src/i18n/locales/en.jsonsrc/renderer/src/lib/http-link-destinations.test.tssrc/renderer/src/lib/http-link-destinations.tssrc/shared/global-settings-types.ts
Included review availability: Your plan provides up to 10 included reviews per hour; 5 remain after this review.
| export function useNativeChatLinkActions( | ||
| context: NativeChatFileLinkContext | null, | ||
| rootRef: RefObject<HTMLElement | null> | ||
| ): NativeChatLinkActions { | ||
| const openFileLink = useNativeChatFileLinkClick(context) | ||
| const [linkActionRequest, setLinkActionRequest] = useState<LinkActionRequest | null>(null) | ||
| const closeLinkActions = useCallback((dismissed?: LinkActionRequest) => { | ||
| setLinkActionRequest((current) => closeLinkActionRequest(current, dismissed)) | ||
| }, []) | ||
|
|
||
| const onLinkClick = useCallback<CommentMarkdownLinkClickHandler>( | ||
| (event, href) => { | ||
| if (!context) { | ||
| return | ||
| } | ||
| const route = routeNativeChatHref(href) | ||
| if (route.kind === 'file') { | ||
| openFileLink?.(event, href) | ||
| return | ||
| } | ||
| // mailto: and other schemes keep the anchor's default handling. | ||
| if (route.kind !== 'web' || !/^https?:/i.test(route.url)) { | ||
| return | ||
| } | ||
| // Read at click time: settings and workspace ownership must not re-render the transcript. | ||
| const state = useAppStore.getState() | ||
| const sourceOwner = resolveNativeChatHttpLinkSourceOwner(state, context.worktreeId) | ||
| handleNativeChatWebLink(event, route.url, { | ||
| worktreeId: context.worktreeId, | ||
| sourceOwner, | ||
| destinations: httpLinkActionDestinationsFor( | ||
| state.settings, | ||
| sourceOwner, | ||
| canNativeChatOpenOwnedBrowser(state, context.worktreeId, sourceOwner) | ||
| ), | ||
| actionsEnabled: state.settings?.terminalLinkActionPopoverEnabled !== false, | ||
| restoreFocus: () => rootRef.current?.focus({ preventScroll: true }), | ||
| request: setLinkActionRequest | ||
| }) | ||
| }, | ||
| [context, openFileLink, rootRef] | ||
| ) | ||
|
|
||
| return { | ||
| onLinkClick: context ? onLinkClick : undefined, | ||
| linkActionRequest, | ||
| closeLinkActions | ||
| } | ||
| } |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟠 Major | ⚡ Quick win
Keep HTTP routing when file context is unavailable. Both native-chat views can receive a null file-link context while the tab still identifies a workspace. The current hook then returns no handler, so HTTP(S) transcript links use the default anchor path and skip handleNativeChatWebLink. Derive worktreeId independently, use resolveNativeChatHttpLinkSourceOwner for HTTP(S) links, and keep file handling gated by the nullable file context. Keep allowFileUriLinks gated by fileLinkContext !== null so this does not enable file-link handling without a resolved path.
There was a problem hiding this comment.
Important
Two regressions worth fixing before merge: a DOM data-attribute rename that breaks three existing E2E specs, and a dead "System Browser" action for unresolved-owner chat links.
Reviewed changes
- Shared popover + destination policy —
TerminalLinkActionPopoverbecomes a genericLinkActionPopover(focusTerminal→restoreFocus), and the terminal's destination/label/open logic moves tolib/http-link-destinations.ts(openRoutedHttpLink,httpLinkActionDestinationsFor,buildHttpLinkActions) for reuse. - Native chat link actions — both chat surfaces wire
useNativeChatLinkActions, routing file links to the existing opener and http(s) links through the shared popover with workspace-derived source ownership (runtime→ssh→local/unknown). - Settings copy — the "Show terminal link actions" toggle is retitled "Show link actions" and gains a "chat" search keyword.
DeepSeek Pro (free via Pullfrog for OSS) | 𝕏
| } | ||
| const connectionId = getConnectionIdFromState(state, worktreeId) | ||
| if (connectionId === undefined) { | ||
| return { kind: 'unknown' } |
There was a problem hiding this comment.
unknown turns the popover's only offered action into a no-op. httpLinkActionDestinationsFor returns { primary: 'system' } for an unknown owner, so the popover shows a single "System Browser" row, but openHttpLink early-returns for sourceOwner.kind === 'unknown' (lib/http-link-routing.ts:125), so clicking that row silently does nothing. Before this PR a plain chat-link click on such a workspace fell through to the anchor's target="_blank" and opened the system browser.
Technical details
# Unknown-owner chat links hit a dead end
## Affected sites
- src/renderer/src/components/native-chat/native-chat-http-link-source-owner.ts:23 — returns `{ kind: 'unknown' }`
- src/renderer/src/lib/http-link-routing.ts:125 — `if (sourceOwner?.kind === 'unknown') return` (blocks all routing, including `forceSystemBrowser`)
- src/renderer/src/components/native-chat/native-chat-web-link-actions.ts — consumes the click (`preventDefault`) and offers the popover regardless of owner
## Required outcome
- A plain click on an http(s) chat link whose owner is unresolved must not dead-end; it should either open the system browser or fall through to the anchor default.
## Suggested approach
- The system browser is host-agnostic, so the "wrong host" safety concern only applies to in-app routing. For `sourceOwner.kind === 'unknown'`, return `false` from `handleNativeChatWebLink` (leave the anchor's `target="_blank"` default) instead of consuming the click and offering a dead action.
Native chat link popover Electron QA — PR 19130Validated HEAD App identity and launch
Scenarios1. Native-chat transcript plain click (full app context)Seeded a Claude JSONL transcript into a real native-chat pane ( Visible: URL, copy, settings gear, Orca Browser with ⌘ Click (primary because Open links in Orca was on), System Browser with ⇧⌘ Click. Backing: popover had both 2. Keyboard Enter + hide/reveal (editor follow-up)Focused Hide ( 3. Preference swap (primary/alternate)Set 4. Modifier bypassPlaywright 5. Toggle off
6. mailto unchangedClick on 7. Terminal shared popover (no regression)Echoed Unverified / constrained gaps
CleanupStop only recorded PIDs 36638 / 37892 / 40575 after verifying command lines contain this worktree and |
There was a problem hiding this comment.
Important
This delta is clean and fixes the E2E-selector regression, but the second finding from the prior review is still unaddressed and blocks merge: a chat link whose source owner resolves to unknown renders a "System Browser" row that silently does nothing, because openHttpLink early-returns for sourceOwner.kind === 'unknown' (lib/http-link-routing.ts:125). See the open thread on native-chat-http-link-source-owner.ts:23. The two commits here touch neither that resolution nor the click-consumption path, so the dead end remains.
Reviewed changes
- Restored
data-terminal-link-action-popover— the sharedLinkActionPopovernow keeps both the new generic attribute and the legacy terminal attribute, so the three terminal E2E specs (terminal-link-click-ownership,paired-remote-terminal-browser-link,golden-terminal-file-link) keep matching. - Dismissed the popover on scope change / hide —
useNativeChatLinkActionsgained a{ sessionId, isVisible }scope and clears a pending request when the transcript's workspace/session changes or the view goes hidden, avoiding a stale popover floating over a switched or hidden surface. - Anchored keyboard activation to the focused link — a
detail === 0click now positions the popover at the link's bounding rect instead of the(0,0)pointer position. - Focused restoration to the clicked anchor —
restoreFocustargets the clicked link, falling back torootRefwhen the anchor has since been disconnected.
DeepSeek Pro (free via Pullfrog for OSS) | 𝕏
Follow-up Electron QA — actual Orca Browser row + modifier clicksNarrow local Grok QA on HEAD 1. Real Orca Browser popover row (not a label-only check)Plain Playwright click on native-chat 2. Real Playwright Meta-click → in-app browser
3. Real Playwright Shift+Meta with system-primary → in-app alternate
Remaining constrained gaps
|
|
Review status at Three independent Codex review passes used the coordinator's same model and reasoning effort ( Two focused fixes were pushed:
Verification: 145 focused regression tests passed after the final fix, with web typecheck, lint/format/diff checks and commit hooks passing. All-project typechecks passed on the production-equivalent preceding commit. Opening readiness separately recorded 187 tests across 15 suites; these overlapping batches are not additive. Latest-head CI remains queued/in progress as of the closing review; E2E was skipped, so this is not a full-CI-green claim. Grok exercised the real native-chat and terminal UI through background Electron/CDP, with screenshots attached:
Remaining validation limits: live SSH owner routing and disconnected-owner rejection were not exercised because the isolated Docker prerequisite was unresponsive (both Docker info and a bounded socket ping). The SSH worker remains live but stalled on its model connection; no remote container or checkout was created. A separate structured-agent UI session, actual system-browser/mail-client launch, and native Windows/Linux/WSL interactions were not exercised. File-link, copy and settings execution were not re-exercised in Electron; automated coverage and unchanged routing are described in the reviews. Before landing, finish required latest-head CI and complete live SSH QA on a responsive isolated target, or explicitly accept that gap while retaining the other coverage limits above. No merge was performed. |
|
Follow-up at
Live SSH QA is still incomplete: Docker is now healthy, but the existing SSH worker remains stuck reconnecting to its model. Worker replacement permission is pending. The previous local Electron screenshots remain applicable because this commit changes only validation metadata; their structured-session/system-browser and other stated coverage limits remain. Do not land yet: required CI and live SSH proof remain outstanding. |
There was a problem hiding this comment.
Important
The new commit is a clean, mechanical config fix with no new issues, but it does not move the merge-blocking finding from the prior review: a chat link whose source owner resolves to unknown still renders a "System Browser" row that silently no-ops, because openHttpLink early-returns for sourceOwner.kind === 'unknown' (lib/http-link-routing.ts:125). Neither that resolution (native-chat-http-link-source-owner.ts:23) nor the click-consumption path is touched by this delta.
Reviewed changes
- Reliability-gate test-path refresh —
config/reliability-gates.jsoncnow references the renamedlink-actions/LinkActionPopover.test.tsxin both command lists and in the mutation-evidence entry (date / durationSeconds / summary updated). No dangling references to the removedTerminalLinkActionPopover.test.tsxremain, and the file stays valid JSONC.
DeepSeek Pro (free via Pullfrog for OSS) | 𝕏
|
SSH UI evidence for HEAD Qualification: direct-SSH native chat currently uses the local transcript adapter, so the remote JSONL fixture was staged byte-identically on the desktop to render the real chat surface; workspace/PTY ownership, clicks and network routing were real. No paired-runtime or structured-agent transport pass is claimed. Screenshots uploaded via gh image |
|
Final review status at Same-model review/fix loops and opening/closing readiness reviews are complete, with zero unresolved findings, including performance and lifecycle review. Three focused fixes were pushed: stale-popover dismissal/keyboard anchoring and terminal selector compatibility ( Latest-head CI has 17 passes, 11 conditional skips, no failures or pending checks. Static analysis, typecheck, all eight test shards, both packaging jobs and aggregate verification passed. E2E was skipped; the manual Electron evidence below is separately attributed. Focused local regression suites and the 106-gate validator also passed as detailed in prior comments; overlapping test batches are not additive. Rendered evidence:
The SSH test used a byte-identical local transcript fixture because the existing direct-SSH transcript adapter reads locally. The rendered components, clicks, SSH workspace/PTY ownership, browser routing and remote HTTP request were real. This proves changed link routing, not end-to-end remote transcript delivery or a remotely hosted browser engine. The disconnect check proves SSH route failure, not early row disabling or an owner-generation race. Residual coverage limits remain documented: no live structured-agent/paired-runtime session, owner re-registration race, remote modifier variants, actual system-browser/mail-client launch, or native Windows/WSL UI run. No new defect was established by those limits; expanding unchanged transport/platform behavior is outside this focused PR. The replacement SSH worker completed, its disposable containers/app/profile/keys were cleaned up, and its child worktree and evidence were preserved. The independent final readiness reviewer closed all eight sections for this scope. The PR branch is pushed and the coordinator workspace is clean. |
…lyai#19130) * feat(native-chat): offer the link-action popover for chat links A plain click on an http(s) link in a native chat transcript opened the system browser outright, ignoring the link-routing preference the same link honors in the terminal. Chat now shows the terminal's destination popover, with the modifier chords routing straight to a destination. The popover, its request type, the destination policy and the routed open move out of terminal-pane so both surfaces share one implementation; the catalog keys keep their original namespace because they carry shipped translations. Chat resolves its link owner from the session workspace (runtime, then SSH, unresolved stays unknown) so a remote transcript only offers Orca Browser when that host's managed browser route is eligible. The existing toggle now governs both surfaces, so it is retitled; with it off a chat link still opens on a plain click instead of going dead. * Fix native chat link popover lifecycle and keyboard anchoring * test(native-chat): use one store mock for link actions * fix: update reliability gate for shared link popover tests --------- Co-authored-by: Merge Sim <sim@local>















What
A plain click on an
http(s)link in a native chat transcript opened the system browser outright. It ignored the "Open http(s) links in Orca" preference — even though that setting's own copy promises to cover markdown — and offered none of the choices the same link gets in the terminal.Native chat (both the PTY-backed transcript and structured Claude/Codex sessions) now shows the terminal's link-action popover:
mailto:and file links are untouched; file links still route through the existing native-chat openerReuse rather than a second implementation
The popover moved to
components/link-actions/LinkActionPopover.tsx(generic over its request type,focusTerminal→restoreFocus), and the shared policy — destination types,httpLinkActionDestinationsFor, the label/action builder, and the routed open (openTerminalHttpLink→openRoutedHttpLink, which had no callers outside its own file) — moved tolib/http-link-destinations.ts. The terminal consumes those instead of its own copies, so the net is 925 added / 266 removed with 21 new tests — the non-test production delta is small.Catalog keys deliberately keep their original
auto.components.terminal.pane.TerminalLinkActionPopover.*namespace: they are opaque ids carrying shippedfrtranslations, and nothing enforces key-to-path correspondence.Remote correctness
Chat has no PTY, so link ownership comes from the session's workspace instead of a transport: runtime environment first, then SSH connection, and an unresolved owner stays
unknownrather than defaulting to local. "Orca Browser" is only offered when that host's managed-browser route is actually eligible — the samecanOpenWorkspaceBrowserTabOn{Runtime,Ssh}checks the terminal uses.Behavior changes worth a second look
en.jsonplus the duplicate default in the settings-search index; other locales keep their older wording, which no localization gate rejects). With the toggle off, a chat link still opens on a plain click rather than requiring a modifier — the terminal's "modifier only" behavior would leave chat links dead.Testing
openHttpLinkcalltscweb/node/cli clean;oxlintclean; changed-code quality gate 0 findings; max-lines ratchet OK; all four localization gates passlink-actions,native-chat(105 files),settings(172 files),terminal-pane,libNot covered: mobile chat is a separate app and unchanged. Chat anchors have no hover hint yet (the terminal's hint is xterm-side); the popover is the discovery affordance. Not yet exercised in a running app — screenshots to follow from the review loop.