Repository navigation
Conversation
56036a5 to
a07be53
Compare
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (16)
🚧 Files skipped from review as they are similar to previous changes (9)
Included review availability: Your plan provides up to 10 included reviews per hour; 8 remain after this review. 📝 WalkthroughWalkthroughAdds shared parsing for 🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
Full details: Linked Issues checkExplanation The changes satisfy issue Full details: Out of Scope Changes checkExplanation The PR includes unrelated formatting-only changes in preflight-agent-refresh.test.ts, wsl-orca-env.test.ts, wsl-guest-environment.test.ts, use-workspace-cleanup-browse-state.test.tsx, workspace-cleanup-browse.ts, and window-shortcut-policy-agent-dashboard.test.ts. Full details: Description checkExplanation The description is detailed and covers the required sections, linked issue, implementation scope, testing, security, cross-platform impact, and checklist. The required visual proof is not yet attached, and manual testing remains unchecked, but the description identifies both items clearly and provides automated test details. 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: 4
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: 36786141-eb06-496b-b755-0fd836500991
📥 Commits
Reviewing files that changed from the base of the PR and between 668c711 and b12fc61b890f5a59cbaf470eb699b6cb86e14e2d.
📒 Files selected for processing (11)
config/electron-builder.config.cjssrc/main/index.tssrc/main/startup/orca-deep-link-router.test.tssrc/main/startup/orca-deep-link-router.tssrc/preload/api-types.tssrc/preload/index.tssrc/renderer/src/components/terminal-pane/terminal-osc-link-routing.test.tssrc/renderer/src/components/terminal-pane/terminal-osc-link-routing.tssrc/renderer/src/web/web-preload-api.tssrc/shared/orca-deep-link.test.tssrc/shared/orca-deep-link.ts
| deps.focusWindow() | ||
| void Promise.resolve(deps.focusTerminalByHandle(link.handle)).catch((error) => { | ||
| deps.onError?.(error, url) |
There was a problem hiding this comment.
Prevent focus-steal by focusing the window only after terminal resolution succeeds.
At Lines 58-60, the window is focused before focusTerminalByHandle succeeds. A syntactically valid but non-existent handle still brings Orca to foreground, which conflicts with the “ignore unknown/malicious links” intent.
🔧 Proposed fix
- deps.focusWindow()
- void Promise.resolve(deps.focusTerminalByHandle(link.handle)).catch((error) => {
- deps.onError?.(error, url)
- })
+ void Promise.resolve()
+ .then(() => deps.focusTerminalByHandle(link.handle))
+ .then(() => {
+ deps.focusWindow()
+ })
+ .catch((error) => {
+ deps.onError?.(error, url)
+ })| @@ -2001,6 +2001,7 @@ function createWebUiApi(): NonNullable<Partial<PreloadApi>['ui']> { | |||
| onSplitTerminal: () => noopUnsubscribe, | |||
| onRenameTerminal: () => noopUnsubscribe, | |||
| onFocusTerminal: () => noopUnsubscribe, | |||
| openOrcaDeepLink: () => {}, | |||
There was a problem hiding this comment.
Document why openOrcaDeepLink is a no-op in web fallback.
Line 2004 adds a non-obvious no-op behavior without rationale. Add a short why-comment so this doesn’t get “fixed” accidentally later.
Suggested patch
- openOrcaDeepLink: () => {},
+ // Why: web clients do not have an Electron main-process deep-link router;
+ // keep this as a no-op to preserve preload API parity.
+ openOrcaDeepLink: () => {},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. Keep comments short — one or two lines, capturing only the non-obvious reason".
📝 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.
| openOrcaDeepLink: () => {}, | |
| // Why: web clients do not have an Electron main-process deep-link router; | |
| // keep this as a no-op to preserve preload API parity. | |
| openOrcaDeepLink: () => {}, |
Source: Coding guidelines
|
Rebased onto latest main and moved out of draft. Conflicts resolved, and validated locally on a clean install: |
|
This is neat, thanks for putting it together. I think I understand the routing piece now: once an One thing I’m still trying to connect is the adoption path for agents. Since the motivating use case depends on agents emitting OSC 8 hyperlinks, how are you imagining agents will learn to produce those links in practice? Would that be through prompt instructions, a small CLI helper, orchestration output, or something else? |
|
@Jinwoo-H good question, and it's deliberately the part this PR doesn't hardcode. The PR only builds the routing (scheme registration + the focus action) and stays agnostic about who emits the link, because emission itself is already trivial: any How I imagine adoption, smallest-first:
I'd start with (1) since it needs no agent cooperation at all, and add the docs from (2). |
|
@Jinwoo-H when you get a chance: this one (#4386) is green and mergeable again after a rebase on latest main, and it now closes #4384, which picked up an external +1 today ("very much needed"). Your earlier question about the agent adoption path is answered in the thread above. Two other PRs you're the requested reviewer on are also green and ready whenever it suits: #4475 (keep the agent-hook payload off the curl command line) and #3337 (close the hidden background tab/PTY when an automation completes, your earlier UX question is addressed there too). No pressure on any of them, and I'm happy to trim scope or make changes. If any aren't on the roadmap, just say and I'll close them out. |
|
looking into it |
|
thanks for reporting. looking into it |
An `orca://focus/<terminal-handle>` link focuses that terminal tab, both from an OSC 8 click inside the embedded terminal and from anywhere on the OS. The handle is the runtime-issued id from `orca terminal list --json`. Ports stablyai#4386 onto current main. The original branch predated main's own orca:// plumbing, so this integrates with it rather than duplicating it: - Focus intents ride the existing SkillShareDeepLinkState pattern via a sibling OrcaFocusDeepLinkState, captured in requestDesktopActivation so second-instance argv and macOS activation both work. - open-url now claims focus links too, and only calls preventDefault when one of the two parsers matches. - No new second-instance listener: single-instance-lock owns the only one. - No runtime setAsDefaultProtocolClient: main registers the scheme via electron-builder `protocols`. Focus reuses runtime.focusTerminal, the canonical action behind `orca terminal focus` and notification clicks. Only a valid parsed link focuses anything, so a hostile terminal cannot steal focus with garbage orca:// strings. No notifications are involved.
69d8aaa to
610eaa8
Compare
|
Note GitHub couldn't provide a complete incremental comparison for this pull request, so CodeRabbit is performing a full review instead. This review may take a little longer. |
There was a problem hiding this comment.
Actionable comments posted: 2
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID: b88e0dc1-35ed-4e82-8890-97f74715ac15
📒 Files selected for processing (10)
src/main/index.tssrc/main/startup/orca-focus-deep-link-state.test.tssrc/main/startup/orca-focus-deep-link-state.tssrc/preload/api/ui-command-event-api.tssrc/preload/index.tssrc/renderer/src/components/terminal-pane/terminal-osc-link-routing.test.tssrc/renderer/src/components/terminal-pane/terminal-osc-link-routing.tssrc/renderer/src/web/web-preload-api.tssrc/shared/orca-deep-link.test.tssrc/shared/orca-deep-link.ts
🚧 Files skipped from review as they are similar to previous changes (3)
- src/preload/index.ts
- src/renderer/src/web/web-preload-api.ts
- src/renderer/src/components/terminal-pane/terminal-osc-link-routing.ts
Included review availability: Your plan includes up to 10 reviews per rolling hour; 9 remain after this review.
| const deps = { worktreeId: 'wt1', worktreePath: '/repo', startupCwd: '/repo' } | ||
| // metaKey+ctrlKey both set so direct activation passes on Mac and non-Mac runners. | ||
| const activation = { metaKey: true, ctrlKey: true } |
There was a problem hiding this comment.
📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win
Use the platform-specific activation modifier.
activation sets both modifiers. This test cannot detect a regression that accepts Ctrl on macOS or Meta on Linux and Windows. Set only metaKey on Mac and only ctrlKey elsewhere. Add a rejection case for the opposite modifier.
Proposed test change
-// metaKey+ctrlKey both set so direct activation passes on Mac and non-Mac runners.
-const activation = { metaKey: true, ctrlKey: true }
+const isMac = navigator.userAgent.includes('Mac')
+const activation = isMac ? { metaKey: true, ctrlKey: false } : { metaKey: false, ctrlKey: true }
+const wrongPlatformActivation = isMac
+ ? { metaKey: false, ctrlKey: true }
+ : { metaKey: true, ctrlKey: false }As per coding guidelines: “For keyboard shortcuts, do not hardcode e.metaKey; select metaKey on Mac and ctrlKey on Linux and Windows using a platform check such as navigator.userAgent.includes('Mac').”
Source: Coding guidelines
|
|
||
| // Runtime-issued handles are `term_<uuid>`; anything else is rejected so a malformed or | ||
| // hostile link can never reach the focus action. | ||
| const TERMINAL_HANDLE_PATTERN = /^[A-Za-z0-9_-]+$/ |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
Reject handles without the term_ prefix.
Line 14 accepts orca://focus/arbitrary_handle. The startup state queues this value, and the main process sends it to the terminal focus path. This conflicts with the documented term_... handle contract. Require the prefix and add a rejection test.
Proposed fix
-const TERMINAL_HANDLE_PATTERN = /^[A-Za-z0-9_-]+$/
+const TERMINAL_HANDLE_PATTERN = /^term_[A-Za-z0-9_-]+$/📝 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 TERMINAL_HANDLE_PATTERN = /^[A-Za-z0-9_-]+$/ | |
| const TERMINAL_HANDLE_PATTERN = /^term_[A-Za-z0-9_-]+$/ |
|
Note GitHub couldn't provide a complete incremental comparison for this pull request, so CodeRabbit is performing a full review instead. This review may take a little longer. |
# Conflicts: # src/renderer/src/components/settings/CliSkillRuntimeSetup.test.tsx # src/renderer/src/components/settings/CliSkillRuntimeSetup.tsx # src/renderer/src/web/web-preload-api.ts
|
Note GitHub couldn't provide a complete incremental comparison for this pull request, so CodeRabbit is performing a full review instead. This review may take a little longer. |
ELI5
Clickable
orca://focus/<terminal-handle>links (inside the terminal or OS-wide) jump you to a specific terminal tab by its handle. No notifications involved.What Changed
Adds clickable
orca://focus/<terminal-handle>deep-links that focus a specific Orca terminal tab, both inside the embedded terminal (OSC 8 hyperlink click) and from anywhere on the OS.<terminal-handle>is the runtime-issued handle fromorca terminal list --json(e.g.term_<uuid>).Focusing reuses the existing canonical action
runtime.focusTerminal(handle)(the same call behindorca terminal focus/switchand the notification-click handler), so there is no new focus logic. Routing rides the existingorca://skill-share plumbing rather than a parallel router:linkHandler(alreadyallowNonHttpProtocols: true) →handleOscLink→window.api.ui.openOrcaDeepLink→ipcMainapp.on('open-url'), which now claims focus links as well as skill-share linkssecond-instanceargv, via the existingsingle-instance-lockcallback intorequestDesktopActivationprocess.argv, held until the window and runtime are readyOrcaFocusDeepLinkState(src/main/startup/orca-focus-deep-link-state.ts) holds the pending intent and mirrors the existingSkillShareDeepLinkState. Parsing is a pure shared module (src/shared/orca-deep-link.ts) so main and renderer classify links identically.Why
Agents and users need a way to hand someone a link that jumps straight to a specific terminal tab (e.g. "the tab where your build failed") without a notification and without inventing a new URL router. In Orca every agent runs inside the xterm terminal — there is no separate React markdown chat surface — so the delivery vehicle is an OSC 8 hyperlink, exactly how
[label](orca://focus/term_...)renders into a terminal. Reusingruntime.focusTerminaland the existing skill-share deep-link plumbing keeps the surface area minimal and the behavior consistent withorca terminal focusand notification clicks.Linked Issue
Fixes #4384
Visual Proof
Behavior change (a modifier-click on an
orca://focus/...link, or an OS-level open, focuses the target tab); there is no new rendered UI component. A short screen recording of an in-terminal link click focusing another tab is the right proof here — @BorjaLL to attach before merge. Manual repro steps are under Testing.Testing
Automated:
src/shared/orca-deep-link.test.ts: parse + argv extraction (rejects non-focusorca://, malformed handles).src/main/startup/orca-focus-deep-link-state.test.ts: capture/consume, most-recent-wins, ignores non-focusorca://URLs, deferred cold-launch replay.src/renderer/.../terminal-osc-link-routing.test.ts:orca:branch forwards to the bridge, non-modifier click ignored, http still routes to the browser.pnpm lint,pnpm typecheck, and the affected suites pass locally.Manual repro (macOS): emit an OSC 8 link
orca://focus/<handle>into a terminal (handle fromorca terminal list --json), modifier-click it, confirm the target tab is focused; thenopen "orca://focus/<handle>"from another app and confirm the running window focuses that tab. Windows/Linux argv paths reviewed but not hardware-tested — please note platforms verified.AI Disclosure
The deep-link feature was authored by @BorjaLL. Claude Code (Anthropic; Claude Opus) assisted with merging the branch up to current main, resolving conflicts, and validation (typecheck/tests).
Review
Agent skill upstream boundary
docs/reference/agent-skill-sharing-upstream-boundary.mdand copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.Notes
orca://strings. Handles are validated againstTERMINAL_HANDLE_PATTERN. AfocusTerminalrejection (e.g. a terminal that already exited) is caught and warned.open-url), Windows/Linux running (second-instance) and cold (process.argv). No newsecond-instancelistener —single-instance-lock.tsowns the only one and its test asserts exactly one is registered.setAsDefaultProtocolClient; theorcascheme is already registered statically via electron-builder'sprotocolsentry (same as skill-share). A dev launch viaelectron .therefore gets the IPC and argv paths but not OS-level routing.orca://worktree/<id>is deferred — worktree ids arerepoId::worktreePathand need an encoding scheme this format does not define.orca:branch requires a direct modifier activation (http links use the same gate to show a click-for-actions popover; deep links have no popover).Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)Author