Skip to content

feat: diagnostic/operate consume session capture + consoleMessages#817

Closed
jackwener wants to merge 2 commits intofeat/session-network-capturefrom
feat/diagnostic-operate-capture
Closed

feat: diagnostic/operate consume session capture + consoleMessages#817
jackwener wants to merge 2 commits intofeat/session-network-capturefrom
feat/diagnostic-operate-capture

Conversation

@jackwener
Copy link
Copy Markdown
Owner

Summary

  • diagnostic: collectPageState() now prefers readNetworkCapture() over networkRequests() (performance API), following the unified rule: session capture first, fallback to legacy
  • operate open: starts startNetworkCapture() before goto(), fixing the initial-request timing gap. JS interceptor only injected as fallback when CDP capture unavailable
  • operate network: reads from session capture first, falls back to window.__opencli_net
  • CDPPage.consoleMessages(): real implementation via CDP Runtime.consoleAPICalled + Runtime.exceptionThrown events, replacing BasePage's empty-array stub. Supports level filtering (error returns error+warning)

Architecture

All consumers follow the same rule established in discussion with @codex-mini0:

Read session capture first → fallback to legacy API

No new ad-hoc data paths. diagnostic, operate, and explore (from PR A) all consume the same IPage passive capture contract.

Test plan

  • 4 new tests for consoleMessages (log/error capture, exception capture, error filter, empty state)
  • 1 new test for multi-request capture ordering
  • Full unit suite passes (550/550)
  • Type check clean
  • Manual: OPENCLI_DIAGNOSTIC=1 shows richer network data in diagnostic output
  • Manual: operate network shows initial page-load requests

Depends on #813. Ref #810

Wire diagnostic and operate to prefer session-level passive capture
over legacy data sources, following the unified rule: read session
capture first, fallback to previous API.

Changes:
- diagnostic collectPageState: readNetworkCapture → networkRequests fallback
- operate open: startNetworkCapture before goto, JS interceptor only as fallback
- operate network: readNetworkCapture → __opencli_net fallback
- CDPPage.consoleMessages(): real implementation via Runtime.consoleAPICalled
  and Runtime.exceptionThrown CDP events (replaces BasePage empty-array stub)
- 4 new tests for consoleMessages (capture, exception, filter, empty)
- 1 new test for multi-request capture ordering

Part of #810
Both operate network and explore parseNetworkRequests now handle both
CDPPage fields (status, responseBody) and daemon/extension fields
(responseStatus, responsePreview) when reading from readNetworkCapture.
This ensures the daemon path doesn't regress with missing status/body.
@jackwener jackwener force-pushed the feat/diagnostic-operate-capture branch from f20e962 to cd0d6d4 Compare April 5, 2026 14:19
@jackwener
Copy link
Copy Markdown
Owner Author

Closing in favor of opus0's #816 (same fix, both approved)

@jackwener jackwener closed this Apr 5, 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.

1 participant