fix(evals): forward auth headers during CDP HTTP endpoint discovery

PR
1d ago
+193-2

resolveWebSocketEndpoint in packages/evals/core/tools/cdp_code.ts called fetch on /json/version without forwarding input.headers, even though CdpConnection.connect already passes those headers to the WebSocket constructor. Authenticated HTTP CDP endpoints therefore failed discovery with 401 before the WebSocket connection could open.

This threads optional headers into resolveWebSocketEndpoint, passes them to fetch when set, and adds unit tests in packages/evals/tests/core/cdp-code.test.ts covering both discovery auth failure/success and end-to-end CdpConnection.connect header forwarding across /json/version and the WebSocket upgrade.

Fixes #3525


Summary by cubic

Fixes CDP HTTP endpoint discovery failing with 401 when the endpoint requires authentication. resolveWebSocketEndpoint now forwards the headers passed to CdpConnection.connect during the /json/version fetch, matching the existing WebSocket upgrade behavior.

  • Threads optional headers into resolveWebSocketEndpoint and sends them with the fetch when set.
  • Exports resolveWebSocketEndpoint to enable unit testing.
  • Adds tests covering discovery auth failure/success and end-to-end header forwarding.

Fixes #3525.