Skip to content

Fix panic when context window falls on multibyte char boundary#748

Merged
jehna merged 2 commits into
mainfrom
claude/github-issue-747-6KtaP
May 27, 2026
Merged

Fix panic when context window falls on multibyte char boundary#748
jehna merged 2 commits into
mainfrom
claude/github-issue-747-6KtaP

Conversation

@jehna

@jehna jehna commented May 26, 2026

Copy link
Copy Markdown
Owner

compute_context_window sliced source[start..end] using byte offsets
derived from sym_start - half / sym_end + half, which can land in
the middle of a multibyte UTF-8 character (e.g. Cyrillic 'о').

Snap all computed indices to the nearest char boundary before slicing.

Fixes #747

claude added 2 commits May 26, 2026 04:43
`compute_context_window` sliced `source[start..end]` using byte offsets
derived from `sym_start - half` / `sym_end + half`, which can land in
the middle of a multibyte UTF-8 character (e.g. Cyrillic 'о').

Snap all computed indices to the nearest char boundary before slicing.

Fixes #747
@jehna jehna merged commit b3eb140 into main May 27, 2026
7 checks passed
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.

v3: Panic during string processing

2 participants