You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Scope pending CDP command IDs by session and reject in-flight duplicates #5085
CdpBridge tracks outstanding commands in a Map keyed only by the client command ID. If one WebSocket connection reuses an ID before the first command completes, the later pending.set(id, ...) overwrites the first entry.
Whichever debugger call completes first then consumes the shared pending slot. The other completion is discarded, so a response can be associated with the wrong command and one request can wait until its client-side timeout.
Flattened CDP sessions have independent command-ID namespaces. Pending commands must be scoped by connection, session and ID: different sessions can concurrently use the same ID, while a duplicate still in flight within one session should be rejected without replacing the original pending command.
How to reproduce
Start CdpBridge with a debugger target whose first sendCommand remains pending.
Before it completes, send { "id": 7, "method": "Runtime.evaluate", "sessionId": "session-b" } on the same connection.
Observe that the second command overwrites the first pending entry and both debugger calls are dispatched.
Resolve the debugger calls and observe that only one completion can consume ID 7; the other response is lost.
Expected behavior: both commands above are dispatched and each session receives its own response. If step 4 instead uses session-a, the duplicate in-flight command is rejected as a protocol error without overwriting the original pending command. An ID becomes reusable within its session after success or failure, and stale results from a disconnected client must not reach a reconnecting client.
Environment
Maka commit: 30cf0beb0d
OS and version: macOS
Surface: Desktop
Node.js version: 22.19 or newer
Logs, screenshots, or additional context
Relevant code: apps/desktop/src/main/browser/cdp-bridge.ts, in onClientMessage() and takePending().
This issue was prepared and submitted by OpenAI Codex at the contributor's direction.
changed the title [-]Reject duplicate in-flight CDP command IDs on one connection[/-][+]Scope pending CDP command IDs by session and reject in-flight duplicates[/+]on Sep 13, 2026
Activity
liuxiaocs7 commentedon Sep 9, 2026
take
[-]Reject duplicate in-flight CDP command IDs on one connection[/-][+]Scope pending CDP command IDs by session and reject in-flight duplicates[/+]fix(desktop): reject duplicate in-flight CDP IDs (apache#5086)