fix(browser): return JSON-RPC errors for malformed CDP client frames in relay bridge#102071
fix(browser): return JSON-RPC errors for malformed CDP client frames in relay bridge#102071krissding wants to merge 1 commit into
Conversation
…in relay bridge Silently dropping malformed JSON or invalid CDP request objects leaves automation clients waiting for their own timeout. Return standard JSON-RPC parse error (-32700) and invalid-request error (-32600) at the CDP client socket boundary, matching the precedent in gateway MCP HTTP. Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
|
Codex review: needs real behavior proof before merge. Reviewed July 8, 2026, 3:14 AM ET / 07:14 UTC. Summary PR surface: Source +14, Tests +40. Total +54 across 2 files. Reproducibility: yes. Current main has a high-confidence source-level reproduction: attach a CDP client through Review metrics: none identified. Stored data model Root-cause cluster Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Rank-up moves:
Proof guidance:
Risk before merge
Maintainer options:
Next step before merge
Security Review findings
Review detailsBest possible solution: Preserve a string Do we have a high-confidence way to reproduce the issue? Yes. Current main has a high-confidence source-level reproduction: attach a CDP client through Is this the best way to solve the issue? No as submitted. The fix belongs at the CDP client boundary, but the invalid-request response should preserve a parsed string Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 7e0324263b86. Label changesLabel changes:
Label justifications:
Evidence reviewedPR surface: Source +14, Tests +40. Total +54 across 2 files. View PR surface stats
What I checked:
Likely related people:
What the crustacean ranks mean
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics. How this review workflow works
|
|
Closing as a duplicate of #102070, now landed in The landed fix covers both malformed JSON ( |
What Problem This Solves
The browser extension relay bridge's
attachCdpClientSocketsilentlydrops malformed JSON and invalid CDP request frames without sending any
response to the client. This leaves automation clients (e.g. Playwright
connectOverCDP) waiting for their own timeout instead of receiving animmediate protocol error.
Fixes #102057.
Why This Change Was Made
The
onMessagehandler inattachCdpClientSockethad two silent-returnpaths:
catchblock afterJSON.parse— malformed JSONid(number) ormethod(string) guard — invalid requestBoth returned without writing anything to the client socket. The fix
sends JSON-RPC 2.0 error responses:
id: nullidfrom the parsed object when available
This matches the existing JSON-RPC error precedent in the gateway MCP
HTTP path (
src/gateway/mcp-http.ts), which already returns-32700and
-32600at protocol boundaries.toErrorPayloadwas loosened fromid: numbertoid: number | nullso parse errors can use a null id as specified by JSON-RPC 2.0.
Evidence
Test results (Vitest)
3 regression tests added (all existing 10 tests continue to pass):
{) → parse error -32700 withid: null{params:{}}) → invalidrequest -32600 with
id: null{id:7}) → invalid request -32600 withid: 7Pre-commit checks pass
No lockfile or unrelated file changes.
Merge Risk
Low. The change is scoped to two guarded early-return paths in a single
CDP client message handler. The only behavioral difference is that
clients now receive an error response instead of silence. Normal CDP
routing through
handleCdpRequestis unchanged.