fix(httpapi): model optional session payloads as no content#29247
Merged
kitlangton merged 3 commits intoMay 25, 2026
Conversation
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
HttpApiSchema.NoContentrather than a top-levelSchema.optionalpayload.Content-Type, whitespace-only bodies, and malformed JSON returning400.Context
HttpApiSchema.NoContentis the intended HttpApi representation for an endpoint that accepts either a JSON payload or no request body. This follows the Effect maintainer guidance in Effect-TS/effect-smol#2187 (comment).During review I verified that switching this route entirely to standard HttpApi decoding would change malformed JSON from
400to500, so this PR deliberately updates the declaration without removing the compatibility parser.Verification
bun prettier --write test/server/httpapi-session.test.tsbun oxlint packages/opencode/src/server/routes/instance/httpapi/groups/session.ts packages/opencode/test/server/httpapi-session.test.ts(passes with existing warnings in the test file)bun typecheckfrompackages/opencodebun run test -- test/server/httpapi-session.test.tsfrompackages/opencode./packages/sdk/js/script/build.ts(no generated SDK changes)Note
--no-verifyafter confirmation because the repository pre-push hook failed in unchangedpackages/app/src/pages/session/message-timeline.tsx:584(VirtualizerHandlehas nomeasureproperty). CI typecheck subsequently passed for the original PR revision.