Skip to content

fix: count console.error output in Console errors summary - #48

Open
dyos22 wants to merge 2 commits into
AmElmo:mainfrom
dyos22:fix/count-console-error-output
Open

fix: count console.error output in Console errors summary#48
dyos22 wants to merge 2 commits into
AmElmo:mainfrom
dyos22:fix/count-console-error-output

Conversation

@dyos22

@dyos22 dyos22 commented Aug 11, 2026

Copy link
Copy Markdown

Problem

The stop-report line Console errors: and the SUMMARY.md section only count uncaught page errors (from agent-browser's errors command). Errors that the page catches and reports via console.error() — fetch failures, framework error boundaries, caught exceptions — end up in console-output.log but are reported as Console 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

  • Page A calls console.error() three times (all failures caught): reported Console errors: 0, while all three lines are present in console-output.log.
  • Page B throws one uncaught ReferenceError: reported Console errors: 1.

Verified against v1.6.0 with agent-browser errors --session … (empty for page A) vs agent-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 build clean, npm test 30/30 passing.
  • Manual: page A now reports Console errors: 3 with the entries listed in SUMMARY.md; page B unchanged; a clean page still reports 0.

🤖 Generated with Claude Code

dyos22 and others added 2 commits August 11, 2026 08:51
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>
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.

1 participant