Repository navigation
Conversation
A terminal SSE error can arrive over HTTP 200 and a clean EOF. Pulse correctly treats errors as progress for idle timing, but the relay used that signal to record success before inspecting the error. Its EOF path also only applied rate limits, so balance and quota failures stayed healthy. Inspect errors before recording an opening success, reuse the shared stream-fault classifier and known quota reset, and flush undelimited error frames before final health accounting. Apply the same EOF tolerance while buffering a stream opening so the original error is retained there too. Keep rate limits out of the health tally and retain the existing success after content has started. Cover the terminal health tally, pause and reset behavior, original error forwarding, subsequent routing, all four SSE dialects and no replay after content.
fylorn
force-pushed
the
codex/sse-terminal-health
branch
from
November 1, 2026 02:49
f6f915d to
d6200d6
Compare
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.
When the last upstream returns HTTP 200 with an SSE error before any content, a clean EOF currently leaves its health record as a success. Balance and quota failures are therefore retried on later requests, and rate-limit errors incorrectly add a success sample. An error frame without a trailing blank line is only recognized after the relay has already decided health.
Read the upstream error before recording an opening success and classify terminal faults with the same helper used by WebSocket turns, including known quota resets. Flush the final error frame before health accounting, and recognize an undelimited final frame while buffering the opening as well. Balance and quota failures pause the provider, server/auth failures use the existing breaker, and rate limits stay out of the health tally. Original SSE errors still reach the client; content already delivered keeps its existing success and is never replayed.
This fixes the pre-existing stream-finalization issue found while reviewing #378 and #379, and is based on the merged #379.
Validation:
cargo fmt --all -- --check: passed.cargo clippy --workspace --all-targets -- -D warnings: passed.tw-watch::fd_budget::with_too_few_fds_it_falls_back_to_fsevents_and_misses_nothingassertion (37 != 5); it fails identically when run independently against unmodified mainb9ea83df081a3911e800938af2e0e5d5002d8c99. This PR does not changetw-watchor its dependencies.scripts/smoke.sh: 86 passed, 0 failed.