Skip to content

Stop rejected actions from looping forever before dispatch - #3116

Merged
webbrain-one merged 3 commits into
webbrain-one:mainfrom
esokullu:main
Sep 30, 2026
Merged

webbrain-one merged 3 commits into
webbrain-one:mainfrom
esokullu:main

Conversation

@webbrain-one

Copy link
Copy Markdown
Owner

No description provided.

esokullu and others added 2 commits September 30, 2026 06:48
Out-of-bounds coordinates, stale or missing captures, and malformed
tool arguments were returned to the model without loop accounting, so a
run could retry the same impossible action indefinitely and never fall
back to reporting a partial result.

Route those pre-dispatch rejections through the same loop accounting the
preparation-timeout path already used, folding the three duplicated
call sites into one helper. The model still sees the rejection, a
repeated failure now nudges, and the third attempt recovers with the
partial result.

Verified clicks also retire the shared coordinate preparation failures.
A click that lands can recover via a selector or an AX target, so the
stale counters must not block the next correction. Reads, fresh
captures, and dispatch-only successes leave them in place.
Stop rejected actions from looping forever before dispatch
Copilot AI balanced review requested due to automatic review settings September 30, 2026 05:10
@vercel

vercel Bot commented Sep 30, 2026

Copy link
Copy Markdown

@webbrain-one is attempting to deploy a commit to the esokullu's projects Team on Vercel.

A member of the Team first needs to authorize it.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot review overview

馃煛 Changes recommended

Reordered invalid-schema arguments can evade the intended three-attempt rejection limit.

Review effort: Balanced
Findings: 2 Medium severity

Open (2)
What changed in this PR

Adds loop recovery for repeatedly rejected pre-dispatch browser actions across Chrome and Firefox.

Changes:

  • Tracks malformed, invalid, and coordinate-related preparation failures.
  • Resets coordinate failures after verified click progress.
  • Adds lifecycle tests for rejection loops and recovery.
File Description
test/鈥媋gent-lifecycle.mjs Tests rejection-loop detection and recovery.
src/鈥媍hrome/鈥媠rc/鈥媋gent/鈥媋gent.js Records pre-dispatch failures.
src/鈥媐irefox/鈥媠rc/鈥媋gent/鈥媋gent.js Mirrors Chrome failure handling.
src/鈥媍hrome/鈥媠rc/鈥媋gent/鈥媗oop-detector.js Clears coordinate failures after verified clicks.
src/鈥媐irefox/鈥媠rc/鈥媋gent/鈥媗oop-detector.js Mirrors Chrome loop-state recovery.

馃挕 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread src/chrome/src/agent/agent.js
Comment thread src/firefox/src/agent/agent.js
The loop detector derives both its call key and the default failure
scope from bucketArgsKey, whose non-URL path was a raw
JSON.stringify(args). That preserves insertion order, so the same
rejected call re-emitted with its properties permuted hashed to a fresh
key on every attempt and never reached the third-strike stop. Sort
object keys before serializing, recursively, so semantically identical
arguments share one identity. Array order stays significant, and
undefined/function/symbol members drop out of objects exactly as
JSON.stringify drops them.

Coordinate preparation failures were already safe: they carry an
explicit constant failureScope. The invalid-schema path was the one
still exposed, so the lifecycle test now flips property order on that
case instead of only on the coordinate ones.
@webbrain-one
webbrain-one merged commit a34843d into webbrain-one:main Sep 30, 2026
1 of 2 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.

3 participants