Skip to content

fix(providers): carry incomplete UTF-8 across OpenRouter stream chunks - #236

Merged
sulthannauval merged 1 commit into
mainfrom
advisor/004-openrouter-stream-utf8-boundary
Jul 18, 2026
Merged

fix(providers): carry incomplete UTF-8 across OpenRouter stream chunks#236
sulthannauval merged 1 commit into
mainfrom
advisor/004-openrouter-stream-utf8-boundary

Conversation

@sulthannauval

Copy link
Copy Markdown
Member

Part of the /improve advisor batch (plan plans/004-*.md, 2026-07-18).

Follow-up: same-class bug in compatible.rs is fixed by the #23 PR.

Verification: scoped tests + fmt + clippy-delta clean per-branch; integrated locally with the other branches (integration/all) — compiles and full lib tests green except two pre-existing non-hermetic tests unrelated to this change.

Rollback: revert this PR.

…oss chunks

chat_stream decoded each network chunk independently with
std::str::from_utf8(&bytes)?, which errors and ends the stream whenever a
multi-byte UTF-8 codepoint (emoji, CJK, accented Latin, em-dash) straddles
a chunk boundary. Carry incomplete trailing bytes forward in a pending
buffer and decode only the longest valid UTF-8 prefix per chunk, flushing
any leftover tail lossily at stream end.
@github-actions

Copy link
Copy Markdown

PR intake checks found warnings (non-blocking)

Fast safe checks found advisory issues. CI lint/test/build gates still enforce merge quality.

  • Missing required PR template sections: ## Summary, ## Validation Evidence (required), ## Security Impact (required), ## Privacy and Data Hygiene (required), ## Rollback Plan (required)
  • Incomplete required PR template fields: summary problem, summary why it matters, summary what changed, validation commands, security risk/mitigation, privacy status, rollback plan

Action items:

  1. Complete required PR template sections/fields.
  2. Remove tabs, trailing whitespace, and merge conflict markers from added lines.
  3. Re-run local checks before pushing:
    • ./scripts/ci/rust_quality_gate.sh
    • ./scripts/ci/rust_strict_delta_gate.sh
    • ./scripts/ci/docs_quality_gate.sh

Run logs: https://github.com/RantAI-dev/RantAIClaw/actions/runs/29653860460

Detected blocking line issues (sample):

  • none

Detected advisory line issues (sample):

  • none

@github-actions github-actions Bot added provider Auto scope: src/providers/** changed. size: S Auto size: 81-250 non-doc changed lines. risk: medium Auto risk: src/** or dependency/config changes. distinguished contributor Contributor with 50+ merged PRs. provider: openrouter Auto module: provider/openrouter changed. and removed provider Auto scope: src/providers/** changed. labels Jul 18, 2026
@sulthannauval
sulthannauval merged commit ecd186a into main Jul 18, 2026
17 checks passed
@sulthannauval
sulthannauval deleted the advisor/004-openrouter-stream-utf8-boundary branch July 18, 2026 19:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

distinguished contributor Contributor with 50+ merged PRs. provider: openrouter Auto module: provider/openrouter changed. risk: medium Auto risk: src/** or dependency/config changes. size: S Auto size: 81-250 non-doc changed lines.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant