fix(llm): tolerate relay keepalive events in Responses stream folding - #254
Merged
Merged
Conversation
- the relay emits keepalive frames (with global sequence numbers) during long generations such as builtin image generation; unknown-type fail-closed turned them into stream-malformed errors - gated behind the codex-http-relay tolerate_relay_events capability bit like other relay-private structural events; public profile still rejects
There was a problem hiding this comment.
Bot Review — ✅ Approve
The PR adds keepalive to _RELAY_EVENTS so that the Responses stream folder tolerates relay-emitted keepalive SSE frames (which carry a proper sequence number) without killing the reply, while the public profile still fail-closes on unknown event types. Both reviewers completed their coverage with no blocking findings, and the fix is targeted and well-tested (relay profile passes keepalives, public profile still rejects them). Verdict: approve.
No findings reported.
Review provenance
- General reviewer: complete — 2/2 units completed
- Style reviewer: complete — 2/2 units completed
- Coverage: complete
- Reviewed head:
84ce793(base4bbf11f)
Automated review by @KHPilot. Reply with @KHPilot to ask follow-up questions.
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.
Problem
Second pelican test after #253 failed with
Responses 流畸形:未知的语义事件 keepalive。 The relay emits keepalive SSE frames during long generations (builtin image generation in this case); the frame carries a globalsequence_number(it occupies a slot in the upstream counter), but its type is unknown to the folder, so unknown-type fail-closed killed the reply.Fix
Add
keepaliveto_RELAY_EVENTS— the existing home for relay-private structural events, gated behind thecodex-http-relaytolerate_relay_eventscapability bit. Since the frame carries a proper sequence number, strict +1 validation continues seamlessly after the skip. The public profile still rejects it (official endpoints don't send it).Tests
Two new: relay profile folds a stream with interleaved keepalives; public profile still fail-closes with 未知. Full suite 2443 passed, ruff clean.