Repository navigation
feat(browser): name the page's console errors in the agent's next page answer - #956
Merged
Merged
Conversation
omartelo
force-pushed
the
feat/browser-console-errors
branch
from
October 28, 2026 13:14
250a0a5 to
4641f17
Compare
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
The page answer an agent gets from its session's browser (
browser_info,browser_click,browser_press) now names the console errors the page showed since the agent's last page answer, once each:An agent that changed a web app and drives it had only a screenshot to hint that the page threw; now the exception or the failed load is in the answer.
How
internal/browser/console.go: the page hands each console error to a per-session sink, kept until the next page answer, the same pattern as downloads. Sources, all already enabled by chromedp:Runtime.consoleAPICalledof typeerror,Runtime.exceptionThrown(first line of the error plusurl:line), andLog.entryAddedat levelerror(a resource that failed to load, CSP). Warnings, info and log messages are not collected.consoleErrorMax(5) errors are kept, the rest only counted and reported as(N more console errors); each text is folded to one line and cut toconsoleTextMax(200) runes. A page that throws in a loop costs a bounded number of tokens.Page.Listentakes one more callback;api.BrowserPageInfogainsconsoleErrorsandconsoleErrorsMore(contract.goldenupdated).docs/browser-tab.mdhas a Console errors section; CHANGELOG entry under Added.Privacy
The text is exactly what the page logs (its own
console.errorarguments, an exception's message, the URL of a resource that failed). lich reads nothing else from the page for it; a page that logs a form's value hands it to the agent, as it would to anyone with DevTools open.Language
Like the rest of the page answer, the
console error:lines are English outside the prompt-language catalogs. Moving the page answer into the catalogs is a separate follow-up.Test plan
console_live_test.go, same skip rule as the other Chrome tests): a page that logs an error and a warning and asks for a missing image; the first reads name the error and the 404, not the warning; a click on a button that throws answers with the oneUncaught TypeError; the next read repeats nothing. 30/30 runs green.Listencalls inchrome_live_test.goget the new argument (the signature changed), nothing else.gofmt,go vet ./...andgo test ./...green, rebased on feat(browser): browser_info waits for text to appear or go #955 and fix(browser): stage Chrome's downloads in the session profile #960.