feat: feat(cluster-protocol): add the Rust WebSocket binding and cloud data-plane contract#796
Conversation
… binding and cloud data-plane contract
Greptile SummaryAdds a WebSocket data-plane binding while sharing protocol dispatch and subscription machinery with NDJSON.
Confidence Score: 3/5This 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
|
| 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
Reviews (1): Last reviewed commit: "feat: implement #651 - feat(cluster-prot..." | Re-trigger Greptile
| if let Some(handle) = ctx.cancel_registry.lock().remove(&cancel_id) { | ||
| handle.abort(); | ||
| } |
There was a problem hiding this comment.
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.
| if let Some(spawn_id) = spawn_id { | ||
| ctx.cancel_registry.lock().insert(spawn_id, abort_handle); | ||
| } |
There was a problem hiding this comment.
Closes #651