fix(sse): default summary + strip malformed id on kept Responses input items (#11108) - #11110
Merged
diegosouzapw merged 1 commit intoAug 22, 2026
Conversation
maxmad64bis
marked this pull request as draft
August 22, 2026 11:25
maxmad64bis
marked this pull request as ready for review
August 22, 2026 11:31
maxmad64bis
marked this pull request as draft
August 22, 2026 11:37
…t items applyReasoningInputPolicy()/sanitizeResponsesInput() (open-sse/services/reasoningInputPolicy.ts) never guaranteed two fields stayed valid on `input[]` items it kept for replay: 1. `summary` on a kept `type: "reasoning"` item — never defaulted when the source omitted it entirely. 2. `id` on any kept item (reasoning and non-reasoning alike) — only ever stripped when it was already a valid string; a malformed `id` (observed as `null`, same upstream omission pattern) survived replay untouched. If the upstream that produced the item never included `summary` (observed with `opencode/muse-spark-1.2-contributor-free` via the `opencode`/zen provider — its Responses API output omits `summary` entirely on opaque-only reasoning items, and separately sends `id: null` instead of a `rs_...` string on some items, including non-reasoning `function_call` items), that missing/malformed field survives the replay round trip. Some Responses-API-compatible upstreams treat both as required-if-present and reject the next turn: ``` [400] invalid_request_error: `input[N]` missing required field `summary` ``` ``` Expected 'id' to be a string. ``` Same code path recently touched by diegosouzapw#10949/diegosouzapw#10959/diegosouzapw#10961 (mixed plaintext/opaque reasoning replay) for the `summary` gap; the `id` gap is the sibling finding caught while validating that fix end-to-end against live muse-spark traffic — and the same class of gap was independently present in responsesInputSanitizer.ts::sanitizeInputItemId(), which returned a malformed id unchanged instead of stripping it. Changes: - sanitizeResponsesInput(), reasoning branch: default `next.summary = []` on a kept opaque `type: "reasoning"` item when the source omitted it. Plaintext-only items intentionally have no `summary` key and stay untouched. - sanitizeResponsesInput(), reasoning branch: keep `id` only when the item is opaque and `id` is a valid string; strip it otherwise (collapsed from two overlapping conditions into one, using the new shared helper). - sanitizeResponsesInput(), generic branch (function_call, message, ...): strip `id` whenever present, valid or not. - New open-sse/services/responsesItemId.ts::isValidResponsesItemId(), shared by both files above and by responsesInputSanitizer.ts::sanitizeInputItemId(), which now actually strips a malformed id instead of passing it through. - Flipped one legacy assertion in strip-reasoning-blobs-agentic-context-1599.test.ts that locked in the old byte-verbatim passthrough (no `summary`) to the corrected contract. Closes diegosouzapw#11108
maxmad64bis
force-pushed
the
fix/11108-reasoning-summary-field
branch
from
August 22, 2026 11:42
4376366 to
d40168d
Compare
maxmad64bis
marked this pull request as ready for review
August 22, 2026 11:44
maxmad64bis
marked this pull request as draft
August 22, 2026 11:59
maxmad64bis
marked this pull request as ready for review
August 22, 2026 12:05
maxmad64bis
marked this pull request as draft
August 22, 2026 12:15
maxmad64bis
marked this pull request as ready for review
August 22, 2026 14:51
diegosouzapw
merged commit Aug 22, 2026
d021423
into
diegosouzapw:release/v3.8.50
25 of 46 checks passed
diegosouzapw
pushed a commit
to jackjinke/OmniRoute
that referenced
this pull request
Aug 23, 2026
…ary defaults in chatcore-translation-paths
diegosouzapw
pushed a commit
that referenced
this pull request
Aug 23, 2026
…10949, #10959) (#10961) Validated on the combined batch board + this branch: 231/231 across chatcore-translation-paths, reasoning-cache, strip-reasoning-blobs, and both Responses translator suites. Pre-merge: propagated the #11110/#11129 summary:[] defaults into five assertions here (each commented with its PR) — without it this branch red against the tip, and as a bonus the merge drains the 4 reasoning reds that were live on the tip from those merges. Plaintext now wins over a coexisting opaque companion; opaque-only drops cleanly for plaintext targets; combos keep explicit Skip. Fixes #10949 and #10959. Thank you @jackjinke!
muhamadgalihsaputra
pushed a commit
to niyatna/NiyatnaRoute
that referenced
this pull request
Sep 27, 2026
…t items (diegosouzapw#11110) Validated on the combined batch board over release/v3.8.50 tip 0f43f0f: static gates clean, typecheck:core clean, focused tests green. Defaults summary and strips malformed ids on kept Responses input items — both 400s observed against live muse-spark traffic; the flipped legacy assertion is documented contract propagation. Thank you @maxmad64bis!
muhamadgalihsaputra
pushed a commit
to niyatna/NiyatnaRoute
that referenced
this pull request
Sep 27, 2026
…iegosouzapw#10949, diegosouzapw#10959) (diegosouzapw#10961) Validated on the combined batch board + this branch: 231/231 across chatcore-translation-paths, reasoning-cache, strip-reasoning-blobs, and both Responses translator suites. Pre-merge: propagated the diegosouzapw#11110/diegosouzapw#11129 summary:[] defaults into five assertions here (each commented with its PR) — without it this branch red against the tip, and as a bonus the merge drains the 4 reasoning reds that were live on the tip from those merges. Plaintext now wins over a coexisting opaque companion; opaque-only drops cleanly for plaintext targets; combos keep explicit Skip. Fixes diegosouzapw#10949 and diegosouzapw#10959. Thank you @jackjinke!
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
applyReasoningInputPolicy()/sanitizeResponsesInput()(open-sse/services/reasoningInputPolicy.ts) never guaranteed two fields stayed valid oninput[]items it kept for replay:summaryon a kepttype: "reasoning"item — never defaulted when the source omitted it entirely.idon any kept item (reasoning and non-reasoning alike) — only ever stripped when it was already a valid string; a malformedid(observed asnull, same upstream omission pattern) survived replay untouched.If the upstream that produced the item never included
summary(observed withopencode/muse-spark-1.2-contributor-freevia theopencode/zen provider — its Responses API output omitssummaryentirely on opaque-only reasoning items, and separately sendsid: nullinstead of ars_...string on some items, including non-reasoningfunction_callitems), that missing/malformed field survives the replay round trip. Some Responses-API-compatible upstreams treat both as required-if-present and reject the next turn:Same code path recently touched by #10949/#10959/#10961 (mixed plaintext/opaque reasoning replay) for the
summarygap; theidgap is the sibling finding caught while validating that fix end-to-end against live muse-spark traffic — and the same class of gap was independently present inresponsesInputSanitizer.ts::sanitizeInputItemId(), which returned a malformed id unchanged instead of stripping it.Change
sanitizeResponsesInput(), reasoning branch: defaultnext.summary = []on a kepttype: "reasoning"item carrying opaque state when the source omitted it. Plaintext-only items intentionally have nosummarykey and stay untouched.sanitizeResponsesInput(), reasoning branch: keepidonly when the item is opaque andidis a valid string; strip it otherwise (collapsed two overlapping conditions into one, via the new shared helper).sanitizeResponsesInput(), generic branch (function_call, message, ...): stripidwhenever present, valid or not.open-sse/services/responsesItemId.ts::isValidResponsesItemId(), shared by both places above and byresponsesInputSanitizer.ts::sanitizeInputItemId(), which now actually strips a malformed id instead of passing it through unchanged.strip-reasoning-blobs-agentic-context-1599.test.tsthat locked in the old byte-verbatim passthrough (nosummary) to the corrected contract.Test Plan
Regressions in
tests/unit/reasoning-input-policy-summary-11108.test.tsandtests/unit/responses-input-sanitizer-name.test.ts:summary: []on an opaque item missing it; an existingsummaryis left untouched.summaryon the surviving opaque item.id(null) on a kept opaque reasoning item is stripped; a valid stringidis preserved.idon a non-reasoning item (function_call) is stripped;call_idis untouched.responsesInputSanitizer.ts::sanitizeInputItemId()now strips a non-string reasoning-itemidinstead of passing it through (previously untested gap).npx eslint open-sse/services/reasoningInputPolicy.ts open-sse/services/responsesInputSanitizer.ts open-sse/services/responsesItemId.ts tests/unit/reasoning-input-policy-summary-11108.test.ts tests/unit/responses-input-sanitizer-name.test.ts— clean.npx tsc --noEmit -p tsconfig.json— no errors on the touched files.Closes #11108