fix(anthropic): preserve terminal SSE frames - #316
Merged
Conversation
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Plus Run ID: 📒 Files selected for processing (5)
📝 WalkthroughWalkthroughThe Anthropic adapter now uses a shared chunk-safe SSE decoder, supports terminal records without trailing newlines, maps reasoning deltas and blocks to ChangesAnthropic SSE handling
Estimated code review effort: 3 (Moderate) | ~25 minutes Sequence Diagram(s)sequenceDiagram
participant AnthropicResponse
participant decodeServerSentEvents
participant AnthropicAdapter
participant CodexEventStream
AnthropicResponse->>decodeServerSentEvents: stream SSE chunks
decodeServerSentEvents->>AnthropicAdapter: yield decoded records
AnthropicAdapter->>CodexEventStream: emit thinking_delta and text_delta
AnthropicAdapter->>CodexEventStream: emit final done event
Possibly related issues
Suggested reviewers: ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
Ingwannu
marked this pull request as ready for review
July 23, 2026 06:25
eachann1024
pushed a commit
to eachann1024/opencodex
that referenced
this pull request
Jul 23, 2026
…to review stack base
This was referenced Jul 29, 2026
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
Fixes Anthropic-compatible streaming responses that ended as
adapter_eof/ zero terminal usage even though the upstream emitted visible text and a valid terminalmessage_stop(#312).Root cause
The Anthropic adapter parsed newline-delimited lines directly from each fetch chunk. Event state did not survive arbitrary chunk boundaries, and the final buffer was never flushed at EOF. A terminal
message_stopwithout a trailing newline could therefore be stranded. If the upstream also omitted an intermediate usage snapshot, no fallbackdoneevent was emitted and the bridge correctly classified the otherwise successful stream as incomplete.Changes
reasoning/reasoning_deltablocks as internal thinking events without suppressing later visible text.Validation
bun run test: 3,616 passed, 0 failedbun run typecheckbun run privacy:scanevent:/data:chunks, no usage snapshot, and no final newlineFixes #312
Summary by CodeRabbit
New Features
Bug Fixes
Documentation