Skip to content

fix(cua): SoM click must focus the input — the core of the type-stall - #952

Merged
mercurialsolo merged 1 commit into
mainfrom
fix/cua-som-click-focus
Jun 30, 2026
Merged

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

Conversation

@mercurialsolo

Copy link
Copy Markdown
Owner

The bottom layer of the type-stall

Live-verifying #951 showed typing still failed. Root cause is one layer
deeper: the SoM click path (cdp_click_at_point, which the runner uses for
unstructured clicks) dispatches el.click() via Runtime.evaluate — and a
programmatic el.click() fires a click event but does NOT focus a text
input (real mouse clicks focus on mousedown).

So:

  1. Brain SoM-clicks the search box → el.click() → click fires, input not focused (activeElement stays body).
  2. SoM swaps the action to a no-op WAIT, so fix(cua): tell the brain when a click focused an input — break the type-stall #951's env CLICK-branch probe never runs.
  3. No focus → no focused_input → brain never told to type → stalls on wait()/Return.

This is the actual bottom of the audit's "type never lands."

Fix

  • cdp_click_at_point: el.focus() focusable targets
    (INPUT/TEXTAREA/SELECT/contenteditable) before el.click(),
    mirroring native focus→click ordering; report focused on the result and
    _last_som_diag.
  • runner: after a SoM click that focused a field, surface focused_input so
    the fix(cua): tell the brain when a click focused an input — break the type-stall #951 "input field focused — type your text now" feedback fires on the
    SoM path too — the brain types instead of waiting.

Tests

test_cua_input_focus_feedback.py — SoM payload focuses + reports focused.
215 adjacent tests green; ruff clean.

Verification

After merge + deploy I'll re-run the live typing test — expecting the brain to
finally type() into the focused search box. This is layer 3 of the type-stall
(brain-dead #948 → focus-feedback #951 → SoM-focus here); I'll confirm
empirically rather than assume.

🤖 Generated with Claude Code

Live verification of #951 showed typing STILL failed: the brain SoM-clicks the
search box but the run halts with the brain only emitting wait()/Return. Root
cause is one layer deeper than #951: the SoM click path (cdp_click_at_point,
which the runner uses for unstructured clicks) dispatches `el.click()` via
Runtime.evaluate — and programmatic el.click() fires a click event but does
NOT focus a text input the way a real mouse click does (focus happens on
mousedown). So search/login/composer fields were left UNFOCUSED, the brain had
no field to type into, and it stalled. #951's env CLICK-branch probe never even
ran because SoM swaps the action to a no-op WAIT.

Fix:
- cdp_click_at_point: focus focusable targets (INPUT/TEXTAREA/SELECT/
  contenteditable) before el.click(), mirroring native focus→click ordering;
  report `focused` on the result + _last_som_diag.
- runner: after a SoM-dispatched click that focused a field, surface
  focused_input → the "input field focused — type your text now" feedback
  (#951) now fires on the SoM path too, so the brain types instead of waiting.

Tests: test_cua_input_focus_feedback.py — SoM payload focuses + reports focused.
215 adjacent tests green; ruff clean.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@mercurialsolo
mercurialsolo merged commit 1bb9ccf into main Jun 30, 2026
6 checks passed
@mercurialsolo
mercurialsolo deleted the fix/cua-som-click-focus branch June 30, 2026 11:30
mercurialsolo added a commit that referenced this pull request Jul 1, 2026
…atrix + trajectory scanner)

The cua-issues audit (R1-R3) ran against real LinkedIn/Reddit — where anti-bot
from Modal IPs dominates the signal and where the audited builds predated the
#948/#951/#952 fixes. This gives a clean capability read on any current build:

- run_cua_audit.py: fires a category matrix against the mantis-linkedin sim env
  (deterministic, no anti-bot) — read / read-profile / search-type /
  contenteditable-write / multi-step-nav. Non-destructive (the write task types
  into the composer but never sends; nothing logs in or submits).
- scan_cua_audit.py: reads the per-run trajectories off the Modal volume and
  prints the REAL per-category verdict (focus / typed / type-landed-verified /
  clicked / done) — wire status alone lies here (the sim-env search-results page
  is a stub, so a perfect type still 'halts').

First run on 69af1a6: reads work; search type-landing FIXED (text landed,
verified) — the audit's "search 0/7" was stale (pre-#948); multi-step click+nav
and contenteditable-write still fail (both gated by the multi-step click chain).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
mercurialsolo added a commit that referenced this pull request Jul 1, 2026
…atrix + trajectory scanner) (#954)

The cua-issues audit (R1-R3) ran against real LinkedIn/Reddit — where anti-bot
from Modal IPs dominates the signal and where the audited builds predated the
#948/#951/#952 fixes. This gives a clean capability read on any current build:

- run_cua_audit.py: fires a category matrix against the mantis-linkedin sim env
  (deterministic, no anti-bot) — read / read-profile / search-type /
  contenteditable-write / multi-step-nav. Non-destructive (the write task types
  into the composer but never sends; nothing logs in or submits).
- scan_cua_audit.py: reads the per-run trajectories off the Modal volume and
  prints the REAL per-category verdict (focus / typed / type-landed-verified /
  clicked / done) — wire status alone lies here (the sim-env search-results page
  is a stub, so a perfect type still 'halts').

First run on 69af1a6: reads work; search type-landing FIXED (text landed,
verified) — the audit's "search 0/7" was stale (pre-#948); multi-step click+nav
and contenteditable-write still fail (both gated by the multi-step click chain).

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
mercurialsolo added a commit that referenced this pull request Jul 1, 2026
…fix multi-step nav (#955)

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>
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