Repository navigation
fix(computer-use): cap elements array in aux-vision routing path - #30426
AhmetArif0 wants to merge 1 commit into
Conversation
_route_capture_through_aux_vision returned cap.elements verbatim, so dense SOM captures (600+ AX nodes on Electron/Slack) routed via auxiliary.vision still produced oversized tool results that could exhaust session context — the same NousResearch#22865 shape that PR NousResearch#30145 fixed for the AX-only path. Fix: pass visible_elements (already capped by max_elements in _capture_response) to _route_capture_through_aux_vision and use it in the returned JSON. Add total_elements and truncated_elements fields for parity with the AX path so the model knows the response is partial. 3 regression tests added: default cap (600→100), explicit override (300→50), no truncated_elements field when under cap.
2d0cad5 to
533d666
Compare
|
Thanks for tracing the cap bypass; current main still has it: Problems
Suggested changes
Automated hermes-sweeper review. |
GottZ
left a comment
There was a problem hiding this comment.
This was generated by AI during triage.
Summary
Three PRs touch computer-use vision routing, but they address distinct causes: #30426 caps elements after auxiliary-vision routing, #42158 revises CUA window discovery and capture transport while including auxiliary-routing fixes already on main, and #51551 enables native vision transport for OpenCode providers.
Related pull requests
- #30426
related— (+124/-4) — keep open, fix tests, then merge: the production diff correctly passes the already capped visible_elements into the auxiliary route and reports truncation metadata, directly fixing the uncapped dense-UI response. The keep_open review identifies blocking test defects: the 1×1 fixture bypasses auxiliary routing, and an existing image_url assertion was accidentally moved. - #42158
related— (+163/-36) — keep open for rebase and scope reduction: its cache-directory and auxiliary-analysis handling overlap functionality already present on main, while its remaining CUA changes include off-screen windows and unconditionally use get_window_state. As the keep_open contributor review notes, that conflicts with current on-screen selection semantics and bypasses the legacy-screenshot capability path, so it needs a targeted reproduction and mixed-inventory coverage before consideration. - #51551
related— (+78/-2) — keep open as an independent merge candidate: the diff marks opencode-go and opencode-zen as vision-capable at the shared transport gate, preventing vision-capable models from being incorrectly routed through auxiliary text analysis. This directly addresses the live provider-profile cause identified by the keep_open review and includes scoped tests for both vision_analyze and computer-use routing.
Suggested consolidation
Merge #30426 after replacing the undersized image fixture, proving auxiliary.vision was actually invoked, and restoring the displaced assertion. Evaluate #51551 independently because it fixes a separate provider-capability gate; rebase and narrow #42158 around a proven off-screen-window defect while preserving current capability routing. None of #30426, #42158, or #51551 should be closed as duplicates of another.
Cross-PR triage: Reviewed 3 pull requests and 0 issues in this complex. Each diff was read against this issue; Assessment working set: 27 kB of PR diffs, 12 kB of issue/PR text, 4 kB of discussion (4 comments), 0 verify verdicts. verdicts reflect diff content, not PR titles. Part of an automated triage batch.
Root Cause
_route_capture_through_aux_visionreturnedcap.elementsverbatim —bypassing the
max_elementscap that_capture_responsecomputes for theAX and multimodal paths.
On a dense UI (Electron app, Slack, JetBrains IDE), SOM captures produce
600+ AX nodes. When
auxiliary.visionis configured or the main model isnot vision-capable, those captures route through
_route_capture_through_aux_vision,which was returning all nodes uncapped. The AX-only path was fixed by #30145,
but the aux-vision routing path was not updated symmetrically.
Failure Path
auxiliary.visionconfigured (or main model doesn't support vision).computer_use(action="capture", mode="som")on a dense UI (600 elements)._capture_responsecomputesvisible_elements = cap.elements[:max_elements](100 nodes)._should_route_through_aux_vision()returnsTrue._route_capture_through_aux_vision(cap, summary)is called with the fullcapobject."elements": [_element_to_dict(e) for e in cap.elements]— all 600 nodes emitted, context blowup.Fix
Pass
visible_elements(already capped) from_capture_responseto_route_capture_through_aux_vision. Addtotal_elementsand conditionaltruncated_elementsfields for parity with the AX path so the model knowsthe response is partial.
Symmetric with the AX path fix in #30145. No behaviour change for captures
with fewer than
max_elementsnodes.Tests
3 regression tests added to
test_computer_use_capture_routing.py:_DEFAULT_MAX_ELEMENTS(100)max_elements=50override flows through to the aux-vision responsetruncated_elementsfieldAll 90 computer-use tests pass (
test_computer_use.py+test_computer_use_capture_routing.py).