Repository navigation
fix(streaming): decode CR, LF and CRLF server-sent events across chunks (carry #6439) - #6446
Conversation
…LF framing Carry follow-up for #6439. Replace the per-character delimiter loop with cached indexOf cursors for the next CR and LF, so the shared decoder keeps native, linear scanning on every provider stream. Add explicit cases for a CRLF split between chunks (including an empty chunk in between), LFCR, many records in one chunk for each framing, a UTF-8 code point split next to CR, and raw versus escaped CR in data. Give the Korean guide section a Korean heading and record the cursor search in the byte-accounting owner doc. Co-authored-by: 정우철 <oocheol@naver.com>
|
✅ Deterministic PR hygiene checks passed. |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository: lidge-jun/opencodex/.coderabbit.yaml Review profile: ASSERTIVE Plan: Advanced Run ID: 📒 Files selected for processing (7)
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 6 remain after this review. 📝 WalkthroughWalkthroughThe shared SSE decoder now treats CR, LF, and CRLF as line terminators, including CRLF split across chunks. Added tests cover delimiter combinations, chunk boundaries, UTF-8 splitting, byte-budget release, and dispatch before stream closure. English and Korean guides and byte-accounting documentation describe the behavior. ChangesSSE line-ending support
Priority: ➖ Normal Estimated code review effort: 3 (Moderate) | ~20 minutes Change: Bug fix Merge Risk: ⚪ Minimal · up to The expanded SSE line-ending support appears ready to merge after normal checks; no concrete remaining issue is established. Security Architecture ReviewSecurity architecture risk: 🔵 Low · up to The checked streaming size limits and downstream payload checks remain in place, and no introduced security issue was established. Incomplete before-and-after and cancellation coverage prevents a definitive minimal-risk assessment. Retained concerns Security review detailsSecurity Blast Radius
Trust Boundaries and Controls
Resilience and Maintainability Implications
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Maintainer integration decision (dev, admin bypass per MAINTAINERS.md): merging at exact head a41a4ed.
|
Summary
Providers that frame server-sent events with a lone CR, the third line ending the event-stream spec allows, had events dropped or merged, because the shared decoder in
src/lib/sse-decoder.tsonly split on LF. This carries oocheol's #6439 so the decoder accepts LF, CRLF and lone CR, including a CRLF split across fetch chunks. A CR at the end of one chunk followed by an LF at the start of the next counts as one line ending.acceptLineis removed.indexOfcursors for the next CR and LF. Every provider stream goes through this decoder, so scanning stays native and linear, and LF-only or CR-only chunks never rescan for a delimiter that has run out.structure/transports/byte-accounting.md.Behaviour notes for review:
TRANSLATOR_MAX_SSE_EVENT_BYTES) is unchanged, and limit+1 still fails for every framing.src/claude/outbound.ts,src/vision/anthropic-describe.ts,src/lab/conformance/sse-normalize.ts).Supersedes #6439.
Co-authored-by: 정우철 oocheol@naver.com
Verification
사용자 지시로 로컬 테스트 미실행, hosted CI가 유일한 검증.
Per maintainer instruction, no local test, typecheck or build result is offered as evidence for this PR. The only verification is the hosted CI run at head
a41a4ed3cde8acc2f9a563cc549d5f9450b60a78, which includes the full test suite (test 1/4totest 4/4), the macOS and Windows legs, typecheck, structure, and privacy gates. A read-only independent code review of the decoder and tests also returned PASS; it is review evidence, not test evidence.Checklist
Summary by CodeRabbit