Skip to content

Add pre-action grounding guard (bounds check + snap-to-element)#364

Merged
JE-Chen merged 1 commit into
devfrom
feat/action-grounding-batch
Jun 23, 2026
Merged

Add pre-action grounding guard (bounds check + snap-to-element)#364
JE-Chen merged 1 commit into
devfrom
feat/action-grounding-batch

Conversation

@JE-Chen

@JE-Chen JE-Chen commented Jun 23, 2026

Copy link
Copy Markdown
Member

guardrail scans text for prompt-injection and loop_guard detects stuck loops — neither validates a coordinate action before dispatch. An agent loop executes whatever the model returns with no bounds/target check, so a hallucinated (9999,-5) click fires into nothing and a 5px-off click misses the button.

  • in_bounds(x, y, screen_size): screen-bounds predicate.
  • snap_to_element(x, y, elements, max_dist): centre of the element at/nearest a point (or None).
  • validate_action (AC_validate_action): rejects out-of-bounds coordinates and, given targets, snaps a near-miss onto the nearest element centre → {ok, reason, snapped}. Actions without a coordinate pass.
  • Pure-stdlib geometry over element dicts; executor screen defaults to the live screen. Plugs in front of an agent loop's dispatch. Wired through all 5 layers + headless test + EN/Zh docs + WHATS_NEW. Qt-free.

@codacy-production

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 34 complexity · 0 duplication

Metric Results
Complexity 34
Duplication 0

View in Codacy

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

@JE-Chen JE-Chen merged commit 2c3bd47 into dev Jun 23, 2026
16 checks passed
@JE-Chen JE-Chen deleted the feat/action-grounding-batch branch June 23, 2026 13:03
@sonarqubecloud

Copy link
Copy Markdown

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