Skip to content

fix(computer-use): discover and target exact application windows - #3430

Merged
bobleer merged 2 commits into
GCWing:mainfrom
bobleer:codex/fix-computer-use-window-selection
Oct 16, 2026
Merged

bobleer merged 2 commits into
GCWing:mainfrom
bobleer:codex/fix-computer-use-window-selection

Conversation

@bobleer

@bobleer bobleer commented Oct 16, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Computer Use can select a windowless launcher or an application's large main window while the requested task lives in a different process or smaller window. Add native window discovery and exact {pid, window_id} targeting so the agent can identify the task by title and keep observations and input bound to it.

Also honor describe_screen(include_image: true) for vision-capable models and correct recovery guidance that treated a windowless process or sparse accessibility tree as evidence that the task was absent.

Update the existing navigation-icon regression to follow the overview components introduced in #3426. The initial CI run exposed its stale inline-icon expectations; the test now verifies the MiniApp logo component is wired into the overview, retains each app's icon, and uses the standard search icon for Skill discovery. No production overview code changes.

Type and Areas

Type: bug fix and capability improvement.

Areas: Computer Use tool contracts/orchestration, macOS and Windows desktop providers, built-in agent prompt, native regression fixture, architecture documentation.

Motivation / Impact

  • list_windows discovers native titles and owner PIDs without activating or selecting a window. macOS includes off-screen WindowServer entries; Windows lists visible, non-minimized titled top-level windows.
  • Hosts advertise window-target-v1. Exact selection validates window ownership, supports switching windows within one process, and preserves the existing capture when a requested replacement cannot be resolved. An exact-window failure cannot return a different window's AX tree as fallback.
  • describe_screen preserves its text-only default and returns the requested window image plus screenshot identity/geometry when explicitly requested by a vision-capable model.
  • Tool descriptions, launch/capture failure guidance, and the agent prompt direct recovery through window discovery and evidence instead of guessing that the task is closed or requires foreground takeover.

Verification

Passed locally on macOS:

  • node scripts/test-computer-use-context.mjs — 66 passed, 1 ignored.
  • cargo test --locked -p openbitfun-core --no-default-features --features agent-runtime,git,tools-computer-use --lib computer_use_tool::tests — 57 passed.
  • cargo test --locked -p openbitfun-agent-content --test prompt_catalog_contracts — 9 passed.
  • cargo test --locked -p openbitfun-desktop --features devtools --lib computer_use — 163 passed, 9 opt-in tests ignored.
  • node scripts/test-macos-control-roundtrip.mjs — passed using its documented OPENBITFUN_TEST_BINARY option after compiling the native harness. The full production Tool pipeline discovers both fixture windows, first captures the larger default window, selects the smaller window by ID, rejects a wrong-owner ID without losing the existing binding, returns an image from describe_screen, and verifies click delivery, Unicode text, Return, OCR, and unchanged human foreground state. The fixture does not override acceptsFirstMouse.
  • node scripts/test-windows-computer-use-native.mjs --check --target x86_64-pc-windows-msvc — native-module cross-compilation passed; this is not Windows execution or a full Windows Desktop build.
  • cargo build --locked -p openbitfun-desktop --features devtools — passed.
  • pnpm run fmt:rs and git diff --check — passed.
  • pnpm --dir src/web-ui run test:run src/app/components/NavPanel/navigationIconIntegration.test.ts src/app/scenes/personal-overview/OverviewMiniAppLogos.test.tsx src/app/scenes/personal-overview/PersonalOverviewScene.actions.test.tsx — 30 passed after reproducing and correcting the stale navigation-icon assertion from the initial CI run.

The original game was not replayed with the new build. Windows native behavior and remote-control/peer/detached scenarios were not exercised locally; existing CI supplies broader platform checks.

Reviewer Notes

AI-assisted. Testing level: fully tested for the listed local macOS scenarios, with platform and end-to-end limits stated above.

The selector field is optional and legacy payload round trips remain covered. Older hosts and Linux reject unsupported exact-window selectors explicitly. Linux retains its AT-SPI/portal contract; remote SSH workspaces retain their explicit unsupported response. No new desktop capture fallback or input permission path is introduced.

Checklist

  • This PR is focused and does not include secrets, temporary prompts, generated scratch files, or unrelated artifacts.
  • Relevant verification is recorded above, or skipped checks are explained.
  • User-facing strings, docs, and locales are updated where applicable.

@bobleer
bobleer merged commit 03612ce into GCWing:main Oct 16, 2026
13 checks passed
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