fix: count console.error output in Console errors summary - #48
Open
dyos22 wants to merge 2 commits into
Open
Conversation
The summary line "Console errors" and SUMMARY.md only counted uncaught page errors (agent-browser's errors command). Errors that the page catches and reports via console.error — fetch failures, error boundaries, caught exceptions, i.e. the most common error class in modern apps — were captured in console-output.log but reported as "Console errors: 0". Repro: a page calling console.error() three times reports 0 errors, while a page with one uncaught ReferenceError reports 1. Fix: merge [error]-type console entries (already collected for the viewer) with the uncaught errors, dedupe, and use the merged list for both the count and the SUMMARY.md report. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Review follow-ups: - Fall back to parsing [error] lines from raw console output when the JSON console fetch returns nothing. - Dedupe on normalized text (strip the "[error] " prefix) so the same error reported both as uncaught and as a console entry is counted once. - Print the merged list in the terminal error listing, matching the count. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
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.
Problem
The stop-report line
Console errors:and the SUMMARY.md section only count uncaught page errors (from agent-browser'serrorscommand). Errors that the page catches and reports viaconsole.error()— fetch failures, framework error boundaries, caught exceptions — end up inconsole-output.logbut are reported asConsole errors: 0.Since most modern apps catch failures and log them rather than crash, the summary under-reports exactly the class of errors it is labeled after. An agent (or human) trusting the summary line will pass a page that is logging errors.
Repro
console.error()three times (all failures caught): reportedConsole errors: 0, while all three lines are present inconsole-output.log.ReferenceError: reportedConsole errors: 1.Verified against v1.6.0 with
agent-browser errors --session …(empty for page A) vsagent-browser console --session …(all three entries).Fix
In
stop.ts, merge[error]-type console entries (already collected for the viewer timeline) with the uncaught error lines, dedupe, and use the merged list for both the count and the SUMMARY.md error listing.Testing
npm run buildclean,npm test30/30 passing.Console errors: 3with the entries listed in SUMMARY.md; page B unchanged; a clean page still reports 0.🤖 Generated with Claude Code