Skip to content

Conversation

@chenjiahan
Copy link
Member

@chenjiahan chenjiahan commented Sep 25, 2025

Summary

When building web applications with coding agents, we need to provide the LLM with enough context. One current limitation is that the agent cannot observe runtime errors occurring in the browser.

This PR addresses that by forwarding browser runtime errors to the socket server via WebSocket and logging them in the terminal, enabling the agent to access richer context for analysis and decision-making.

Screenshot 2025-09-25 at 15 43 32

TODO

  • Capture unhandledrejection events
  • Display error stacks
  • Add an option to disable this behavior
  • Add test cases
  • Update documentation

Related links

Checklist

  • Tests updated (or not required).
  • Documentation updated (or not required).

Copilot AI review requested due to automatic review settings September 25, 2025 07:57
@netlify
Copy link

netlify bot commented Sep 25, 2025

Deploy Preview for rsbuild ready!

Name Link
🔨 Latest commit a52bf45
🔍 Latest deploy log https://app.netlify.com/projects/rsbuild/deploys/68d4f822ea0df00008293caa
😎 Deploy Preview https://deploy-preview-6251--rsbuild.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
Lighthouse
Lighthouse
1 paths audited
Performance: 73 (no change from production)
Accessibility: 97 (no change from production)
Best Practices: 100 (no change from production)
SEO: 100 (no change from production)
PWA: 60 (no change from production)
View the detailed breakdown and full score reports

To edit notification comments on pull requests, go to your Netlify project configuration.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds browser runtime error forwarding functionality, enabling runtime errors that occur in the browser to be displayed in the terminal through WebSocket communication. This provides better debugging context for coding agents by making browser-side errors visible on the server side.

  • Adds WebSocket message handling for runtime errors on the server side
  • Implements browser error event listening and forwarding to the server
  • Refactors WebSocket helper functions for better code organization

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
packages/core/src/server/socketServer.ts Adds runtime error message type and server-side handling to log browser errors
packages/core/src/client/hmr.ts Implements browser error capture and WebSocket forwarding with connection state management

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants