Skip to content

fix(protocol): accept idle in the message type filter - #56504

Merged
rekram1-node merged 2 commits into
devfrom
message-idle-filter
Oct 18, 2026
Merged

rekram1-node merged 2 commits into
devfrom
message-idle-filter

Conversation

@rekram1-node

@rekram1-node rekram1-node commented Oct 17, 2026 •

Copy link
Copy Markdown
Contributor

Problem

GET /api/session/:sessionID/message?type=idle returns 400 InvalidRequestError, even though idle messages are returned when no filter is given. The allowed type values were a hand-written list checked with satisfies ReadonlyArray<SessionMessage.Type>, which rejects unknown values but not missing ones. The idle message type was added after the filter and never made it into the list.

Fix

Key the allowed values by SessionMessage.Type with satisfies Record<SessionMessage.Type, true>, so leaving a message type out is now a compile error. The list now includes idle.

Not a breaking change: the filter accepts one more value. OpenAPI and the generated client are regenerated.

Verification

  • packages/server/test/message.test.ts now imports an idle message and filters by type: "idle". That assertion fails against the old list and passes now.
  • Removing idle from the new list fails bun typecheck in packages/protocol with Property 'idle' is missing.
  • bun run check:generated in packages/protocol and bun typecheck in packages/protocol and packages/server pass.

Added by the opencode bot (AI-generated).

Fixes #51698

Public API: adds idle to the allowed type values of GET /api/session/:sessionID/message and the client's MessageListInput (backwards compatible)

@opencode-agent opencode-agent Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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

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.

V2 session history API rejects the idle message filter

1 participant