Skip to content

feat(core): context-aware element resolver scoring (#991)#1111

Merged
shaun0927 merged 1 commit into
developfrom
feat/991-context-aware-resolver
May 13, 2026
Merged

feat(core): context-aware element resolver scoring (#991)#1111
shaun0927 merged 1 commit into
developfrom
feat/991-context-aware-resolver

Conversation

@shaun0927
Copy link
Copy Markdown
Owner

@shaun0927 shaun0927 commented May 12, 2026

Progress / Review status

Auto-refreshed 2026-05-13 — owner comments cleaned up to reduce review noise.

Field Value
Branch feat/991-context-aware-resolverdevelop
Draft no
CI ✅ all 9 checks passing
Mergeable ✅ MERGEABLE
Review decision
Codex (latest) 💡 suggestions posted
Other reviewers (latest) chatgpt-codex-connector: commented
Head 3326d2e — Improve repeated-label action targeting with local context
Commits 1

Owner comment cleanup: 0 issue + 0 inline review comments deleted. Outstanding feedback from automated/external reviewers above is unchanged.


Summary

  • threads optional act.context into AX element resolution
  • adds deterministic context scoring only within the winning AX cascade match level
  • adds repeated-label unit coverage proving context tie-breaks without changing no-context order

Repo-fit / duplicate check

  • Checked open PRs for feat(core): context-aware element resolver scoring #991/context-aware resolver; no existing PR covers this issue.
  • Scope stays local and deterministic: no AgentQL dependency, no LLM/cloud resolver, no new selector language.
  • Context is a tie-breaker only, so existing exact role/name semantics remain primary.

Tests

  • npx jest tests/utils/ax-element-resolver.test.ts --runInBand
  • npm run build
  • npm run lint:changed

Merge-time real OpenChrome verification

Use a local fixture with header/main/footer or product-card repeated controls:

  1. navigate to the fixture page with three Add to cart buttons.
  2. act({ tabId, instruction: "click Add to cart", context: "Noise Cancelling Headphones" }).
  3. Verify via read_page/oc_assert that only the headphones cart state changed.
  4. Repeat with a second product context.
  5. Confirm broad no-context behavior remains compatible and context-qualified path completes in the expected <=2 browser calls per product scenario.

Closes #991

@gemini-code-assist
Copy link
Copy Markdown

Warning

You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again!

@qodo-code-review
Copy link
Copy Markdown

ⓘ You've reached your Qodo monthly free-tier limit. Reviews pause until next month — upgrade your plan to continue now, or link your paid account if you already have one.

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 86ba0722f9

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines 348 to 350
properties: props,
contextText: typeof props['description'] === 'string' ? String(props['description']).slice(0, 240) : undefined,
});
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Set inViewport before applying context tie-breaks

scoreNodeContext adds a viewport bonus, but flattened AX nodes never set inViewport, so every candidate gets the same viewport signal. In context-qualified queries with repeated labels, this lets hidden/offscreen matches outrank visible ones purely by text; because cascadeFilter trims to maxResults before DOM.getBoxModel drops zero-size nodes, visible elements can be excluded and the action can fail with ELEMENT_NOT_FOUND even when a valid on-screen target exists.

Useful? React with 👍 / 👎.

Constraint: Context scoring must be deterministic, local-only, and must not outrank the existing AX cascade match levels.
Rejected: Add a semantic selector language or cloud/LLM resolver | too broad for #991 and risks changing OpenChrome action semantics.
Confidence: high
Scope-risk: narrow
Directive: Keep act.context as a tie-breaker; do not let context override exact role/name matching without a separate design issue.
Tested: npx jest tests/utils/ax-element-resolver.test.ts --runInBand; npm run build; npm run lint:changed
Not-tested: Real OpenChrome repeated-card fixture verification is documented in the PR for merge-time/manual validation.

Co-authored-by: OmX <omx@oh-my-codex.dev>
@shaun0927 shaun0927 force-pushed the feat/991-context-aware-resolver branch from 86ba072 to 3326d2e Compare May 13, 2026 09:33
@shaun0927 shaun0927 merged commit b2730c3 into develop May 13, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant