Skip to content

feat(cua-driver): public observe_window_changes opt-out for the post-action window poll - #2691

Closed
milind-soni wants to merge 1 commit into
trycua:mainfrom
milind-soni:feat/driver-observe-window-changes
Closed

feat(cua-driver): public observe_window_changes opt-out for the post-action window poll#2691
milind-soni wants to merge 1 commit into
trycua:mainfrom
milind-soni:feat/driver-observe-window-changes

Conversation

@milind-soni

Copy link
Copy Markdown

Behavior

Every input tool (click, drag, press_key, type_text, hotkey, scroll) runs a post-action window-change poll (WindowChangeDetector::detect) that early-exits only when a change appears — a quiet action always pays the full DEFAULT_TIMEOUT (1s). For agent loops that's useful observation; for deterministic callers (macro replay, test harnesses) that already know what the next action expects, it's pure latency on every action.

This adds a public, additive, backwards-compatible opt-out: pass observe_window_changes: false on any of those tools to skip the poll (the result then omits new-window/foreground-change notes). Omitted or true keeps today's behavior exactly. It is deliberately distinct from the transport-reserved _skip_window_change_detection, which sanitize_reserved_args strips from public callers.

Validation

  • New unit test public_observe_window_changes_false_skips_polling (asserts the no-poll fast path, with a timing bound) alongside the existing internal-flag test; cargo test -p platform-macos --locked: 242 passed, 0 failed.
  • cargo fmt -p platform-macos clean.
  • Measured downstream (axstream, a macro-replay client, on a real Mac): a 5-op macro replay went from 3.4s to 1.50s p50; a single press_key from ~1017ms to ~12ms.

Known gaps

  • macOS only: the schema property + logic are added where the poll exists today (platform-macos). Windows/Linux parity can follow if the same observation lands there.
  • The flag is per-call by design (mirrors scope); no config/global variant included to keep the diff focused.

🤖 Generated with Claude Code

milind-soni added a commit to milind-soni/axstream that referenced this pull request Jul 30, 2026
Socket order: AXSTREAM_DRIVER_SOCK env -> axstream-driver.sock (a locally
patched daemon running the observe_window_changes fast path ahead of the
upstream release, trycua/cua#2691) -> the standard daemon socket. No
configuration needed on machines running the patched driver via launchd.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
milind-soni added a commit to milind-soni/axstream that referenced this pull request Aug 8, 2026
…h opt-in only

Auto-discovering axstream-driver.sock by filename silently routed to a
custom-built binary whose TCC grant broke on every rebuild (new signature =
empty grant = permission popup, repeatedly). Default to the socket the user
granted; the observe_window_changes fast path stays available via
AXSTREAM_DRIVER_SOCK when someone runs a patched daemon on purpose. The
speedup returns for everyone with no popups once trycua/cua#2691 merges.
@injaneity

Copy link
Copy Markdown
Collaborator

closing as superseded by #3373

@injaneity injaneity closed this Aug 27, 2026
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.

2 participants