Skip to content

fix: preserve UTF-8 characters across SSE chunks - #30

Draft
Kayvan-Zahiri wants to merge 1 commit into
render-oss:mainfrom
Kayvan-Zahiri:codex/preserve-sse-utf8-chunks
Draft

Kayvan-Zahiri wants to merge 1 commit into
render-oss:mainfrom
Kayvan-Zahiri:codex/preserve-sse-utf8-chunks

Conversation

@Kayvan-Zahiri

Copy link
Copy Markdown

Task results containing raw UTF-8 text lose characters when a network byte chunk ends inside a multibyte character. SSEParser.feed decodes each chunk separately with errors="ignore", silently discarding the partial character and its continuation bytes. For example, café 中文 🚀 can arrive corrupted even though the SSE event and JSON are valid.

Keep one incremental UTF-8 decoder per parser so it retains partial characters between feeds. Preserve the existing error policy for malformed bytes. The parser is already shared by the synchronous and asynchronous stream APIs.

Validation: 34 public sync/async stream cases cover every split within the result and a one-byte-at-a-time stream (18 failed, 16 passed before; all pass after). Full offline suite: 510 passed, 12 live E2E tests deselected, four warnings. Ruff lint/format, mypy on SDK and typing tests/examples, generated sync parity, wheel/sdist builds and diff checks pass. Local Unix-socket tests required execution outside the restricted sandbox. No hosted Render API requests were made. Developed with AI assistance and verified locally.

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