fix(browser): harden agentic browsing harness against live-observed failures - #1801
Open
Zenetusken wants to merge 3 commits into
Open
fix(browser): harden agentic browsing harness against live-observed failures#1801Zenetusken wants to merge 3 commits into
Zenetusken wants to merge 3 commits into
Conversation
…ailures - normalizeReferenceId parses rendered ref descriptors ([input text 1], link 3) - set_checked routes helper-backed refs through new DOM helper set_checked_node - _reference_action converts Playwright navigation-race errors into a navigation action result (matched on specific phrases; generic errors mentioning navigation still raise) - _state flags chrome-error/chromewebdata pages with error_page/error and original_title - browser tool evaluate accepts expression as an alias for script - regression tests: navigation race, error-page state, expression alias, re-raise guard, JS source markers
…requires method arg)
…nvalid-escape warnings)
Author
|
Added commit |
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.
What this PR does
Hardens the
_browserplugin's agentic-browsing harness against six failure modes observed in live agent sessions (evidence from saved chat logs of a real browsing task). Developed by the agent itself while debugging its own tooling, then reviewed, corrected and validated before submission.Fixes
browser-page-content.js):normalizeReferenceIdnow parses rendered reference descriptors like[input text 1]andlink 3back to their numeric id — previously the model copying the label it saw on screen produced an unresolvable ref.set_checkedworks on helper-backed references (browser-page-content.js,browser-dom-helper.js): helper-backed refs previously threwbrowser_page_content_checked_helper_backed; they now route through the DOM helper via a newset_checked_nodeoperation (setCheckedLocalNode/setCheckedNode), supporting native checkbox/radio inputs, ARIAcheckbox/radio/switch/menuitemcheckbox/menuitemradioroles, andaria-pressedtoggle buttons, with properinput/changeevent dispatch.runtime.py):_reference_actioncatches Playwright's navigation-context errors (Execution context was destroyed, most likely because of a navigation) and returns a{"navigation": True}action result with fresh page state, instead of failing the tool call. Matching is restricted to Playwright's specific phrases so genuine script errors mentioning "navigation" still raise (regression-tested).runtime.py):_statedetectschrome-error://,edge-error://andchromewebdataURLs and reportserror_page/error: "browser_error_page"fields plusoriginal_title, so automation can distinguish DNS/load failures from a loaded page.evaluateacceptsexpressionas an alias forscript(browser.py): the documented/natural argument name now works — previouslyaction=evaluatewithexpressionsilently evaluated an empty script and returnednull.Review corrections applied before opening
"navigation"substring from the navigation-error matcher (would have swallowed genuine errors like "navigation is not allowed here"); added a regression test proving such errors re-raise.(1,)→(1, "1+2")) — the test failed as originally written.Verification
tests/test_browser_agent_regressions.py: 109 passed, 1 skipped in theagent0ai/agent-zero:v2.6image withagent_zero_usrmounted read-only — including new behavioral tests for the navigation race (fake page raising Playwright's error), chrome-error state reporting, the expression alias end-to-end throughBrowser.execute, and source markers for the JS helpers.--continue-on-collection-errors): failure set byte-identical to pristine5ff106a2(93 pre-existing failures/errors from thesys.modulesstub poisoning that test(suite): guard live /a0/usr writes and fix cross-module test pollution #1799 fixes; zero new failures). JS assets passnode --check; Python files compile.