Skip to content

Harden SSE chat-stream CRLF boundaries (#714) - #722

Merged
alehar9320 merged 1 commit into
mainfrom
chat-stream-crlf-714
Aug 26, 2026
Merged

alehar9320 merged 1 commit into
mainfrom
chat-stream-crlf-714

Conversation

@alehar9320

@alehar9320 alehar9320 commented Aug 26, 2026 •

Copy link
Copy Markdown
Owner

Kernel of closed #714 only. Not a Jules reopen.

Per-line trailing CR strip after split('\n'), skip blank lines, restore .trim() on the single-line fast path so padded [DONE] still matches DONE_MARKER. Tests for split CRLF, consecutive blanks, and padded [DONE].

Files: src/utils/chat-stream.ts + src/utils/chat-stream.test.ts only. No .jules/engine.md. No journal. No env.d.ts stubs.

Stay draft. Overlay 69ca717 stays. Hire LinkedIn. Live fbdfd60 stands. Stay off #698 #691 #597.

Closes nothing until freeze + dual PASS (issue #714 is already closed).

Summary by CodeRabbit

  • Bug Fixes

    • Improved streaming event parsing for Windows-style line endings.
    • Correctly handles events split across chunks, consecutive blank lines, and single-line payloads.
    • Recognizes padded completion markers reliably.
  • Tests

    • Added coverage for edge cases in streamed event processing.

Per-line trailing CR after split, skip blank lines, trim the single-line path so padded [DONE] still matches. Kernel of closed #714. Not a Jules reopen. Overlay 69ca717 stays. Hire LinkedIn.
@alehar9320
alehar9320 temporarily deployed to chat-stream-crlf-714 - astro-cloudflare-personal-website-web-service PR #722 August 26, 2026 06:11 — with Render Destroyed
@coderabbitai

coderabbitai Bot commented Aug 26, 2026 •

Copy link
Copy Markdown

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 593b323b-ef53-4e43-9657-088d57289537

📥 Commits

Reviewing files that changed from the base of the PR and between fbdfd60 and 1f37e8b.

📒 Files selected for processing (2)
  • src/utils/chat-stream.test.ts
  • src/utils/chat-stream.ts

📝 Walkthrough

Walkthrough

The SSE chat stream parser now handles CRLF boundaries across chunks, preserves single-line payloads, skips empty events, and recognizes padded [DONE] markers. Tests cover these cases.

Changes

SSE parser handling

Layer / File(s) Summary
Parser buffering and payload extraction
src/utils/chat-stream.ts
The parser strips trailing carriage returns per line, preserves partial-line buffering, skips empty events, and uses direct extraction for single-line payloads.
Parser edge-case coverage
src/utils/chat-stream.test.ts
Tests cover split CRLF endings, consecutive blank lines, single-line events, and padded [DONE] markers.

Estimated code review effort: 2 (Simple) | ~10 minutes

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch chat-stream-crlf-714

Warning

Some tools did not complete. Review the errors below.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

src/utils/chat-stream.test.ts

typescript-eslint does not support TS 7.0.
Please see https://devblogs.microsoft.com/typescript/announcing-typescript-7-0/#running-side-by-side-with-typescript-6.0 to run typescript-eslint using the TS 6 API.
See also typescript-eslint/typescript-eslint#10940 for tracking typescript-eslint's support for TS >=7.1
typescript-eslint does not support TS 7.0.
Please see https://devblogs.microsoft.com/typescript/announcing-typescript-7-0/#running-side-by-side-with-typescript-6.0 to run typescript-eslint using the TS 6 API.
See also typescript-eslint/typescript-eslint#10940 for tracking typescript-eslint's support for TS >=7.1

Oops! Something went wrong! :(

ESLint: 10.9.1

Error: typescript-eslint does not support TS 7.0.
at Object. (/.eslint-tmp/node_modules/typescript-eslint/dist/index.js:52:11)
at Module._compile (node:internal/modules/cjs/loader:1830:14)
at Object..js (node:internal/modules/cjs/loader:1961:10)
at Module.load (node:internal/modules/cjs/loader:1553:32)
at Module._load (node:internal/modules/cjs/loader:1355:12)
at wrapModuleLoad (node:internal/modules/cjs/loader:255:19)
at loadCJSModuleWithModuleLoad (node:internal/modules/esm/translators:326:3)
at ModuleWrap. (node:internal/modules/esm/translators:231:7)
at ModuleJob.run (node:internal/modules/esm/module_job:437:25)
at async node:internal/modules/esm/loader:639:26

src/utils/chat-stream.ts

ESLint skipped: the matched ESLint configuration already failed (config-incompatibility).


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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@cloudflare-workers-and-pages

Copy link
Copy Markdown
Contributor

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
me 1f37e8b Commit Preview URL

Branch Preview URL
Aug 26 2026, 06:12 AM

@codecov

codecov Bot commented Aug 26, 2026

Copy link
Copy Markdown

Bundle Report

Changes will decrease total bundle size by 631.89kB (-54.67%) ⬇️. This is within the configured threshold ✅

Detailed changes
Bundle name Size Change
molecular-mars-esm 523.93kB -631.89kB (-54.67%) ⬇️

Affected Assets, Files, and Routes:

view changes for bundle: molecular-mars-esm

Assets Changed:

Asset Name Size Change Total Size Change (%)
_astro/page.ihickqos.js (New) 271.68kB 271.68kB 100.0% 🚀
_astro/PostHog.astro_astro_type_script_index_0_lang.DbXXK5-k.js (New) 240.64kB 240.64kB 100.0% 🚀
_astro/Chat.astro_astro_type_script_index_0_lang.CiUcweT0.js (New) 9.53kB 9.53kB 100.0% 🚀
_astro/hire-analytics.DTd3er4l.js (New) 924 bytes 924 bytes 100.0% 🚀
_astro/BaseLayout.astro_astro_type_script_index_0_lang.C2_snI7q.js (New) 598 bytes 598 bytes 100.0% 🚀
_astro/contact.astro_astro_type_script_index_0_lang.CnMtSOAX.js (New) 554 bytes 554 bytes 100.0% 🚀
chunks/whats-new_Cnhflfsh.mjs (Deleted) -291.28kB 0 bytes -100.0% 🗑️
chunks/entrypoints_CbomwsJO.mjs (Deleted) -180.98kB 0 bytes -100.0% 🗑️
chunks/traceData_m5kSU5GW.mjs (Deleted) -126.65kB 0 bytes -100.0% 🗑️
chunks/schemas_CNbP0tPB.mjs (Deleted) -126.52kB 0 bytes -100.0% 🗑️
chunks/server_Crqvi2zm.mjs (Deleted) -105.48kB 0 bytes -100.0% 🗑️
chunks/assets_BFv8F-Cd.mjs (Deleted) -56.36kB 0 bytes -100.0% 🗑️
chunks/render_BRwhDrdM.mjs (Deleted) -55.24kB 0 bytes -100.0% 🗑️
_astro/whats-new.B9Jsr0tS.css (Deleted) -39.06kB 0 bytes -100.0% 🗑️
chunks/shorthash_CgkW21_e.mjs (Deleted) -28.4kB 0 bytes -100.0% 🗑️
chunks/image-binding-transform_pV6rVmj0.mjs (Deleted) -24.19kB 0 bytes -100.0% 🗑️
chunks/_astro_data-layer-content_fLwBenlT.mjs (Deleted) -20.04kB 0 bytes -100.0% 🗑️
virtual_astro_middleware.mjs (Deleted) -15.63kB 0 bytes -100.0% 🗑️
chunks/parse_vZG9IMa5.mjs (Deleted) -15.01kB 0 bytes -100.0% 🗑️
entry.mjs (Deleted) -11.23kB 0 bytes -100.0% 🗑️
chunks/chat_bLd7fCVi.mjs (Deleted) -10.66kB 0 bytes -100.0% 🗑️
chunks/visits_DdWdf6-F.mjs (Deleted) -8.18kB 0 bytes -100.0% 🗑️
chunks/visitor-changelog_Dt_Wh4rx.mjs (Deleted) -6.92kB 0 bytes -100.0% 🗑️
chunks/github-releases_CeJyOB8m.mjs (Deleted) -6.52kB 0 bytes -100.0% 🗑️
chunks/release-summary_DHJNtj4E.mjs (Deleted) -4.91kB 0 bytes -100.0% 🗑️
chunks/release-summary_wDMU2AtM.mjs (Deleted) -4.88kB 0 bytes -100.0% 🗑️
chunks/_virtual_astro_session-driver_BmHQz7U4.mjs (Deleted) -3.47kB 0 bytes -100.0% 🗑️
chunks/static-image-collection_BlWN7aIT.mjs (Deleted) -2.85kB 0 bytes -100.0% 🗑️
chunks/releases_DqjTiWZh.mjs (Deleted) -2.54kB 0 bytes -100.0% 🗑️
chunks/image-transform-endpoint_CDVEl-5s.mjs (Deleted) -1.83kB 0 bytes -100.0% 🗑️
chunks/compiler_IjIsdyaq.mjs (Deleted) -1.77kB 0 bytes -100.0% 🗑️
chunks/consts_azRPwi2-.mjs (Deleted) -1.12kB 0 bytes -100.0% 🗑️
chunks/image-service-workerd_CkxsWx8D.mjs (Deleted) -960 bytes 0 bytes -100.0% 🗑️
chunks/rolldown-runtime_na-8-Chv.mjs (Deleted) -941 bytes 0 bytes -100.0% 🗑️
chunks/_virtual_astro_server-island-manifest_C2J14tGF.mjs (Deleted) -798 bytes 0 bytes -100.0% 🗑️
chunks/content-assets_C-fKfAP2.mjs (Deleted) -732 bytes 0 bytes -100.0% 🗑️
chunks/noop-entrypoint_BoOCWjpA.mjs (Deleted) -680 bytes 0 bytes -100.0% 🗑️

Files in _astro/Chat.astro_astro_type_script_index_0_lang.CiUcweT0.js:

  • ./src/utils/chat-stream.ts → Total Size: 2.45kB

@codecov

codecov Bot commented Aug 26, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 93.33333% with 1 line in your changes missing coverage. Please review.
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
src/utils/chat-stream.ts 93.33% 0 Missing and 1 partial ⚠️

📢 Thoughts on this report? Let us know!

@alehar9320
alehar9320 marked this pull request as ready for review August 26, 2026 06:22
@alehar9320
alehar9320 merged commit 6e43d52 into main Aug 26, 2026
16 checks passed
@qodo-code-review

Copy link
Copy Markdown

ⓘ Qodo reviews are paused because the subscription is no longer active. Ask your workspace admin to reactivate the subscription to resume reviews. Manage billing

This branch was successfully deployed

No deployments
chat-stream-crlf-714 - astro-cloudflare-personal-website-web-service PR #722 — 1f37e8b4 Deployed Aug 26, 2026 by alehar9320
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant