Skip to content

fix(middleware): set debugger websocket origin#297

Open
V3RON wants to merge 1 commit into
mainfrom
fix/agent-debugger-origin
Open

fix(middleware): set debugger websocket origin#297
V3RON wants to merge 1 commit into
mainfrom
fix/agent-debugger-origin

Conversation

@V3RON
Copy link
Copy Markdown
Contributor

@V3RON V3RON commented Jun 5, 2026

What is this?

This PR fixes Rozenite for Agents failing to create a session against React Native 0.85 Metro servers. React Native dev-middleware now validates the Origin header on debugger WebSocket upgrades, and Rozenite was opening the CDP socket without one, which caused the upgrade to be rejected with HTTP 401.

Fixes #296.

How does it work?

When the agent session opens the target webSocketDebuggerUrl, it now passes a WebSocket header with Origin: http://localhost:<metroPort>. localhost is accepted by React Native dev-middleware's debugger WebSocket origin allow-list, so the connection can pass the upgrade check before Rozenite continues its normal CDP bootstrap flow.

The session test WebSocket mock now records constructor options, and the middleware session test asserts that the debugger socket is created with the expected localhost Origin header.

Why is this useful?

This restores the first step of rozenite agent session create for React Native 0.85 projects, where plain HTTP target discovery succeeds but the debugger WebSocket connection is rejected before the agent can bootstrap. The change is narrow to the agent's CDP connection path and keeps compatibility with the existing Metro host and port tracking used by the middleware.

Send a localhost Origin header when Rozenite for Agents opens the React Native debugger WebSocket.

This lets React Native 0.85 dev-middleware accept the upgrade.
@vercel
Copy link
Copy Markdown

vercel Bot commented Jun 5, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
rozenite Skipped Skipped Jun 5, 2026 10:42am

Request Review

@V3RON V3RON changed the title fix: set debugger websocket origin fix(middleware): set debugger websocket origin Jun 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

1 participant