You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
rtk gain --history panics on non-ASCII (Cyrillic) text — byte index not on char boundary #2787
rtk gain --history crashes with a Rust panic when the analytics history
contains non-ASCII (e.g. Cyrillic) characters in a tracked command/path.
The panic happens at a fixed-width string truncation that slices by byte
offset instead of a UTF-8 char boundary.
Environment
rtk version: 0.43.0
OS: Windows 11 (10.0.26200), locale ru-RU
Shell: PowerShell 7.6.3
Hook: rtk hook claude (Claude Code native Windows hook)
Steps to reproduce
Have rtk track a command whose path contains Cyrillic characters,
e.g. rtk ls -la "D:\12 Claude\06 Ародинамический расчёт"
Run rtk gain --history
Actual behavior
thread 'main' (37432) panicked at src\analytics\gain.rs:250:54:
end byte index 22 is not a char boundary; it is inside 'Н' (bytes 21..23 of string)
Exit code 9.
Expected behavior
The history table should truncate long command/path strings on a UTF-8
char boundary (e.g. via .chars() or unicode-segmentation) instead of
raw byte slicing, so it doesn't panic on non-ASCII paths.
Additional notes
rtk gain (without --history) works fine — only the per-command
truncated display in --history crashes. Likely affects any locale/path
with multi-byte UTF-8 characters (Cyrillic, CJK, etc.), not just Russian.
Panic in src/analytics/gain.rs:250 when truncating strings by byte index instead of UTF-8 char boundary; fix by using .chars().take(n) instead of raw byte slice.
This looks like a simple fix that could be auto-resolved. Repo maintainers can use /wshm fix to attempt it.
📁 Relevant files
src/analytics/gain.rs
Triaged automatically by wshm · This is an automated analysis, not a human review.
Activity
pszymkowiak commentedon Jul 2, 2026
🔍 Automated Triage
bughighSummary
Panic in src/analytics/gain.rs:250 when truncating strings by byte index instead of UTF-8 char boundary; fix by using .chars().take(n) instead of raw byte slice.
📁 Relevant files
src/analytics/gain.rsTriaged automatically by wshm · This is an automated analysis, not a human review.
fix(analytics): truncate display strings on UTF-8 char boundaries
fix(analytics): truncate display strings on UTF-8 char boundaries
!15172 merge bump-rtk-0.44.0 into main