Skip to content

fix(computer-use): merge refs+content_refs in _ref_map for cua-driver 0.17+ (salvage #79515) - #87299

Merged
teknium1 merged 2 commits into
mainfrom
salv-79515-refmap
Aug 15, 2026
Merged

fix(computer-use): merge refs+content_refs in _ref_map for cua-driver 0.17+ (salvage #79515)#87299
teknium1 merged 2 commits into
mainfrom
salv-79515-refmap

Conversation

@teknium1

Copy link
Copy Markdown
Contributor

Summary

Typed browser clicks/typing work again on current cua-driver builds: _ref_map now merges refs + content_refs instead of preferring one exclusively, so the action-bearing refs that cua-driver ≥ 0.17 ships in the split payload are no longer discarded. Salvage of #79515 by @weisiwu, confirmed live on a real desktop before salvaging.

Root cause: 0.17 split the semantic_v2 payload — action refs moved to refs[] while content_refs[] re-lists every node with empty action lists. Our _ref_map read content_refs first and stopped, so every ref registered with zero actions and every typed mutation refused with browser_ref_stale.

Live proof (the bug and the fix)

Found while live-verifying the just-merged authorization work (#86342) on an unlocked desktop with cua-driver 0.19.3 + real Chrome:

Step Before (main) After (this PR)
bind → snapshot ok, "1 action ref, 5 content refs" same
cua_browser_click on the Learn more link ref refused browser_ref_stale dispatched; page navigated to iana.org, verified by fresh snapshot
stale-ref reuse after mutation n/a (never got there) still refused browser_verification_required (guard intact)

Trusted-input note from the same run: on Linux the driver refuses the trusted CDP route (browser_input_trust_unavailable, window would activate) and recommends the explicit dom_event downgrade — our wrapper surfaced the escalation losslessly and the explicit downgrade path worked as designed.

Changes

  • tools/computer_use/browser_route.py: _ref_map absorbs refs, content_refs, and legacy snapshot.refs shapes, unioning action sets per ref so empty re-listed entries never clobber action-bearing ones (contributor's commit, cherry-picked with authorship).
  • tests/tools/test_computer_use_cua_0_9.py: regression test pinning the 0.17+ split-shape merge (our follow-up; the original PR had no test).
  • contributors/emails/: mapping for @weisiwu.

Validation

Check Result
Live E2E on unlocked desktop (bind → snapshot → click → verify iana.org) PASS
Stale-ref + verification-required guards after merge still refuse correctly
test_computer_use_cua_0_9.py + test_computer_use_browser_authorization.py 69 passed
ruff clean

Infographic

Semantic ref merge fix — before/after and live proof

weisiwu and others added 2 commits August 15, 2026 15:12
… 0.17

cua-driver >= 0.17 splits the semantic_v2 snapshot payload: action-bearing
refs live in the `refs` array while `content_refs` carries every node
with EMPTY action lists. _ref_map only absorbed content_refs, so every
click/pointer/type ref was registered with no declared actions and all
typed-browser mutations failed with browser_ref_stale.

Merge refs + content_refs + snapshot.refs with set union so action info
is never dropped by an empty content entry. Verified against the 0.17
split format, the legacy refs-only format, the transitional dict format,
and the snapshot.refs fallback.
Regression test for the _ref_map merge (salvaged from #79515): the live
0.19.3 driver splits action refs into refs[] while content_refs re-lists
every node with empty actions; the empty entries must not clobber the
action-bearing ones. Caught live: every typed click refused with
browser_ref_stale until the merge fix.
@github-actions

github-actions Bot commented Aug 15, 2026

Copy link
Copy Markdown
Contributor

૮ >ﻌ< ა ci review

ran on 32ec784 — test(computer-use): pin 0.17+ split refs/content_refs merge

⚠️ Warnings

OSV vulnerability scan · View job

5 known vulnerabilities found in pinned dependencies.

How to fix:

Review the findings in the Security tab. Update the affected dependencies if a patched version is available.


debug info

CI timings

CI timings · View report · View job

Wall time 3m23s vs 3m32s (-4.2%). 15 job(s) slower, 6 faster, 3 unchanged.

  • Python tests / Run tests slice 10/12: -42.0s
  • Python tests / Run tests slice 7/12: +38.0s
  • Python tests / Run tests slice 4/12: -26.0s
  • Python tests / Run tests slice 2/12: +19.0s
  • Python tests / Run tests slice 12/12: +11.0s

@alt-glitch alt-glitch added type/bug Something isn't working tool/browser Browser automation (CDP, Playwright) P2 Medium — degraded but workaround exists labels Aug 15, 2026
@teknium1
teknium1 merged commit 951ae62 into main Aug 15, 2026
48 checks passed
@teknium1
teknium1 deleted the salv-79515-refmap branch August 15, 2026 22:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

P2 Medium — degraded but workaround exists tool/browser Browser automation (CDP, Playwright) type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants