fix(sse): share hardened replay cancel with JSON-to-SSE path - #14790
Merged
diegosouzapw merged 1 commit intoSep 25, 2026
Merged
diegosouzapw merged 1 commit into
diegosouzapw merged 1 commit into
Conversation
maxmad64bis
force-pushed
the
fix/shared-prepend-buffered-chunks
branch
from
September 24, 2026 17:37
b4f5b0d to
2423efc
Compare
maxmad64bis
marked this pull request as ready for review
September 24, 2026 18:07
5 tasks done
The JSON-to-SSE replay awaited the provider cancel promise, which may never settle; reuse the bounded fire-and-forget replay instead.
maxmad64bis
marked this pull request as draft
September 24, 2026 23:41
maxmad64bis
force-pushed
the
fix/shared-prepend-buffered-chunks
branch
from
September 25, 2026 00:21
2423efc to
a83be29
Compare
maxmad64bis
marked this pull request as ready for review
September 25, 2026 01:01
diegosouzapw
merged commit Sep 25, 2026
5057ee1
into
diegosouzapw:release/v3.8.51
19 of 25 checks passed
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
The JSON-to-SSE replay path awaits the provider cancel promise when it discards a replayed stream, and that promise may never settle, so the cancel can hang. This change reuses the bounded fire-and-forget replay cancel already used by the readiness path, so discarding a replayed stream always returns.
Related Issues
Related to #13171 (reader handoff this path preserves) and #12465 (one-chunk-per-demand replay semantics this change generalizes to the second site).
Validation
npm run lintTests Added Or Updated
tests/unit/json-body-replay-cancel-bounded.test.ts(new, 2 cases: SSE-preserve path cancel returns under 500 ms with a never-settling provider cancel — REDstayed pendingthen GREEN; shared-symbol path with prefix order preserved).tests/unit/chatcore-json-body-to-sse.test.ts(6/6),tests/unit/jsonbody-sniff-reader-leak-13169.test.ts(2/2, happy-path handoff guard stays green),tests/unit/stream-readiness.test.ts(21/21),tests/unit/stream-readiness-policy.test.ts(23/23).Coverage Notes
Reviewer Notes
open-sse/handlers/chatCore/jsonBodyToSse.tsshrinks by 28 net lines (local copy removed, one import added);open-sse/utils/streamReadiness.tsgains oneexportkeyword; no rebaseline.--strict) reports 5 missingtap.testFilesentries, all on modules outside this diff; none on the touched modules, so it's not registered in this PR (pre-existing drift on the base).Docs Gatesfails on stale migration counts inREADME.md/AGENTS.md/llm.txt("183 migrations" at the base vs 186 in code, untouched sincemb—diff $mbempty, same failure on same-base PRs refactor(stream-recovery): drop unreachable empty-continuation block in tryContinue #14789/fix(sse): return over-cap bounded read without awaiting tee clone cancel #14791/fix(api): thread correlationId into chat completions early keepalive #14792/fix(sse): correlate mid-stream continuation logs with requesting call #14793) and the 4Unit Testsshards plusFast Quality Gatesfail on 21 tests whose normalized list matches the same-base refactor(stream-recovery): drop unreachable empty-continuation block in tryContinue #14789 list except oneusage-pending-sweepcase that names no file of this PR (test file untouched sincemb—diff $mbempty on it);API Route Typecheck,Merge integrity,ESLint,Vitestpass.