Repository navigation
fix(protocol): accept idle in the message type filter - #56504
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
This looks correct. On the base branch, type=idle is rejected with 400 InvalidRequestError. With this change it returns only the idle messages. I checked this by running the updated message.test.ts against both checkouts. Type checks pass in protocol, server and client, and so does check:generated. When I removed idle from the new list, the protocol type check failed, so a message type left out of the filter is now a compile error.
Public API: GET /api/session/:sessionID/message accepts one more type value, idle. The change is in the OpenAPI enum and in the client's MessageListInput.type. It's backwards compatible: existing callers and accepted values are unchanged.
I have no concerns.
Fixes #51698
This was referenced Oct 20, 2026
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.
Problem
GET /api/session/:sessionID/message?type=idlereturns400 InvalidRequestError, even thoughidlemessages are returned when no filter is given. The allowedtypevalues were a hand-written list checked withsatisfies ReadonlyArray<SessionMessage.Type>, which rejects unknown values but not missing ones. Theidlemessage type was added after the filter and never made it into the list.Fix
Key the allowed values by
SessionMessage.Typewithsatisfies Record<SessionMessage.Type, true>, so leaving a message type out is now a compile error. The list now includesidle.Not a breaking change: the filter accepts one more value. OpenAPI and the generated client are regenerated.
Verification
packages/server/test/message.test.tsnow imports anidlemessage and filters bytype: "idle". That assertion fails against the old list and passes now.idlefrom the new list failsbun typecheckinpackages/protocolwithProperty 'idle' is missing.bun run check:generatedinpackages/protocolandbun typecheckinpackages/protocolandpackages/serverpass.Added by the opencode bot (AI-generated).
Fixes #51698
Public API: adds
idleto the allowedtypevalues of GET /api/session/:sessionID/message and the client's MessageListInput (backwards compatible)