Repository navigation
feat(cu): surface element state and tree position to the model - #1555
Merged
Merged
Conversation
`get_window_state` reports each element's interaction state and parent, but `normalizeCuaSnapshotElement` dropped those fields, so they never reached `CuObservedElement` and never appeared in `observationText`. The model saw a flat list where every row looked equally actionable and equally rootless. Two consequences in a long run: - Without `enabled`, a disabled control is indistinguishable from one the model simply failed to hit, so it retries the same dead element. - Without a parent link, there is no way to tell which panel, dialog, or row group an element belongs to. That matters as soon as a modal or a secondary window is on screen and two rows share a label. Passes `enabled`, `selected`, and `parent_index` (as `parentElementId`) through the normalizer, the observation mapper, and the model-visible projection. All three are optional and omitted when absent, so the shape is additive. Verified against the real driver: of 62 observed elements, 59 now carry `parentElementId`. Note on `enabled` / `selected`: the pinned cua-driver v0.7.1 does not emit them yet — its element rows are `depth, element_index, element_token, frame, label, parent_index, role`. Upstream added them by v0.12.6. This change reads them when present, so the fields light up on the driver upgrade without further work here.
Contributor
|
Reviewed at No P0-P3 findings. Squash-merged as |
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
get_window_statereports each element's interaction state and its parent, butnormalizeCuaSnapshotElementdropped those fields. They never reachedCuObservedElementand never appeared inobservationText, so the model saw a flat list in which every row looked equally actionable and equally rootless.Why it matters in a long run
Without
enabled, a control that is present but not actuatable is indistinguishable from one the model simply failed to hit. The model retries the same dead element instead of looking for what actually enables it.Without a parent link, there is no way to tell which panel, dialog, or row group an element belongs to. This becomes concrete as soon as a modal or secondary window is open and two rows share a label — the model has coordinates and a role, but no structure.
Change
Pass
enabled,selected, andparent_index(asparentElementId) through the three layers that were dropping them:All three are optional and omitted when absent, so the projection stays additive — no existing field changes shape.
Model-visible element before / after:
Verification
Against the real driver on a live window: of 62 observed elements, 59 now carry
parentElementId.@maka/computer-use— 137/137 passed@maka/runtime— 2686 passed, 8 failed; the same 8 fail on a cleanorigin/mainbuild (unrelated pre-existing failures in extraction-contract / workspace-instructions / prepareStep)Note on
enabled/selectedThe pinned cua-driver v0.7.1 does not emit them yet. Its element rows are exactly:
Upstream added
enabled/selectedby v0.12.6. This change reads them when present, so they light up on the driver upgrade with no further work here.parentElementIdworks on the pinned version today, which is what the verification above exercises.