DEV-199 Harden RFQ WebSocket invalid-frame handling#87
Open
cesarenaldi wants to merge 2 commits into
Open
Conversation
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 1220e8c. Configure here.
| cause: parsed.error, | ||
| }); | ||
| this.#pending.rejectAll(error); | ||
| void this.#fail(error); |
There was a problem hiding this comment.
Frames handled after shutdown
Medium Severity
When a malformed known inbound frame triggers #fail, the session marks #closing, rejects pending work, and ends the event queue, but #handleMessage never checks that state. Additional frames can still arrive and be parsed until the WebSocket finishes closing, so events may be pushed or acks resolved after the session was supposed to be dead.
Reviewed by Cursor Bugbot for commit 1220e8c. Configure here.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


Summary
Verification
Linear: DEV-199
Note
Medium Risk
Changes RFQ session lifecycle on parse errors (session ends vs. staying open); behavior is defensive but affects live quoting/cancel/confirm flows.
Overview
Hardens the RFQ quoter WebSocket so inbound traffic is classified before full parsing. Unknown
typevalues are dropped silently so future server message types do not break existing clients.Malformed frames that match a known type but fail
RfqQuoterInboundMessageSchemanow trigger a full session teardown (#fail): pending auth/quote/cancel/confirmation waits are rejected, the event stream ends, and the socket closes—instead of only rejecting pending promises while leaving the session open.Bindings gain
RfqKnownInboundType/RfqKnownInboundMessageSchemashared by all inbound Zod schemas. Integration tests cover unknown frames interleaved with acks and malformedACK_RFQ_QUOTEshutdown behavior.Reviewed by Cursor Bugbot for commit 1220e8c. Bugbot is set up for automated code reviews on this repo. Configure here.