Skip to content

macOS: align background computer use with the signed Codex helper - #5

Open
cm2435-hcomp wants to merge 2 commits into
agent/background-driver-v2-focus-semanticsfrom
agent/sky-contract-parity
Open

macOS: align background computer use with the signed Codex helper#5
cm2435-hcomp wants to merge 2 commits into
agent/background-driver-v2-focus-semanticsfrom
agent/sky-contract-parity

Conversation

@cm2435-hcomp

@cm2435-hcomp cm2435-hcomp commented Jul 31, 2026

Copy link
Copy Markdown
Owner

Summary

Ports the recoverable native posture from the installed signed Codex macOS
helper into the Rust v2 driver, while keeping the existing typed controller
and evidence model.

We inspected the signed SkyComputerUseService binary and recovered concrete
mechanisms including per-application synthetic focus enforcement, CPS
keyFocusReturned, PID-targeted window-stamped CoreGraphics events, live AX
actions, ScreenCaptureKit window capture, menu lifecycle handling, and
element-sized page scrolling. Static inspection was used to form hypotheses;
real-host differentials decided behavior.

What changed

  • make synthetic focus belief process-scoped so it survives Finder replacement
    windows
  • port the CPS process-notification focus recipe and retain exact focus
    evidence
  • support targeted keyboard/text, drag, multi-button/multi-click, and page
    scroll without hardware cursor movement
  • derive page-scroll magnitude from current target element dimensions,
    matching the signed helper
  • prefer exact live AX actions, writable AXSelected ancestors, and AXOpen
    where exposed
  • retain related same-process ScreenCaptureKit surfaces and rehydrate current
    windows from live facts
  • own native menu attribution/dismissal and post-action settlement inside the
    controller
  • remove the obsolete CDP-specific page-scroll branch now subsumed by the
    signed-compatible targeted route

Why

The previous implementation made support decisions from framework labels and
per-window focus leases. That diverged from the signed helper and failed when
productive actions replaced the working window, especially in Finder. The
signed posture is app-controller state plus current window facts, with
special-framework behavior kept behind concrete native recipes.

Real-host validation

The paired Python facade/QA branch drove five real apps for five consecutive
valid repetitions each: 25 repetitions and 245 actions. Calculator, TextEdit,
Spotify, Chromium, and Finder all completed without the target becoming
frontmost, without an unallowed target becoming topmost, and without a
hardware-cursor warp attempt.

Finder's safe item drag had no filesystem effect in either implementation.
This PR records that as signed-behavior parity, not productive Finder drag
support.

Automated checks

  • cargo test -p cua-driver-core -p platform-macos: 122 core unit tests, 27
    API contracts, 3 lifecycle tests, and 201 macOS tests passed
  • cargo build -p cua-driver: passed
  • strict Clippy passed for the changed core, macOS, and binary targets after
    isolating known pre-existing repository lint classes
  • repository-wide cargo fmt --all --check remains blocked by a large
    pre-existing formatting baseline outside this diff

Known gaps

Controlled same-target userIntervened, numeric wrapper extremes,
minimized/off-Space targets, productive Finder item drag, Finder Command+Up,
and Windows/X11/Wayland providers remain unconfirmed.

Paired Python facade and live-matrix PR:
hcompai/cua-drivers#17.

@github-actions

Copy link
Copy Markdown

Linux visual regression artifacts

Matrix jobs now run independently. Download visual artifacts from this workflow run.
Each background-GUI job uploads a .gif of the interaction plus two annotated PNGs (<app>.png raw, <app>-atspi.png with AT-SPI element boxes); the cua-driver-linux-som-overlays artifact adds <app>-som.png cua Set-of-Marks overlays:

  • cua-driver-linux-cursor-click-gif
  • cua-driver-linux-background-terminal-gif
  • cua-driver-linux-parallel-drag-xserver
  • cua-driver-linux-background-gui-chromium
  • cua-driver-linux-background-gui-tk
  • cua-driver-linux-background-gui-gtk3-gedit
  • cua-driver-linux-background-gui-gtk3-mousepad
  • cua-driver-linux-background-gui-gtk3-scite
  • cua-driver-linux-background-gui-gtk4-characters
  • cua-driver-linux-background-gui-qt5-manuskript
  • cua-driver-linux-background-gui-qt5-klog
  • cua-driver-linux-background-gui-qt5-openambit
  • cua-driver-linux-background-gui-qt6-kate
  • cua-driver-linux-background-gui-qt6-kcalc
  • cua-driver-linux-background-gui-qt6-okular
  • cua-driver-linux-background-gui-qt6-qownnotes
  • cua-driver-linux-background-gui-electron-zettlr
  • cua-driver-linux-background-gui-electron-joplin
  • cua-driver-linux-background-gui-electron-logseq
  • cua-driver-linux-som-overlays

Open workflow run and download artifacts

@cm2435-hcomp
cm2435-hcomp marked this pull request as ready for review July 31, 2026 08:39
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