Stop rejected actions from looping forever before dispatch - #3116
Merged
Merged
Conversation
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
|
@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. |
Contributor
There was a problem hiding this comment.
Copilot review overview
馃煛 Changes recommended
Reordered invalid-schema arguments can evade the intended three-attempt rejection limit.
Review effort: Balanced
Findings: 2
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.
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

No description provided.