Skip to content

[Bug]: browser extension relay leaves CDP clients waiting when malformed frames arrive #102057

Description

@qingminglong

Bug type

Behavior bug (incorrect output/state without crash)

Beta release blocker

No

Summary

Browser extension relay CDP clients that send malformed JSON or a structurally invalid request receive no JSON-RPC error response.

Steps to reproduce

  1. Start from current upstream/main (19f7b72a74731438f15aafbfc7c84593f6151dfc).
  2. Attach a CDP client socket through ExtensionRelayBridge.attachCdpClientSocket(...).
  3. Send malformed JSON, or send a JSON object without a numeric id and string method.
  4. Observe that onMessage(...) returns without sending a response to the CDP client.

Expected behavior

The relay should respond to malformed CDP client frames with a JSON-RPC parse error (-32700) or invalid-request error (-32600) so callers fail immediately at the protocol boundary.

Actual behavior

extensions/browser/src/browser/extension-relay/relay-bridge.ts catches JSON.parse(...) failures and returns silently. It also returns silently when the parsed frame does not contain a numeric id and string method, leaving the client waiting for its own timeout.

OpenClaw version

current upstream/main source: 19f7b72a74731438f15aafbfc7c84593f6151dfc

Operating system

Source-level bug; not OS-specific.

Install method

Source checkout.

Model

NOT_ENOUGH_INFO

Provider / routing chain

NOT_ENOUGH_INFO

Additional provider/model setup details

NOT_ENOUGH_INFO

Logs, screenshots, and evidence

extensions/browser/src/browser/extension-relay/relay-bridge.ts: CDP client onMessage parses raw JSON, returns on parse failure, and returns again when request.id/method are invalid. No response is sent to the client in either path.

Duplicate searches found no open issue or PR blocker:
- gh search issues "browser extension relay malformed CDP JSON" -> []
- gh search prs "browser extension relay malformed CDP JSON" -> []
- gh search issues "extension relay CDP client malformed frame" -> []
- gh search prs "extension relay CDP client malformed frame" -> []
- gh search issues "Chrome extension relay JSON-RPC parse" -> []
- gh search prs "Chrome extension relay JSON-RPC parse" -> []

Impact and severity

Affected: browser extension relay CDP clients, including automation clients using the relay.
Severity: Low to medium; malformed client frames are an edge case, but the current behavior can turn a protocol error into a caller-side timeout.
Frequency: Always for malformed JSON or invalid CDP request object frames at this boundary.
Consequence: Clients do not receive a timely protocol error and may wait until their own timeout.

Additional information

A focused regression test can assert that malformed JSON receives one JSON-RPC parse error response and invalid request objects receive one invalid-request response without forwarding anything to the extension socket.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Normal backlog priority with limited blast radius.clawsweeper:fix-shape-clearClawSweeper found a clear likely implementation shape for this issue.clawsweeper:queueable-fixClawSweeper marked this issue as an existing queue_fix_pr work candidate.clawsweeper:source-reproClawSweeper found a high-confidence source-level issue reproduction.impact:otherThis issue has meaningful maintainer-visible impact outside the owned taxonomy.issue-rating: 🦞 diamond lobsterVery strong issue quality with high-confidence source-level or clear reproduction.no-staleExclude from stale automation

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions