Skip to content

fix(computer_use): add fallback when list_windows(on_screen_only=True) returns empty (#32766)#33054

Open
Tranquil-Flow wants to merge 1 commit into
NousResearch:mainfrom
Tranquil-Flow:fix/32766-cua-fallback-pub
Open

fix(computer_use): add fallback when list_windows(on_screen_only=True) returns empty (#32766)#33054
Tranquil-Flow wants to merge 1 commit into
NousResearch:mainfrom
Tranquil-Flow:fix/32766-cua-fallback-pub

Conversation

@Tranquil-Flow

Copy link
Copy Markdown
Contributor

What does this PR do?

Fixes fragility in CuaDriverBackend.capture() where list_windows(on_screen_only=True) can return zero windows due to unreliable is_on_screen detection in the underlying cua-driver. This causes the entire computer_use toolset to fail hard, breaking auxiliary vision routing for text-only main models.

Fix: Adds a fallback retry without the on_screen_only filter when the primary call returns empty. The fallback applies client-side is_on_screen filtering. If the fallback also returns empty, a graceful empty CaptureResult is returned.

Related Issue

Fixes #32766

Type of Change

  • Bug fix (non-breaking change which fixes an issue)

Changes Made

  • tests/tools/test_cua_backend_fallback_32766.py (+156): 4 focused regression tests
  • tools/computer_use/cua_backend.py (+31): Fallback retry when primary on_screen_only returns empty, with client-side filtering and identical normalization

How to Test

python3 -m pytest tests/tools/test_cua_backend_fallback_32766.py tests/tools/test_computer_use.py -v -o "addopts="

78 tests passed (4 new + 74 existing). Fail-without-fix proven: 3/4 new tests fail without production change.

Related PRs


Checklist:

  • Code compiles/runs correctly
  • Tests pass locally
  • No extraneous changes
  • PR contains only intended changes (2 files, +187)
  • Fix targets root cause, not symptoms
  • All edge cases covered

…) returns empty (NousResearch#32766)

When the cua-driver's is_on_screen detection is unreliable (e.g. on
certain window managers, virtual desktops, or when no window is focused),
list_windows(on_screen_only=True) returns zero windows. Previously,
capture() gave up immediately with an empty 0x0 result, breaking auxiliary
vision routing and making computer_use unusable on affected systems.

Add a fallback: retry list_windows without the on_screen_only filter when
the primary call returns empty. The fallback applies client-side
on_screen filtering so the behavior matches the primary path as closely
as possible.

Fixes NousResearch#32766.
@alt-glitch alt-glitch added type/bug Something isn't working P2 Medium — degraded but workaround exists comp/tools Tool registry, model_tools, toolsets tool/vision Vision analysis and image generation labels May 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/tools Tool registry, model_tools, toolsets P2 Medium — degraded but workaround exists tool/vision Vision analysis and image generation type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

computer_use (cua-driver backend) is too fragile and breaks auxiliary vision routing

2 participants