Skip to content

feat: feat(cluster-protocol): add the Rust WebSocket binding and cloud data-plane contract#796

Merged
tomdps merged 1 commit into
devfrom
zeroshot/sonic-vertex-73
Jul 25, 2026
Merged

feat: feat(cluster-protocol): add the Rust WebSocket binding and cloud data-plane contract#796
tomdps merged 1 commit into
devfrom
zeroshot/sonic-vertex-73

Conversation

@tomdps

@tomdps tomdps commented Jul 25, 2026

Copy link
Copy Markdown
Collaborator

Closes #651

@tomdps
tomdps enabled auto-merge July 25, 2026 00:29
@greptile-apps

greptile-apps Bot commented Jul 25, 2026

Copy link
Copy Markdown

Greptile Summary

Adds a WebSocket data-plane binding while sharing protocol dispatch and subscription machinery with NDJSON.

  • Introduces WebSocket client and server transports with multiplexed unary requests and subscriptions.
  • Adds $/cancelRequest, shared dispatch/admission infrastructure, and transport-neutral subscription clients.
  • Extends protocol artifacts, documentation, fixtures, and cross-transport integration tests.

Confidence Score: 3/5

This PR should not merge until WebSocket cancellation reliably removes aborted requests from the connection's in-flight bookkeeping.

Cancelling a pending passthrough request bypasses normal ID cleanup, leaving the ID classified as in flight, while the task-registration race also retains completed abort handles on long-lived connections.

Files Needing Attention: crates/openengine-cluster-server/src/websocket.rs

Security Review

The WebSocket cancellation path can retain cancelled request IDs for the connection lifetime, enabling stale-state growth and preventing those IDs from being reused.

Important Files Changed

Filename Overview
crates/openengine-cluster-server/src/websocket.rs Adds WebSocket serving and cancellation, but task lifecycle races retain in-flight IDs after cancellation and completed abort handles after fast dispatch.
crates/openengine-cluster-client/src/websocket.rs Adds the client WebSocket frame sink and response pump using the shared multiplexing implementation.
crates/openengine-cluster-client/src/multiplex.rs Centralizes request correlation, subscription routing, cancellation serialization, and transport lifecycle.
crates/openengine-cluster-server/src/stdio/dispatch.rs Extracts shared admission, dispatch, subscription spawning, and connection shutdown behavior without an identified regression.
crates/openengine-cluster-protocol/src/watch.rs Adds the typed CancelRequestParams payload used by the new cancellation notification.
protocol/openengine-cluster/v1/schema.json Updates the generated schema with the additive cancellation notification contract.

Sequence Diagram

sequenceDiagram
    participant C as WebSocket client
    participant S as WebSocket server
    participant B as Backend
    C->>S: "Request id=1"
    S->>S: "Insert id=1 into in_flight_ids"
    S->>B: dispatch(request)
    C->>S: "$/cancelRequest id=1"
    S->>S: Remove AbortHandle and abort task
    Note over S: id=1 remains in in_flight_ids
    C->>S: "New request id=1"
    S-->>C: DUPLICATE_REQUEST_ID
Loading

Reviews (1): Last reviewed commit: "feat: implement #651 - feat(cluster-prot..." | Re-trigger Greptile

Comment on lines +191 to +193
if let Some(handle) = ctx.cancel_registry.lock().remove(&cancel_id) {
handle.abort();
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 security Cancellation retains in-flight IDs

When a client cancels a passthrough request while backend dispatch is pending, aborting the task bypasses the cleanup that removes its ID from in_flight_ids, causing later requests that reuse the ID to be rejected as duplicates and cancelled IDs to accumulate until disconnection.

Comment on lines +233 to +235
if let Some(spawn_id) = spawn_id {
ctx.cancel_registry.lock().insert(spawn_id, abort_handle);
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Completed tasks leave abort handles

The task can complete and remove its registry entry before this subsequent insertion, leaving an already-completed abort handle stored for the rest of the connection; fast requests therefore accumulate stale cancellation entries on long-lived connections.

@tomdps
tomdps added this pull request to the merge queue Jul 25, 2026
Merged via the queue into dev with commit b83cfe9 Jul 25, 2026
6 checks passed
@tomdps
tomdps deleted the zeroshot/sonic-vertex-73 branch July 25, 2026 00:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant