Skip to content

fix: improve editable-element detection and increase safe operation timeout#85

Closed
eduardofcr wants to merge 1 commit into
fitchmultz:mainfrom
eduardofcr:fix/editable-evidence-and-timeout
Closed

fix: improve editable-element detection and increase safe operation timeout#85
eduardofcr wants to merge 1 commit into
fitchmultz:mainfrom
eduardofcr:fix/editable-evidence-and-timeout

Conversation

@eduardofcr

Copy link
Copy Markdown

[FIX] Improve editable-element detection and increase safe operation timeout

Summary

Two small fixes that significantly improve the reliability of semanticAction fill with role locators and prevent premature timeouts in qa mode on real-world sites.

Changes

1. extensions/agent-browser/lib/results/editable-ref-evidence.ts

Problem: getEditableRefEvidence() relies solely on upstream snapshot metadata flags (editable, contentEditable, etc.) and snapshot text patterns to determine if an element is editable. The upstream agent-browser does not always include these flags for standard <input> elements (e.g., <input type="search" aria-label="Search">), causing editableEvidence to return undefined. This blocks semanticAction fill with locator: "role" from resolving to a direct fill @eN command, falling back to the less reliable "Rich input recovery" (keyboard typing) path.

Fix: Add a fallback checking the element's ARIA role against a set of roles that are inherently editable in the browser accessibility tree: searchbox, textbox, combobox, and spinbutton. When the role matches and no prior evidence contradicts editability, editableEvidence returns true.

2. extensions/agent-browser/lib/process.ts

Problem: SAFE_AGENT_BROWSER_OPERATION_TIMEOUT_MS is set to 25,000ms. This constant is used to clamp AGENT_BROWSER_DEFAULT_TIMEOUT in the child process environment, capping the upstream wait --load and wait --fn default timeout. On slower sites or pages with many assets, the qa mode's wait --load domcontentloaded step can timeout, causing the entire batch to fail. The upstream default (DEFAULT_AGENT_BROWSER_PROCESS_TIMEOUT_MS = 35_000) is already 35s, so clamping to 25s is unnecessarily restrictive.

Fix: Increase SAFE_AGENT_BROWSER_OPERATION_TIMEOUT_MS from 25,000 to 35,000, aligning it with the default process timeout.

Testing

Fix 1 — editable-ref-evidence.ts

Before the fix, this call would fail with "Rich input recovery" suggesting keyboard typing instead of filling directly:

{
  "semanticAction": {
    "action": "fill",
    "locator": "role",
    "role": "searchbox",
    "name": "Search",
    "text": "riverpod"
  }
}

After the fix, it successfully resolves to fill @e3 "riverpod" and fills the searchbox on https://pub.dev.

Fix 2 — process.ts

Before the fix, this qa call would timeout with failureCategory: "timeout" at step 5 (wait --load domcontentloaded):

{
  "qa": {
    "url": "https://pub.dev/packages/riverpod",
    "expectedText": "riverpod 3.3.2",
    "screenshotPath": "/tmp/riverpod-qa.png"
  },
  "timeoutMs": 15000
}

After the fix (or with the increased default), the same call passes with screenshot verified on disk when given adequate timeout.

Related

Closes the reliability gap between semanticAction mode (which has pre-execution ref resolution) and job/qa mode (which depend on upstream find commands or adequate timeouts).


Checklist:

  • Changes are limited to the two files described
  • No new dependencies
  • Backward compatible (undefined → true for known-editable roles is a safe relaxation)
  • Tested against real upstream sites (pub.dev, google.com)

@fitchmultz

Copy link
Copy Markdown
Owner

Thanks for the report. I investigated the semanticAction searchbox case on current main against pub.dev and the wrapper already resolves role=searchbox name=Search to a direct fill @e... call without changing getEditableRefEvidence().

The proposed editable-role fallback changes the wrong layer: getEditableRefEvidence() is conservative explicit editable/contenteditable evidence and is used by other paths such as Electron fill verification. Treating ARIA roles as explicit editable evidence misclassifies ordinary textboxes/content controls.

The timeout change also removes the documented/tested headroom between the 25s upstream operation clamp and the 35s wrapper watchdog.

Closing this PR as stale/incorrect for the current code. If there is still a reproducible semanticAction fill miss on current main, please open a narrower issue or PR with the specific page/snapshot and we can fix it in selector recovery / visible-ref resolution rather than global editable evidence.

@fitchmultz fitchmultz closed this Jun 16, 2026
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.

2 participants