fix(sidecars): bound streamed response bytes - #1376
Conversation
|
✅ Deterministic PR hygiene checks passed. |
✅ READY
Review readiness checklist
✅ 4/4 boxes ticked. This pull request is already Ready for Review. |
|
Please rebase this PR onto the latest |
1ba46c8 to
30adf56
Compare
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Plus Run ID: 📒 Files selected for processing (4)
📝 WalkthroughWalkthroughThe sidecar SSE parser now limits streamed input to 64 KiB, processes complete accepted events, discards truncated data, and cancels the reader without waiting. Tests cover byte boundaries, UTF-8 truncation, cancellation failures, and header parsing. Comments document the limit. ChangesSidecar SSE response limits
Estimated code review effort: 3 (Moderate) | ~20 minutes Sequence Diagram(s)sequenceDiagram
participant SidecarStream
participant parseSidecarSSE
participant TextDecoder
participant Reader
SidecarStream->>parseSidecarSSE: provide streamed response chunks
parseSidecarSSE->>TextDecoder: decode bytes below 64 KiB
TextDecoder-->>parseSidecarSSE: return complete SSE data
parseSidecarSSE->>Reader: cancel without waiting at byte limit
parseSidecarSSE-->>SidecarStream: return bounded parsed output
Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 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 |
|
@coderabbitai review |
✅ Action performedReview finished.
|
|
Tip For best results, initiate chat on the files or code changes.
You are interacting with an AI system. |
Rate Limit Exceeded
|
|
Thanks @luvs01 — strong bounded-stream hardening here. Capping raw sidecar SSE before decoded/authoritative copies accumulate, while preserving complete events and cancellation semantics, closes the memory-growth path cleanly. 🙏 |
Summary
data:parsing and malformed-frame behavior, and cancel upstream without letting a rejecting or stalled cancel fail the partial result.Verification
bun test tests/web-search-parse.test.ts— 36 passed.bun run typecheck— passed.bun run privacy:scan— passed.git diff --check HEAD^ HEAD— passed.Checklist
dev.Review readiness checklist
All CI tests are green on my local testing.
I pushed my PR to the latest dev commit.
I resolved all correct Codex and CodeRabbit findings.
My PR is ready for review.
Summary by CodeRabbit
Bug Fixes
Tests