fix(agent): run coord-click loop detection on converted CSS pixels - #2813
fix(agent): run coord-click loop detection on converted CSS pixels#2813alectimison-maker wants to merge 2 commits into
Conversation
|
@alectimison-maker is attempting to deploy a commit to the esokullu's projects Team on Vercel. A member of the Team first needs to authorize it. |
|
Reviewed this alongside #2808, #2809, #2814 and #2815. I think this change moves the detector in the opposite direction from the one intended. The JSDoc on Since The new test doesn't catch it because If the goal is to catch nudges that survive bucketing, dividing the bucket size by the scale (or bucketing in image space, which is what the model is actually reasoning in) gets you there. Converting to CSS pixels first makes the loop harder to detect exactly on the high-DPI screens where downscaling happens. Two smaller things:
|
|
You're right on all three points, and the premise of the original finding was inverted. Closing this PR. I'm opening a small follow-up that pins the intended image-space bucketing with a scale-aware test, so a future change cannot "fix" this the wrong way again. |
|
Closed per review: conversion direction was inverted (scale is always ≥ 1), which would degrade loop detection. |
Summary
_resolveClickCoordsForLoophelper resolves the same pointexecuteTooldispatches (_screenshotClickCoordsconversion when clicking from a downscaled screenshot), and_executeToolBatchfeeds that to_checkCoordClickLoop.Motivation
When the model clicks from a downscaled screenshot,
executeToolmultiplies the image pixels by the storedscreenshotClickScalebefore dispatch (agent.js_screenshotClickCoords). The loop detector, however, received the pre-conversion coordinates. The classic failure mode this detector exists for — "click missed, try a slightly different spot" — sees the model nudge image pixels by 5-20px that all collapse to the same CSS pixel on dispatch, but land in different 5px buckets in the detector. The dedicated loop never accumulates and the run burns steps until the generic detector or the step limit catches it.Design
A click dispatches at exactly
(mapped.x, mapped.y)whenever_screenshotClickCoordsreturns a value (pass-through when no scale is stored orfrom_screenshotis absent). The helper reuses that single conversion so the detector measures the same point as the dispatch — no duplicated conversion logic.loop-detector.jsand_clickProgressIdentare untouched.Testing
node test/run.js— 1765 passed, 0 failed (2 new tests, both Chrome and Firefox agents)npm run test:security— 60/60 passednpm run test:toolbar-guard— 33 passedNew tests: helper converts
from_screenshotclicks by the stored scale, passes through without a scale or flag, and a batch-flow wiring test proves that distinct image-pixel clicks collapsing to the same CSS 5px bucket now register as one repeated point in_checkCoordClickLoop.Compatibility and risks
Scope
_clickProgressIdent(progress-ledger dedup) still hashes raw args — recorded as a potential follow-up, not addressed here.