Skip to content

fix(cua): retarget SoM container-clicks to the nearest link/button — fix multi-step nav - #955

Merged
mercurialsolo merged 1 commit into
mainfrom
fix/cua-som-click-retarget
Jul 1, 2026
Merged

mercurialsolo merged 1 commit into
mainfrom
fix/cua-som-click-retarget

Conversation

@mercurialsolo

Copy link
Copy Markdown
Owner

The last open fault from the re-audit

The re-audit (#954 harness) on the current build isolated the real remaining
CUA fault: multi-step click+nav (and the contenteditable-write flow it
gates) failed. Diagnosis from the executor logs:

som-click → elv=DIV.post-author-meta  elv_text='Lena Tanaka...'  ok=True   (×7, looped → halt)

The brain correctly aimed at the author's name, but the SoM click resolved
to the parent DIV.post-author-meta, not the <a class="post-author-name" href="/in/..."> inside it. cdp_click_at_point's el.click() on a non-link
div does nothing → no navigation → loop → halt.

Fix (same family as #952's el.focus)

Before clicking, snap a non-actionable target to the nearest actionable element:
an ancestor <a>/<button>, or a single actionable descendant whose box is
within 40px of the click point (bounded so we never jump to a distant link
in a huge container). Report retargeted / target_tag.

Verified live

Deployed to cua-server; the multi-step "open the author's profile and read the
headline" task went halted (loop) → succeeded. Logs show the click
retargeted to <a href="/in/lena-tanaka-9d79/"> and the very next frame is
DIV.hero-banner on the profile page — real navigation.

Tests

test_cua_input_focus_feedback.py — the SoM JS carries the retarget helpers and
clicks the retargeted element. 6 pass; ruff clean.

This closes the multi-step click fault; combined with #948/#951/#952 (brain +
type-landing), the /v1/cua capability now covers read + type + click-to-navigate.

🤖 Generated with Claude Code

…fix multi-step nav

Re-audit on the current build isolated the last open fault: multi-step click+nav
(and the contenteditable-write flow it gates) failed because a SoM click on a
feed row resolved to a NON-actionable container (DIV.post-author-meta) even
though the brain aimed at the author-name link inside it. cdp_click_at_point's
el.click() on that div does nothing, so navigation clicks looped to a halt.

Fix (same family as #952's el.focus): before clicking, snap a non-actionable
target to the nearest actionable element — an ancestor <a>/<button>, or a SINGLE
actionable descendant whose box is within 40px of the click point (bounded so we
never jump to a distant link in a huge container). Report retargeted/target_tag.

VERIFIED live: the multi-step "open the author's profile and read the headline"
task went halted(loop) → succeeded — the click retargeted to
<a href="/in/lena-tanaka-9d79/"> and navigated to the profile (logs show the
next frame is DIV.hero-banner on the profile page).

Tests: test_cua_input_focus_feedback.py — SoM JS carries the retarget helpers
and clicks the retargeted element. 6 pass; ruff clean.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@mercurialsolo
mercurialsolo merged commit c449eb3 into main Jul 1, 2026
6 checks passed
@mercurialsolo
mercurialsolo deleted the fix/cua-som-click-retarget branch July 1, 2026 07:10
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