Skip to content

fix(computer-use): resolve macOS AX/drag/paste/capture bugs and chat UI flicker - #7510

Merged
M4n5ter merged 2 commits into
mainfrom
fix/window-element-click-slot
Dec 2, 2026
Merged

M4n5ter merged 2 commits into
mainfrom
fix/window-element-click-slot

Conversation

@M4n5ter

@M4n5ter M4n5ter commented Dec 2, 2026 •

Copy link
Copy Markdown
Member

Summary

Fixes macOS Computer Use AX, screenshot/capture, drag/paste UX, and chat UI flicker issues found during live end-to-end testing:

macOS AX & Capture (maka-agent/cua 65fb74db + platform/computer-use)

  • Single-window click slot & menu projection: Slot::Window clicks no longer route through Intent::Menu projection; AXMenuBarItem window clicks prefer AXPress over AXPick.
  • Tall-view indexed scroll(index): clickable_point now computes the visible intersection center (CGRectIntersection(frame, clipped)) when the full element center lies outside its clipped viewport (fixing silent no-op scrolls on tall AXTextArea documents), while preserving center_is_visible for reveal logic.
  • Attached child window capture & bringToFront (upstream cua 65fb74db):
    • ScreenCaptureKit single-window capture now uses SCContentFilter(display:including:[window]) + display-relative sourceRect when contained within a display, preventing protruding attached child windows (e.g. macOS Writing Tools or Color Popover) from shrinking/offsetting screenshot coordinates while still capturing occluded windows cleanly.
    • bringToFront ignores untitled non-AXStandardWindow attached child windows overlapping/near the focused target window instead of falsely reporting focus stolen.
  • Fast background drag (upstream cua 65fb74db): Reduced drag_at_xy_background drag-session polling overhead (4ms → 25ms + sleep-before-poll), cutting ~1.25s of redundant CGWindowListCopyWindowInfo IPC per drag.
  • Foreground app.drag(from, to, options?): Added DragOptions (deliveryMode, button, modifier, durationMs, steps) so window-manager drags (moving titlebars, resizing edges, cross-window drags) work explicitly via deliveryMode: "foreground" and allow finite out-of-window to coordinates.
  • Background-first macOS paste: Plain-text paste tries background AXSelectedText replacement first (no focus steal, no clipboard touch); clipboard paste tries background Cmd+V to the bound window before falling back to temporary foreground activation.
  • Observation & coordinate ergonomics:
    • Pure getScreenshot() preserves retained macOS AX elements (so getAXState() -> getScreenshot() -> click(index) no longer throws stale_element).
    • macOS screenshot coordinate mappings survive consecutive input actions while window geometry/scale is unchanged.
    • getScreenshot() / getAXStateAndScreenshot() print Screenshot: WxH px pixel dimensions alongside the emitted image.
    • Updated all 12 platform/computer-use/locales/docs/api.*.md files and regenerated third-party notices.

Chat UI Flicker on cua_repl

  • plugins/agent/state/src/computer/sql.rs: Keep an already-authorized agent_computer_activities row pinned across subsequent SubjectObserved facts (and promote on AppAuthorized when not yet authorized), eliminating the ComputerApps empty-list flash that unmounted/remounted the 36px ComposerDetails shelf and bounced the chat list on every cua_repl call.
  • platform/computer-use/src/preview.rs & plugins/workspace/workspace-computer/native/src/evaluate.rs: Skip redundant PreviewRegistry revision bumps when re-registering the already-active identical target, and only notify preview_changed when preview authority scope actually changes.
  • plugins/agent/conversations/ui/SessionSurface.tsx: Guard computerViewport.set with width/height equality so parent relayout does not fire spurious signal writes.

Verification

  • cargo test -p maka-computer-use --features native-desktop --lib (166 passed, 0 failed)
  • cargo test -p maka-agent-state --lib (108 passed, 0 failed, including new authorized_activity_stays_pinned_across_subsequent_subject_observed)
  • cargo test -p maka-computer-native --lib (5 passed, 0 failed)
  • cargo clippy clean on maka-computer-use, maka-computer-native, maka-agent-state
  • tsc -p products/maka/bundle/tsconfig.json --noEmit passed
  • biome check, cargo fmt --check, node scripts/ci.mjs check migrations, node scripts/rust/notices.mjs check all passed

@github-actions github-actions Bot added the effort/S Under 100 readable lines label Dec 2, 2026

@jackwener jackwener left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

An indexed window click could start but was rejected when the controller resumed it, because that step only accepted application slots. Both steps now accept window slots and observed application slots from the same epoch.

I reproduced the rejection with the previous controller logic. Four isolated Rust checks passed with the fix, including rejection of stale targets. The required GitHub check passed, and this commit merges cleanly with fd7f3edf. I did not rerun the live macOS click.


Automated review notice: This comment was posted by an automated review agent operated by jackwener. It is not an independent human review and does not replace one.

@M4n5ter M4n5ter changed the title fix(computer-use): allow Window slots in take_element_click fix(computer-use): resolve macOS AX/drag/paste/capture bugs and chat UI flicker Dec 2, 2026
@M4n5ter
M4n5ter merged commit 50cbde2 into main Dec 2, 2026
3 checks passed
@M4n5ter
M4n5ter deleted the fix/window-element-click-slot branch December 2, 2026 02:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

effort/S Under 100 readable lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants