Skip to content

feat(computer-use): show a separate agent pointer on macOS - #9128

Open
dbachko wants to merge 3 commits into
stablyai:mainfrom
dbachko:dbachko/computer-use-cursor-visibility
Open

dbachko wants to merge 3 commits into
stablyai:mainfrom
dbachko:dbachko/computer-use-cursor-visibility

Conversation

@dbachko

@dbachko dbachko commented Jul 17, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #9126

Summary

When Orca performs macOS Computer Use actions through Accessibility APIs or process-targeted Core Graphics events, the action succeeds without moving the native pointer, so the person watching cannot see what the agent is doing.

  • Add an Orca-owned, click-through pointer overlay for click, secondary action, scroll, and drag operations
  • Animate movement to the target, show a brief system-accent action/pressed state, support full-screen spaces and multi-display Quartz coordinates, and hide after 1.2 seconds of inactivity
  • Keep the human's native macOS pointer untouched and preserve process-targeted input delivery to the selected application
  • Keep the overlay outside Orca model screenshots by limiting both capture engines to the selected target window, without relying on legacy NSWindow sharing flags
  • Authorize the exact shared dev launcher bundle id (com.stablyai.orca.dev) in addition to the existing per-worktree dev prefix, enabling live validation through the packaged helper

Screenshots

Orca model screenshots intentionally omit this UI: both ScreenCaptureKit and the existing Core Graphics fallback capture only the selected target window, while the pointer is a separate helper-owned panel. This is a guarantee of Orca’s capture pipeline, not a claim that other screenshot or recording software cannot capture the overlay.

Manual visual validation was performed in the macOS dev build against Calculator. The agent cursor visibly moved through clicks on 7, 3, and All Clear while the Calculator display changed 0 → 7 → 73 → 0; the native macOS pointer did not move.

Testing

  • pnpm lint — branch Swift files are outside the TypeScript lint paths; the current-main run stops on 2 untouched switch-exhaustiveness errors in native-chat-session-option-labels.ts and skill-freshness-group.tsx
  • pnpm typecheck
  • pnpm test — 31,123 passed and 46 skipped; 23 unrelated local failures in untouched suites: 2 relay environment assertions caused by duplicated inherited Git config variables, 5 PTY shell-ready expectations, and 16 resource-sensitive relay/Git/SSH/OMP/node-pty timeouts or fd assertions while the dev app was running
  • pnpm build — desktop, web, universal macOS Computer Use helper, and notification helper
  • Added regression tests for pointer interpolation and Reduce Motion, Quartz-to-AppKit multi-display geometry, authenticated helper ownership, capture/input safety, and the shared dev launcher bundle id
  • pnpm verify:computer-native — 52 macOS Swift tests pass; Linux provider syntax/argument guardrails pass; app bundle/signature verification passes. Windows PowerShell parse/handshake checks were skipped locally because pwsh is not installed
  • Manual macOS dev validation against Calculator, including accessibility click actions and confirmation that the native pointer remains stationary

AI Review Report

Reviewed the complete diff with Codex against the repository checklist:

  • Cross-platform (macOS/Linux/Windows): the implementation is isolated to the macOS native Computer Use Swift package. No renderer shortcuts, shortcut labels, paths, shell behavior, or Electron platform branches changed. Linux and Windows providers are unchanged; Linux native guardrails pass locally, while Windows native checks remain for CI because PowerShell is unavailable on this Mac.
  • SSH/remote/local: the overlay represents actions performed by the local macOS helper and adds no repository, filesystem, credential, or network assumptions. SSH and remote worktrees continue to use the same provider routing; no remote host behavior changes.
  • Agents/integrations/providers: all agents using Orca's macOS Computer Use provider receive the same visible pointer behavior. No Codex-specific, integration-specific, GitHub-specific, or git-provider-specific path was added.
  • Performance and accessibility: one panel/view is created lazily and reused. Movement uses at most 12 bounded interpolation steps; Reduce Motion jumps directly to the destination. Hide and pulse work is cancelable and coalesced, with no persistent timer or hot-path polling.
  • UI quality: the cursor uses a high-contrast monochrome arrow and reserves the system accent color for transient action state, matching the style guide. The panel is non-activating, click-through, transparent, present across spaces/full-screen, and positioned with tested global-coordinate conversion.
  • Flagged and resolved during review: native cursor warping was rejected because the agent needs a distinct pointer; input remains scoped with postToPid. The dev bundle authorization assertion was moved into the existing agent-entrypoint safety suite instead of being mixed into pointer behavior tests.

Security Audit

  • The overlay is a borderless non-activating panel with ignoresMouseEvents = true; its panel cannot become key or main and its view is excluded from the accessibility hierarchy.
  • Model screenshots use an explicit selected-window capture scope. The helper-owned overlay is structurally outside both capture paths, and verification rejects reintroduction of legacy sharingType = .none.
  • Mouse, scroll, Unicode, modifier, and key events are process-targeted through postToPid(pid); verification rejects global event-tap posting and CGWarpMouseCursorPosition.
  • The exact com.stablyai.orca.dev bundle id is added to the existing trusted dev-id set because the shared launcher uses that value; the existing peer command/path validation remains unchanged.
  • An authorized, token-valid handshake claims helper ownership; closing that sidecar connection terminates the helper and releases the overlay. No new IPC methods, command execution, paths, secrets, dependencies, or persistent data were introduced.

Notes

  • This is intentionally macOS-specific. Linux and Windows Computer Use behavior is unchanged.
  • The overlay is local UI even when the active Orca worktree is remote/SSH; it does not depend on remote display state.
  • The existing CGWindowListCreateImage macOS 14 deprecation warning remains unchanged and is unrelated to this PR.

X (Twitter): @dbachko

Generated with Codex

ELI5

When Orca’s agent clicks or drags on the Mac without moving your real mouse, you couldn’t see what it was doing. This adds a separate on-screen pointer overlay that shows agent actions so you can follow along.

@dbachko
dbachko marked this pull request as ready for review July 17, 2026 03:25
@coderabbitai

coderabbitai Bot commented Jul 17, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

Adds a macOS agent pointer overlay with motion planning, coordinate conversion, pressed and pulse rendering, and lifecycle cleanup. Integrates pointer feedback into clicks, secondary actions, scrolling, dragging, and synthetic event delivery while refactoring model image capture. Adds synchronized socket shutdown and connection ownership handling, stable development bundle authorization, guarded accessory activation, and expanded native source-safety tests and guardrails.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed The changes satisfy #9126 by adding a separate click-through pointer overlay with animation, pressed state, multi-display support, idle hide, and screenshot exclusion.
Out of Scope Changes check ✅ Passed No clear out-of-scope changes were introduced; the added auth, capture, ownership, and test updates support the macOS pointer-overlay feature.
Title check ✅ Passed The title clearly summarizes the main change: adding a separate macOS agent pointer overlay.
Description check ✅ Passed The description follows the template and includes summary, screenshots, testing, AI review, security audit, and notes.

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.

@AmethystLiang

Copy link
Copy Markdown
Contributor

thanks for the PR will review it!

@AmethystLiang
AmethystLiang requested a review from Jinwoo-H July 17, 2026 03:41

@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: 2

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (2)
native/computer-use-macos/Sources/OrcaComputerUseMacOS/main.swift (2)

2381-2382: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Honor Reduce Motion for the drag path.

The unconditional ten-point path still performs intermediate synchronous UI updates; followAction only removes its sleep. Use a single destination point when Reduce Motion is enabled, or route dragging through PointerMotionPolicy.


3626-3652: 🩺 Stability & Availability | 🟠 Major | 🏗️ Heavy lift

Terminate only when the disconnecting connection is still the owner.

Every authenticated handshake receives an independent ownsHelperLifetime flag. A stale owner’s deferred termination can therefore kill the helper after a replacement connection has already completed its handshake. Track owner identity or generation at listener scope and compare it before terminating.

🧹 Nitpick comments (1)
native/computer-use-macos/Tests/OrcaComputerUseMacOSTests/PointerOverlaySourceSafetyTests.swift (1)

26-36: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Deduplicate source loading logic.

The executableSource method duplicates the path resolution logic found in AgentEntrypointSourceSafetyTests.mainSource(). Consider extracting this into a shared test helper (for instance, an extension on XCTestCase) to eliminate duplication and simplify future test additions.


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 14654f6d-aaad-4ea2-882c-81243a7fdabd

📥 Commits

Reviewing files that changed from the base of the PR and between 10e998c and 23a38b5.

📒 Files selected for processing (8)
  • config/scripts/verify-computer-native.mjs
  • native/computer-use-macos/Sources/OrcaComputerUseMacOS/AgentPointerOverlay.swift
  • native/computer-use-macos/Sources/OrcaComputerUseMacOS/main.swift
  • native/computer-use-macos/Sources/OrcaComputerUseMacOSCore/AgentConnectionOwnership.swift
  • native/computer-use-macos/Sources/OrcaComputerUseMacOSCore/PointerMotionPolicy.swift
  • native/computer-use-macos/Tests/OrcaComputerUseMacOSTests/AgentConnectionOwnershipTests.swift
  • native/computer-use-macos/Tests/OrcaComputerUseMacOSTests/PointerMotionPolicyTests.swift
  • native/computer-use-macos/Tests/OrcaComputerUseMacOSTests/PointerOverlaySourceSafetyTests.swift

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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
native/computer-use-macos/Sources/OrcaComputerUseMacOS/main.swift (1)

2377-2396: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Reset the pressed overlay state when drag event delivery throws.

After Line 2379, any throwing mouse call bypasses PointerVisibility.release, leaving subsequent overlay rendering pressed. Add a defer cleanup with a non-pulsing cancellation/reset path; retain release(at:) only for successful completion.

🧹 Nitpick comments (1)
native/computer-use-macos/Tests/OrcaComputerUseMacOSTests/AgentEntrypointSourceSafetyTests.swift (1)

5-18: 🔒 Security & Privacy | 🔵 Trivial | 🏗️ Heavy lift

Replace raw substring checks with syntax-aware or behavioral validation. Both test files can accept comments/string literals as evidence and may miss equivalent source forms, weakening the intended security regression coverage.

  • native/computer-use-macos/Tests/OrcaComputerUseMacOSTests/AgentEntrypointSourceSafetyTests.swift#L5-L18: validate authorization and caller-path cleanup through parsed source or behavior-level tests.
  • native/computer-use-macos/Tests/OrcaComputerUseMacOSTests/PointerOverlaySourceSafetyTests.swift#L5-L23: validate overlay isolation, target-scoped capture, and PID-targeted delivery without relying solely on exact substrings.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 47cf2cf1-a216-4708-aeaf-255ae5ffb709

📥 Commits

Reviewing files that changed from the base of the PR and between 23a38b5 and ea26d0a.

📒 Files selected for processing (10)
  • config/scripts/verify-computer-native.mjs
  • native/computer-use-macos/Sources/OrcaComputerUseMacOS/AgentPointerOverlay.swift
  • native/computer-use-macos/Sources/OrcaComputerUseMacOS/main.swift
  • native/computer-use-macos/Sources/OrcaComputerUseMacOSCore/AgentConnectionOwnership.swift
  • native/computer-use-macos/Sources/OrcaComputerUseMacOSCore/PointerMotionPolicy.swift
  • native/computer-use-macos/Tests/OrcaComputerUseMacOSTests/AgentConnectionOwnershipTests.swift
  • native/computer-use-macos/Tests/OrcaComputerUseMacOSTests/AgentEntrypointSourceSafetyTests.swift
  • native/computer-use-macos/Tests/OrcaComputerUseMacOSTests/ExecutableSourceFixture.swift
  • native/computer-use-macos/Tests/OrcaComputerUseMacOSTests/PointerMotionPolicyTests.swift
  • native/computer-use-macos/Tests/OrcaComputerUseMacOSTests/PointerOverlaySourceSafetyTests.swift
🚧 Files skipped from review as they are similar to previous changes (2)
  • native/computer-use-macos/Sources/OrcaComputerUseMacOS/AgentPointerOverlay.swift
  • config/scripts/verify-computer-native.mjs

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature]: Show a separate agent cursor during macOS Computer Use actions

5 participants