Reset SSE parser metadata state - #1069
Conversation
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
There was a problem hiding this comment.
Your trial has ended. Reactivate Greptile to resume code reviews.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (2)
Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review. 📝 WalkthroughWalkthroughThe parser reset now clears pending ChangesParser reset behavior
Priority: ⬇️ Low Estimated code review effort: 1 (Trivial) | ~5 minutes Change: Bug fix Merge Risk: ⚪ Minimal · up to The parser now clears pending metadata on reset, with focused test coverage and no remaining merge-blocking concerns. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 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 |
PR Summary by QodoReset SSE metadata during parser reset
AI Description
Diagram
High-Level Assessment
Files changed (2)
|
Code Review by Qodo🐞 Bugs (0) 📘 Rule violations (0) 📎 Requirement gaps (0)
Great, no issues found!Qodo reviewed your code and found no material issues that require reviewTip of the day💡 Did you know, you can switch off images and animations for a plain-text comment |
There was a problem hiding this comment.
🟢 Approval recommended
The fix includes regression coverage and no blocking issues were identified.
Pull request overview
Resets pending SSE parser metadata to prevent stale values from leaking into subsequent events.
Changes:
- Clears
extrametadata during parser reset. - Adds regression coverage for reset behavior.
File summaries
| File | Description |
|---|---|
tests/unit/utils/eventsource-parser.test.mjs |
Verifies metadata is discarded after reset. |
src/utils/eventsource-parser.mjs |
Clears pending metadata during reset. |
Review details
- Files reviewed: 2/2 changed files
- Comments generated: 0
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes
src/utils/eventsource-parser.mjs— addedextra = void 0tocreateParser().reset()so a pendingmeta:payload is cleared alongside the rest of the parser state, completing the reset for every state field.tests/unit/utils/eventsource-parser.test.mjs— new regression test that feeds ameta:line, resets the parser, feedsdata:, and asserts the next event carries no leftoverextra.
ℹ️ Scope note: the leak is latent today
reset() has no production callers — the sole consumer of createParser, src/utils/fetch-sse.mjs:88, creates one parser per request and never invokes reset(). The extra/meta field is also unused downstream (fetch-sse.mjs:89-92 forwards only event.data to onMessage). So this is a consistency/correctness fix for the exported parser API rather than a change to shipped stream behavior. That said, the fix and test are both correct: I confirmed locally that removing the extra = void 0 line makes the new test fail (suite goes 23/24) and restoring it brings the suite back to 24/24.
DeepSeek Flash (free via Pullfrog for OSS) | 𝕏

Summary
extrametadata whencreateParser().reset()is called.metastate, resets the parser, and verifies the next event does not inherit stale metadata.Why
reset()already clears the decoder, text buffer, event ID, event name, data, and CRLF state, but it leavesextrauntouched. Ifreset()is called after a parsedmeta:line but before the event is dispatched, that stale metadata can leak into the next event.This keeps
reset()semantics consistent across all parser state without changing normal event parsing.Summary by CodeRabbit
Bug Fixes
Tests