Repository navigation
fix: improve mobile link modifier handling - #5597
Conversation
|
Ready to review this PR? Stage has broken it down into 10 individual chapters for you: Chapters generated by Stage for commit 1a86c4d on Jun 18, 2026 11:36pm UTC. |
📝 WalkthroughWalkthroughThis PR implements end-to-end OSC 8 hyperlink support in the mobile terminal: a new 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. 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: 2
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
mobile/src/browser/MobileBrowserPane.tsx (1)
655-690:⚠️ Potential issue | 🟠 Major | ⚡ Quick winAvoid downgrading modified clicks to plain clicks on fallback.
Line 661 sends modifiers through
browser.mouseClick, but if that request fails, Lines 679-689 retry viamouseMove/mouseDown/mouseUpwithout modifiers. That can turn an intended Cmd/Ctrl-click into a plain click and trigger the wrong action.💡 Suggested fix
- if (clickResult !== null) { + if (clickResult !== null || pointerModifiers.length > 0) { return }Also applies to: 697-697
🧹 Nitpick comments (2)
src/main/daemon/headless-osc-link-ranges.ts (1)
21-22: ⚡ Quick winDocument why private terminal internals are intentionally read here.
This extractor depends on non-public buffer/link internals; please add a short “Why” comment at the
_oscLinkServiceandextended.urlIdaccess points so future cleanup/refactors don’t accidentally break OSC range capture.Suggested patch
export function collectHeadlessOscLinkRanges( terminal: Terminal, scrollbackRows: number | undefined ): TerminalOscLinkRange[] { + // Why: headless xterm exposes OSC 8 metadata only via private core link service. + // Keep this boundary explicit so xterm upgrades are audited here. const service = (terminal as TerminalWithOscLinks)._core?._oscLinkService if (!service) { return [] } @@ function getOscLinkIdAtCell(line: { getCell: (col: number) => unknown }, col: number): number { const cell = line.getCell(col) as CellWithOscLink | undefined + // Why: OSC link IDs are stored in extended cell attrs; missing attrs means no link. return cell?.hasExtendedAttrs?.() && cell.extended?.urlId ? cell.extended.urlId : 0 }As per coding guidelines, “When writing or modifying code driven by a design doc or non-obvious constraint, add a comment explaining why the code behaves the way it does.”
Also applies to: 55-57
Source: Coding guidelines
mobile/app/h/[hostId]/session/[worktreeId].tsx (1)
3434-3442: 💤 Low valueConsider memoizing
handleCreateBrowserto stabilizehandleTerminalLink.
handleCreateBrowseris a regular async function that gets recreated on every render. SincehandleTerminalLinkdepends on it, the callback also changes on every render, potentially causing unnecessary re-renders ofTerminalPaneView.This is a low-priority optimization since the mobile terminal already handles frequent prop updates, but worth noting for future cleanup.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: 5085b14c-339b-4692-bd79-3bd8b409e8b4
📥 Commits
Reviewing files that changed from the base of the PR and between 6cea158 and 699af226b3ec6dc31fa9ad36395ec4154615ad20.
📒 Files selected for processing (27)
mobile/app/h/[hostId]/session/[worktreeId].tsxmobile/src/browser/MobileBrowserKeyRow.tsxmobile/src/browser/MobileBrowserPane.tsxmobile/src/browser/MobileBrowserPointerModifiers.tsxmobile/src/session/TerminalPaneView.tsxmobile/src/terminal/TerminalWebView.tsxmobile/src/terminal/default-terminal-theme.tsmobile/src/terminal/terminal-accessory-keys.test.tsmobile/src/terminal/terminal-accessory-keys.tsmobile/src/terminal/terminal-osc-link-ranges.tsmobile/src/terminal/terminal-webview-protocol.tsmobile/src/terminal/terminal-webview-styles.tssrc/main/browser/agent-browser-bridge.test.tssrc/main/browser/agent-browser-bridge.tssrc/main/daemon/headless-emulator.test.tssrc/main/daemon/headless-emulator.tssrc/main/daemon/headless-osc-link-ranges.tssrc/main/daemon/types.tssrc/main/runtime/orca-runtime-browser.tssrc/main/runtime/orca-runtime.tssrc/main/runtime/rpc/methods/browser-extras.tssrc/main/runtime/rpc/methods/terminal.tssrc/renderer/src/components/terminal-pane/terminal-link-handlers.test.tssrc/renderer/src/components/terminal-pane/terminal-link-open-hints.tssrc/renderer/src/components/terminal-pane/terminal-osc-link-routing.tssrc/renderer/src/lib/pane-manager/pane-lifecycle.tssrc/shared/terminal-osc-link-ranges.ts
| var initialOscLinks = []; | ||
| var mouseModeScanTail = ''; |
There was a problem hiding this comment.
Stale initialOscLinks rows can open the wrong URL after scrollback eviction.
initialOscLinks is captured once at init and then used as a row/col fallback, but row indices shift once xterm starts evicting lines (scrollback cap reached). At that point, fallback lookups can resolve taps against outdated ranges and misroute link opens.
💡 Proposed fix
@@
var oscLinkService = null;
var initialOscLinks = [];
+ var initialOscLinkRowOffset = 0;
@@
function init(cols, rows, initialData, nextTheme, nextOscLinks) {
@@
initialOscLinks = Array.isArray(nextOscLinks) ? nextOscLinks : [];
+ initialOscLinkRowOffset = 0;
@@
function logFeedAndEvict() {
linesEverWritten++;
+ if (isBufferFull()) initialOscLinkRowOffset += 1;
if (selMode === 'select' && sel && isBufferFull()) {
sel.anchor.row -= 1;
sel.focus.row -= 1;
@@
function getInitialOscLinkAtCell(row, col) {
for (var i = 0; i < initialOscLinks.length; i++) {
var link = initialOscLinks[i];
- if (link && link.row === row && col >= link.startCol && col < link.endCol && typeof link.uri === 'string') return link.uri.trim();
+ if (!link || typeof link.uri !== 'string') continue;
+ if (link.row < initialOscLinkRowOffset) continue;
+ var shiftedRow = link.row - initialOscLinkRowOffset;
+ if (shiftedRow === row && col >= link.startCol && col < link.endCol) return link.uri.trim();
} return '';
}Also applies to: 608-608, 1504-1509
Routes ordinary clicks on embedded terminal hyperlinks through Orca's existing link-routing policy instead of letting Electron open the system browser directly. - Handle OSC 8 links without requiring Cmd/Ctrl-click - Preserve Shift-click as the system browser/default app escape hatch - Update terminal link hover hints and coverage for ordinary clicks
Adds the missing mobile controls needed to open links from macOS hosts and fixes first-load terminal links that visually rendered as links without carrying URL metadata. - Add Cmd to the terminal shortcut bar after Arrow Right by default - Add mobile browser pointer modifiers for Cmd, Ctrl, Alt, and Shift clicks - Preserve OSC 8 link ranges in terminal snapshots for immediate mobile taps - Focus newly created browser tabs after terminal link activation - Split large mobile terminal/browser code into focused modules
699af22 to
0cb22b6
Compare
There was a problem hiding this comment.
Actionable comments posted: 3
🧹 Nitpick comments (1)
mobile/src/terminal/terminal-webview-html.ts (1)
838-851: 💤 Low valueConsider resetting
initialOscLinkson clear to avoid stale link state.The
clearhandler resets mouse tracking state but leavesinitialOscLinksandinitialOscLinkRowOffsetintact. Whileclear()is typically followed byinit()which resets these, an explicit reset here would be more defensive.💡 Optional fix
} else if (msg.type === 'clear') { terminalGeneration++; resetWriteQueue(); afterDrainCallbacks = []; writesDraining = false; mouseModeScanTail = ''; trackedMouseTrackingMode = 'none'; sgrMouseMode = false; sgrMousePixelsMode = false; + initialOscLinks = []; initialOscLinkRowOffset = 0; if (term) { term.clear(); term.reset(); }
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: 2077e047-3749-4175-a64b-3bea8bb5c7dc
📥 Commits
Reviewing files that changed from the base of the PR and between 699af226b3ec6dc31fa9ad36395ec4154615ad20 and 0cb22b6.
📒 Files selected for processing (20)
mobile/app/h/[hostId]/session/[worktreeId].tsxmobile/src/browser/MobileBrowserKeyRow.tsxmobile/src/browser/MobileBrowserPane.tsxmobile/src/browser/MobileBrowserPointerModifiers.tsxmobile/src/terminal/TerminalWebView.tsxmobile/src/terminal/terminal-accessory-keys.test.tsmobile/src/terminal/terminal-accessory-keys.tsmobile/src/terminal/terminal-osc-link-ranges.tsmobile/src/terminal/terminal-webview-html.tsmobile/src/terminal/terminal-webview-messages.tsmobile/src/terminal/terminal-webview-url-tap.tssrc/main/browser/agent-browser-bridge.test.tssrc/main/browser/agent-browser-bridge.tssrc/main/daemon/headless-emulator.test.tssrc/main/daemon/headless-emulator.tssrc/main/daemon/headless-osc-link-ranges.tssrc/main/daemon/types.tssrc/main/runtime/orca-runtime-browser.tssrc/main/runtime/orca-runtime.tssrc/main/runtime/rpc/methods/browser-extras.ts
💤 Files with no reviewable changes (7)
- src/main/daemon/headless-emulator.test.ts
- src/main/daemon/types.ts
- src/main/runtime/orca-runtime-browser.ts
- src/main/daemon/headless-emulator.ts
- src/main/runtime/rpc/methods/browser-extras.ts
- src/main/daemon/headless-osc-link-ranges.ts
- src/main/runtime/orca-runtime.ts
✅ Files skipped from review due to trivial changes (1)
- mobile/src/terminal/terminal-webview-messages.ts
🚧 Files skipped from review as they are similar to previous changes (6)
- mobile/src/terminal/terminal-accessory-keys.test.ts
- mobile/src/browser/MobileBrowserPointerModifiers.tsx
- mobile/src/browser/MobileBrowserKeyRow.tsx
- src/main/browser/agent-browser-bridge.ts
- mobile/src/terminal/terminal-accessory-keys.ts
- mobile/src/terminal/terminal-osc-link-ranges.ts
There was a problem hiding this comment.
Caution
Inline review comments failed to post. This is likely due to GitHub's internal server error or limits when posting large numbers of comments. If you are seeing this consistently it is likely a permissions issue. Please check "Moderation" -> "Code review limits" under your organization settings.
Actionable comments posted: 3
🧹 Nitpick comments (1)
mobile/src/terminal/terminal-webview-html.ts (1)
838-851: 💤 Low valueConsider resetting
initialOscLinkson clear to avoid stale link state.The
clearhandler resets mouse tracking state but leavesinitialOscLinksandinitialOscLinkRowOffsetintact. Whileclear()is typically followed byinit()which resets these, an explicit reset here would be more defensive.💡 Optional fix
} else if (msg.type === 'clear') { terminalGeneration++; resetWriteQueue(); afterDrainCallbacks = []; writesDraining = false; mouseModeScanTail = ''; trackedMouseTrackingMode = 'none'; sgrMouseMode = false; sgrMousePixelsMode = false; + initialOscLinks = []; initialOscLinkRowOffset = 0; if (term) { term.clear(); term.reset(); }
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: 2077e047-3749-4175-a64b-3bea8bb5c7dc
📥 Commits
Reviewing files that changed from the base of the PR and between 699af226b3ec6dc31fa9ad36395ec4154615ad20 and 0cb22b6.
📒 Files selected for processing (20)
mobile/app/h/[hostId]/session/[worktreeId].tsxmobile/src/browser/MobileBrowserKeyRow.tsxmobile/src/browser/MobileBrowserPane.tsxmobile/src/browser/MobileBrowserPointerModifiers.tsxmobile/src/terminal/TerminalWebView.tsxmobile/src/terminal/terminal-accessory-keys.test.tsmobile/src/terminal/terminal-accessory-keys.tsmobile/src/terminal/terminal-osc-link-ranges.tsmobile/src/terminal/terminal-webview-html.tsmobile/src/terminal/terminal-webview-messages.tsmobile/src/terminal/terminal-webview-url-tap.tssrc/main/browser/agent-browser-bridge.test.tssrc/main/browser/agent-browser-bridge.tssrc/main/daemon/headless-emulator.test.tssrc/main/daemon/headless-emulator.tssrc/main/daemon/headless-osc-link-ranges.tssrc/main/daemon/types.tssrc/main/runtime/orca-runtime-browser.tssrc/main/runtime/orca-runtime.tssrc/main/runtime/rpc/methods/browser-extras.ts
💤 Files with no reviewable changes (7)
- src/main/daemon/headless-emulator.test.ts
- src/main/daemon/types.ts
- src/main/runtime/orca-runtime-browser.ts
- src/main/daemon/headless-emulator.ts
- src/main/runtime/rpc/methods/browser-extras.ts
- src/main/daemon/headless-osc-link-ranges.ts
- src/main/runtime/orca-runtime.ts
✅ Files skipped from review due to trivial changes (1)
- mobile/src/terminal/terminal-webview-messages.ts
🚧 Files skipped from review as they are similar to previous changes (6)
- mobile/src/terminal/terminal-accessory-keys.test.ts
- mobile/src/browser/MobileBrowserPointerModifiers.tsx
- mobile/src/browser/MobileBrowserKeyRow.tsx
- src/main/browser/agent-browser-bridge.ts
- mobile/src/terminal/terminal-accessory-keys.ts
- mobile/src/terminal/terminal-osc-link-ranges.ts
🛑 Comments failed to post (3)
mobile/app/h/[hostId]/session/[worktreeId].tsx (2)
2869-2917:
⚠️ Potential issue | 🟠 Major🧩 Analysis chain
🏁 Script executed:
# First, locate and read the file fd -t f "worktreeId\].tsx" --max-one-resultRepository: stablyai/orca
Length of output: 291
🏁 Script executed:
# Get file size to determine how to read it wc -l "mobile/app/h/[hostId]/session/[worktreeId].tsx"Repository: stablyai/orca
Length of output: 109
🏁 Script executed:
# Read the relevant section (lines 2869-2931) sed -n '2869,2931p' "mobile/app/h/[hostId]/session/[worktreeId].tsx"Repository: stablyai/orca
Length of output: 2468
🏁 Script executed:
# Also check where handleCreateBrowser is defined grep -n "const handleCreateBrowser\|function handleCreateBrowser" "mobile/app/h/[hostId]/session/[worktreeId].tsx"Repository: stablyai/orca
Length of output: 143
🏁 Script executed:
# Check if handleCreateBrowser uses any dependencies that change frequently sed -n '3691,3710p' "mobile/app/h/[hostId]/session/[worktreeId].tsx"Repository: stablyai/orca
Length of output: 754
Add
handleCreateBrowserto useCallback dependency arrays in both tap handlers.Lines 2916 and 2930 omit
handleCreateBrowserfrom their dependency arrays. Since this function is defined in component scope and usesclientandcreatingBrowserstate, the memoized callbacks capture stale closures after these state changes, causing silent failures when firing subsequent taps.Additionally, the file URL construction at line 2894 (
'file://' + resolved.absolutePath) assumes forward slashes; on Windows,absolutePathwill contain backslashes, creating invalid file:// URLs. Use a path utility or normalize the path to forward slashes before constructing the URL.💡 Suggested fixes
const handleFileTap = useCallback( @@ - [client, worktreeId, scheduleDelayedAction, fetchSessionTabs] + [client, worktreeId, scheduleDelayedAction, fetchSessionTabs, handleCreateBrowser] ) const handleTerminalOpenUrl = useCallback( @@ - [terminalLinkOpenMode] + [terminalLinkOpenMode, handleCreateBrowser] )For the file URL construction, ensure the path uses forward slashes:
- void handleCreateBrowser('file://' + resolved.absolutePath) + void handleCreateBrowser('file://' + resolved.absolutePath.replaceAll('\\', '/'))📝 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.const handleFileTap = useCallback( (handle: string, pathText: string) => { if (handle !== activeHandleRef.current || !client) { return } void (async () => { try { const worktree = `id:${worktreeId}` const response = await client.sendRequest( 'files.resolveTerminalPath', { worktree, pathText }, { timeoutMs: 10_000 } ) if (!response.ok) { return } const resolved = (response as RpcSuccess).result as RuntimeTerminalPathResolution if (!resolved.exists || resolved.isDirectory || !resolved.relativePath) { return } // Confirm the tap landed on something openable before giving feedback. triggerSelection() // Why: HTML opens in a browser pane (streamed from the desktop), // matching desktop's terminal-click behavior, instead of a file view. if (classifyMobileArtifact(resolved.relativePath) === 'html' && resolved.absolutePath) { void handleCreateBrowser('file://' + resolved.absolutePath) return } const openResponse = await client.sendRequest( 'files.open', { worktree, relativePath: resolved.relativePath }, { timeoutMs: 15_000 } ) if (!openResponse.ok) { return } // Why: the desktop creates the file tab asynchronously; a single poll // can race it, so refresh a few times to reliably pick it up and // switch to it (the file browser gets this for free via router.back). scheduleDelayedAction(() => void fetchSessionTabs(), 300) scheduleDelayedAction(() => void fetchSessionTabs(), 900) scheduleDelayedAction(() => void fetchSessionTabs(), 1800) } catch { // Resolution/open is best-effort; a failed tap silently no-ops. } })() }, [client, worktreeId, scheduleDelayedAction, fetchSessionTabs, handleCreateBrowser] )const handleFileTap = useCallback( (handle: string, pathText: string) => { if (handle !== activeHandleRef.current || !client) { return } void (async () => { try { const worktree = `id:${worktreeId}` const response = await client.sendRequest( 'files.resolveTerminalPath', { worktree, pathText }, { timeoutMs: 10_000 } ) if (!response.ok) { return } const resolved = (response as RpcSuccess).result as RuntimeTerminalPathResolution if (!resolved.exists || resolved.isDirectory || !resolved.relativePath) { return } // Confirm the tap landed on something openable before giving feedback. triggerSelection() // Why: HTML opens in a browser pane (streamed from the desktop), // matching desktop's terminal-click behavior, instead of a file view. if (classifyMobileArtifact(resolved.relativePath) === 'html' && resolved.absolutePath) { void handleCreateBrowser('file://' + resolved.absolutePath.replaceAll('\\', '/')) return } const openResponse = await client.sendRequest( 'files.open', { worktree, relativePath: resolved.relativePath }, { timeoutMs: 15_000 } ) if (!openResponse.ok) { return } // Why: the desktop creates the file tab asynchronously; a single poll // can race it, so refresh a few times to reliably pick it up and // switch to it (the file browser gets this for free via router.back). scheduleDelayedAction(() => void fetchSessionTabs(), 300) scheduleDelayedAction(() => void fetchSessionTabs(), 900) scheduleDelayedAction(() => void fetchSessionTabs(), 1800) } catch { // Resolution/open is best-effort; a failed tap silently no-ops. } })() }, [client, worktreeId, scheduleDelayedAction, fetchSessionTabs] )
2891-2895:
⚠️ Potential issue | 🟠 Major | 🏗️ Heavy liftAvoid string-building
file://URLs from absolute paths.Line 2894 uses
'file://' + resolved.absolutePath, which is not path-safe across hosts (Windows separators/drive letters, escaping). This can break HTML-tab opening from terminal file taps.💡 Suggested direction
- if (classifyMobileArtifact(resolved.relativePath) === 'html' && resolved.absolutePath) { - void handleCreateBrowser('file://' + resolved.absolutePath) + if (classifyMobileArtifact(resolved.relativePath) === 'html' && resolved.absolutePath) { + const normalized = resolved.absolutePath.replace(/\\/g, '/') + const rooted = normalized.startsWith('/') ? normalized : `/${normalized}` + const fileUrl = encodeURI(`file://${rooted}`) + void handleCreateBrowser(fileUrl) return }As per coding guidelines, "Use
path.joinor Electron/Node path utilities for file paths — never assume/or\for cross-platform compatibility."📝 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.// Why: HTML opens in a browser pane (streamed from the desktop), // matching desktop's terminal-click behavior, instead of a file view. if (classifyMobileArtifact(resolved.relativePath) === 'html' && resolved.absolutePath) { const normalized = resolved.absolutePath.replace(/\\/g, '/') const rooted = normalized.startsWith('/') ? normalized : `/${normalized}` const fileUrl = encodeURI(`file://${rooted}`) void handleCreateBrowser(fileUrl) returnSource: Coding guidelines
mobile/src/browser/MobileBrowserPane.tsx (1)
675-676:
⚠️ Potential issue | 🟠 Major | ⚡ Quick winModifier clicks can be dropped when
browser.mouseClickreturnsnull.With the current guard, any active modifier skips fallback entirely, so taps can no-op if the primary click RPC returns
null.Suggested fix
- if (clickResult !== null || pointerModifiers.length > 0) { + if (clickResult !== null) { return }📝 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.if (clickResult !== null) { return
* upstream/main: (78 commits) Show and Filter Automation-Created Workspaces (stablyai#5697) Fix premature project header truncation Send review notes to any running agent of a worktree (stablyai#5654) Fix workspace sidebar appearance setting (stablyai#5725) Highlight the open file in the Source Control sidebar (stablyai#5667) release: v1.4.80-rc.1 Fix premature Codex completion notifications (stablyai#5682) Improve Codex startup prompt reliability (stablyai#5686) Keep hibernated agent completions visible (stablyai#5689) Move Prompt Cache Timer setting to Agents pane, simplify expired state (stablyai#5691) release: v1.4.80-rc.0 Skip GitHub CLI preflight checks if no GitHub projects exist fix: restore font family keyboard navigation in settings Update README downloads badge fix(landing): make GitHub CLI setup nudge dismissible and provider-aware (stablyai#5688) Fix nested workspace card indentation (stablyai#5684) Fix flaky e2e tests (stablyai#5680) Replace plus icon with play button on quick command entry (stablyai#5674) Use managed Pi and OMP extensions (stablyai#5681) Narrow computer-use e2e trigger (stablyai#5685) ... # Conflicts: # mobile/app/h/[hostId]/session/[worktreeId].tsx # mobile/src/terminal/TerminalWebView.tsx # mobile/src/terminal/terminal-webview-html.ts
Co-authored-by: Orca <[email protected]>
Jinwoo-H
left a comment
There was a problem hiding this comment.
Thanks! I reviewed this and added follow-up fixes for the terminal/browser link edge cases:
- preserve OSC link metadata through replay, resize, checkpoint, and cold restore
- keep ordinary HTTP/OSC clicks working without Cmd/Ctrl while preserving macOS Ctrl-click context menus
- pass browser pointer modifiers through CDP without accidental DOM activation
- cover the mobile tap routing, daemon restore, and renderer link fallback cases with regression tests
Validation passed: formatting, lint, root/mobile typechecks, targeted root/mobile vitest suites, and Electron launch smoke validation.
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (3)
mobile/src/terminal/terminal-accessory-keys.ts (1)
1-9:⚠️ Potential issue | 🟠 Major | ⚡ Quick winRestore Cmd modifier support in terminal accessory key types.
TerminalAccessoryKeynow requiresbytes, andTerminalShortcutModifierno longer includes'cmd'. That removes the ability to model a modifier-only Cmd key and prevents Cmd from flowing through normalized shortcut modifiers, which conflicts with the stated macOS Cmd-key behavior for this cohort.Suggested fix
export type TerminalAccessoryKey = { id: string label: string - bytes: string + bytes?: string + modifier?: 'cmd' accessibilityLabel?: string repeatable?: boolean } -export type TerminalShortcutModifier = 'ctrl' | 'alt' | 'shift' +export type TerminalShortcutModifier = 'cmd' | 'ctrl' | 'alt' | 'shift'Also applies to: 379-381
mobile/app/h/[hostId]/session/[worktreeId].tsx (1)
4633-4637:⚠️ Potential issue | 🟠 Major | ⚡ Quick winGuard accessory sends when
bytesis missing.Line 4636 and Line 4648 call
handleAccessoryKey(key.bytes)without validatingbytes. With modifier-style keys now supporting optional bytes in this PR stack, this path can passundefinedintoterminal.sendand silently fail under the current catch block.💡 Suggested patch
onPressIn={() => { - if (!key.repeatable) { + if (!key.repeatable || typeof key.bytes !== 'string' || key.bytes.length === 0) { return } void handleAccessoryKey(key.bytes) startAccessoryRepeat(key.bytes) }} @@ onPress={() => { - if (key.repeatable) { + if (key.repeatable || typeof key.bytes !== 'string' || key.bytes.length === 0) { return } void handleAccessoryKey(key.bytes) }}Also applies to: 4645-4648
src/main/daemon/headless-osc-link-ranges.ts (1)
25-27:⚠️ Potential issue | 🟡 MinorMove restored links processing outside the service check.
The early return at line 26 bypasses the restored links projection logic (lines 55–71), even though that logic doesn't depend on the service and only performs clamping and validation. In the degraded path when the service is unavailable, recovered OSC metadata from
restoredLinksshould still be included in the result.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: e15c5dbc-584d-4a63-8e8a-14b3a242d7fd
📒 Files selected for processing (29)
mobile/app/h/[hostId]/session/[worktreeId].tsxmobile/src/terminal/terminal-accessory-keys.test.tsmobile/src/terminal/terminal-accessory-keys.tsmobile/src/terminal/terminal-webview-html.tsmobile/src/terminal/terminal-webview-tap-routing.test.tsmobile/src/terminal/terminal-webview-url-tap.tssrc/main/browser/agent-browser-bridge.test.tssrc/main/browser/agent-browser-bridge.tssrc/main/daemon/daemon-pty-adapter.test.tssrc/main/daemon/daemon-pty-adapter.tssrc/main/daemon/headless-emulator.test.tssrc/main/daemon/headless-emulator.tssrc/main/daemon/headless-osc-link-ranges.tssrc/main/daemon/history-manager.test.tssrc/main/daemon/history-manager.tssrc/main/daemon/history-reader.test.tssrc/main/daemon/history-reader.tssrc/main/daemon/terminal-history-incremental-restore.test.tssrc/main/daemon/types.tssrc/main/ipc/pty.test.tssrc/main/ipc/pty.tssrc/main/providers/types.tssrc/main/runtime/orca-runtime.tssrc/main/runtime/rpc/methods/terminal.tssrc/main/runtime/rpc/terminal-subscribe-buffer.test.tssrc/renderer/src/components/terminal-pane/terminal-link-handlers.test.tssrc/renderer/src/components/terminal-pane/terminal-link-open-hints.tssrc/renderer/src/components/terminal-pane/terminal-osc-link-routing.tssrc/renderer/src/components/terminal-pane/terminal-url-link-hit-testing.ts
✅ Files skipped from review due to trivial changes (1)
- src/renderer/src/components/terminal-pane/terminal-link-open-hints.ts
🚧 Files skipped from review as they are similar to previous changes (3)
- mobile/src/terminal/terminal-webview-html.ts
- src/renderer/src/components/terminal-pane/terminal-osc-link-routing.ts
- src/main/runtime/orca-runtime.ts
Cold restore seeded a checkpoint's OSC-8 link ranges and then replayed records that resize, so any resize record after the checkpoint dropped them and restored hyperlinks in scrollback lost clickability. Same-size resize records reach the durable log routinely, because every attach re-asserts the pane's dimensions and session-output-plane records each one without a same-size dedupe — so an ordinary reattach was enough to lose the links. Restored ranges are row-indexed, so clearing them on a reflow is right; a resize to the size already applied is not a reflow. Gate on the dimensions actually changing. Introduced in d46349c ("fix: improve mobile link modifier handling", #5597), which added setRestoredOscLinks along with unconditional clearing in both resize() and clearScrollback(). clearScrollback's clearing is correct and is unchanged, with a test pinning it. Found during adversarial review of #17752 and filed as #17756. Not a regression from that PR: #17667 had incidentally masked it by gating no-op resizes to protect a snapshot cache, and removing the cache removed the gate. The same gate returns here on its own terms — as a correctness fix with tests, rather than as a side effect of a cache.
…lyai#17759) Cold restore seeded a checkpoint's OSC-8 link ranges and then replayed records that resize, so any resize record after the checkpoint dropped them and restored hyperlinks in scrollback lost clickability. Same-size resize records reach the durable log routinely, because every attach re-asserts the pane's dimensions and session-output-plane records each one without a same-size dedupe — so an ordinary reattach was enough to lose the links. Restored ranges are row-indexed, so clearing them on a reflow is right; a resize to the size already applied is not a reflow. Gate on the dimensions actually changing. Introduced in 10fe9a0 ("fix: improve mobile link modifier handling", stablyai#5597), which added setRestoredOscLinks along with unconditional clearing in both resize() and clearScrollback(). clearScrollback's clearing is correct and is unchanged, with a test pinning it. Found during adversarial review of stablyai#17752 and filed as stablyai#17756. Not a regression from that PR: stablyai#17667 had incidentally masked it by gating no-op resizes to protect a snapshot cache, and removing the cache removed the gate. The same gate returns here on its own terms — as a correctness fix with tests, rather than as a side effect of a cache.
HUMAN VERIFIED
Summary
Fixes mobile link opening from terminal sessions and browser panes when the desktop host is macOS. The PR adds the missing Cmd modifier path and preserves OSC 8 URL metadata so first-load terminal links are tappable before any scroll repaint.
Changes
Testing