Skip to content

fix(sse): share hardened replay cancel with JSON-to-SSE path - #14790

Merged
diegosouzapw merged 1 commit into
diegosouzapw:release/v3.8.51from
maxmad64bis:fix/shared-prepend-buffered-chunks
Sep 25, 2026
Merged

diegosouzapw merged 1 commit into
diegosouzapw:release/v3.8.51from
maxmad64bis:fix/shared-prepend-buffered-chunks

Conversation

@maxmad64bis

@maxmad64bis maxmad64bis commented Sep 24, 2026 •

Copy link
Copy Markdown
Contributor

⚠️ base-red inherited: #14547

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

  • Change type: provider
  • Focused tests and category gates from the golden path
  • npm run lint
  • Reconciled with the current active release base; focused checks rerun afterward
  • Production-code changes include a new or updated automated test in this PR

Tests 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 — RED stayed pending then GREEN; shared-symbol path with prefix order preserved).
  • Neighbors re-run one by one, all green: 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

  • New cancel path covered by the new test plus the four neighbor suites above; no coverage gate movement expected.

Reviewer Notes

@maxmad64bis
maxmad64bis force-pushed the fix/shared-prepend-buffered-chunks branch from b4f5b0d to 2423efc Compare September 24, 2026 17:37
@maxmad64bis
maxmad64bis marked this pull request as ready for review September 24, 2026 18:07
The JSON-to-SSE replay awaited the provider cancel promise, which may
never settle; reuse the bounded fire-and-forget replay instead.
@maxmad64bis
maxmad64bis marked this pull request as draft September 24, 2026 23:41
@maxmad64bis
maxmad64bis force-pushed the fix/shared-prepend-buffered-chunks branch from 2423efc to a83be29 Compare September 25, 2026 00:21
@maxmad64bis
maxmad64bis marked this pull request as ready for review September 25, 2026 01:01
@diegosouzapw
diegosouzapw merged commit 5057ee1 into diegosouzapw:release/v3.8.51 Sep 25, 2026
19 of 25 checks passed
@maxmad64bis
maxmad64bis deleted the fix/shared-prepend-buffered-chunks branch September 30, 2026 00:22
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.

2 participants