Skip to content

fix: use floor_char_boundary to prevent UTF-8 panic on string truncation#37

Merged
enzoevn merged 1 commit intomasterfrom
fix/char-boundary-panic
Mar 20, 2026
Merged

fix: use floor_char_boundary to prevent UTF-8 panic on string truncation#37
enzoevn merged 1 commit intomasterfrom
fix/char-boundary-panic

Conversation

@enzoevn
Copy link
Contributor

@enzoevn enzoevn commented Mar 20, 2026

Summary

Fixed panics caused by slicing strings at non-char-boundary byte offsets. Uses floor_char_boundary() to find the nearest valid UTF-8 boundary.

Fixed in 4 locations:

  • stream.rs: tool result preview truncation (200 bytes)
  • executor.rs: approval notification (2000 bytes)
  • executor.rs: Discord message truncation (1900 bytes)
  • executor.rs: email context truncation (3000 bytes)

Test plan

  • 615 tests passing
  • Clippy + fmt clean
  • Reproduced with UTF-8 box-drawing characters (─) in tool output

@enzoevn enzoevn merged commit ac0b333 into master Mar 20, 2026
9 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.

1 participant