fix(computer-use): merge refs+content_refs in _ref_map for cua-driver 0.17 - #79515
Closed
weisiwu wants to merge 1 commit into
Closed
fix(computer-use): merge refs+content_refs in _ref_map for cua-driver 0.17#79515weisiwu wants to merge 1 commit into
weisiwu wants to merge 1 commit into
Conversation
… 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.
teknium1
added a commit
that referenced
this pull request
Aug 15, 2026
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.
Contributor
|
Thanks @weisiwu — this was exactly right, and we proved it live before landing it: on cua-driver 0.19.3 with a real Chrome window, every typed click refused with Your commit is merged to main with your authorship preserved via PR #87299 (bbd3462), plus a regression test we added on top pinning the 0.17+ split refs/content_refs shape. Closing this PR since the work has landed. Much appreciated! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes typed-browser mutations (
cua_browser_click/cua_browser_type/cua_browser_pointer) failing withbrowser_ref_staleon every ref after upgrading cua-driver to >= 0.17.Root cause
cua-driver >= 0.17 splits the
semantic_v2snapshot payload into two lists:refs— action-bearing entries withactions: ["click", "pointer", ...](the authoritative interactive refs)content_refs— every node in the tree, but with emptyactions: []_ref_map()intools/computer_use/browser_route.pyonly absorbedcontent_refs(preferring it overrefs), so every ref was registered with an empty action set._require_ref()then rejected all mutations withbrowser_ref_stale. Navigation and snapshot reads still worked because they don't need action refs — which made this easy to miss: the browser works until you click.Observed live on macOS with cua-driver 0.17.0 (upgraded from 0.1.9 via
hermes computer-use install --upgrade).Fix
Merge all three payload shapes instead of picking one:
refs(0.17 authoritative, action-bearing)content_refs(0.17 content nodes; empty actions must not clobber)snapshot.refs(legacy fallback)Actions are combined with set union, so an empty
content_refsentry can never drop the actions declared inrefs. The old behavior for pre-0.17 drivers (refs-only list, transitional dict shape) is preserved.Verification
_ref_mapagainst 4 payload shapes:refswith actions +content_refswith empty actions) → refs keepclick/pointer✅refs-only list ✅refs-as-dict ✅snapshot.refsfallback + empty payload ✅Test plan for reviewers
Requires cua-driver >= 0.17 for the live end-to-end reproduction; the unit-level check above runs on any version.