Skip to content

fix(sse): honor parked stream state in readiness guard - #14623

Merged
diegosouzapw merged 1 commit into
cheaper-inference:release/v3.8.51from
maxmad64bis:fix/parked-stream-readiness
Sep 24, 2026
Merged

diegosouzapw merged 1 commit into
cheaper-inference:release/v3.8.51from
maxmad64bis:fix/parked-stream-readiness

Conversation

@maxmad64bis

@maxmad64bis maxmad64bis commented Sep 23, 2026 •

Copy link
Copy Markdown
Contributor

⚠️ base-red inherited: #14547

Summary

The park-and-replay path parks a request for up to 120 s with heartbeat pings, but the stream-readiness guard still cuts the parked response at its stall deadline, surfacing a 502 before the replayed leg arrives. This change marks the synthetic parked response as a transient parked stream and teaches the readiness guard to honor that state, so a parked request resolves directly instead of failing first and retrying.

Related Issues

Related to #13924

Validation

  • Change type: other
  • 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/parked-stream-readiness.test.ts (new, 6 cases: marked park with pings resolves instead of 502 RED then GREEN; unmarked pings still 502; marked stream past the ceiling still 504; marker survives a header rebuild and is stripped from the ready response; JSON fallback converts to valid frames; non-convertible 429 fallback surfaces one error data frame with no event: line RED then GREEN).
  • Neighbors re-run one by one, all green: tests/unit/stream-readiness.test.ts (21/21), tests/unit/stream-readiness-policy.test.ts (23/23), tests/unit/opencode-429-park-resume.test.ts (8/8).

Coverage Notes

  • N/A — no coverage gate movement; new behavior is covered by the new test plus the three neighbor suites above. The non-convertible fallback now emits a single data: error frame (built with the shared error helpers) instead of an event: upstream-status line plus raw text, so the parked stream stays a valid SSE frame sequence.

Reviewer Notes

Recensement (upstream positions)

@maxmad64bis
maxmad64bis force-pushed the fix/parked-stream-readiness branch from ced18c4 to 307f925 Compare September 23, 2026 10:14
@maxmad64bis
maxmad64bis marked this pull request as ready for review September 23, 2026 11:05
@diegosouzapw

Copy link
Copy Markdown
Collaborator

Clean fix closing a real gap left by #13924's park-and-replay. Specifically checked that the
internal marker header never leaks to the client (it's stripped on every response rebuild) and
that the non-convertible fallback goes through the shared buildErrorBody/sanitizeErrorMessage
helpers rather than a raw error string — both confirmed by the test suite, which also passes
clean alongside the rest of this session's stall/buffered-turn batch (no shared files with any
of the other six). No blocking items.

@diegosouzapw
diegosouzapw merged commit 5138f28 into cheaper-inference:release/v3.8.51 Sep 24, 2026
9 of 16 checks passed
@maxmad64bis
maxmad64bis deleted the fix/parked-stream-readiness branch September 24, 2026 21:14
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