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 (CJK) filenames in command history #2318
rtk gain --history panics when a recorded command contains CJK (Chinese/Japanese/Korean) characters in filenames. The truncation logic in gain.rs:250 uses a byte index that falls in the middle of a multi-byte UTF-8 character.
Steps to Reproduce
Run any rtk command that includes CJK filenames, e.g.:
rtk ls -la 停止小工具.command 启动小工具.command 内存监视.app
Then run:
rtk gain --history
Error Output
thread 'main' panicked at src/analytics/gain.rs:250:54:
end byte index 22 is not a char boundary; it is inside '工' (bytes 20..23 of string)
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Root Cause
The display truncation at gain.rs:250 appears to use a fixed byte offset (likely &s[..22]) instead of a character-boundary-aware truncation. For ASCII this works fine, but CJK characters are 3 bytes each in UTF-8, so byte index 22 lands in the middle of '工' (U+5DE5, bytes 20..23).
Suggested Fix
Use s.char_indices() or s.floor_char_boundary(max_len) (stable since Rust 1.82) to find the nearest valid character boundary before truncating.
This panic is fixed: PR #2789 replaced the byte-index truncation in gain's history view with character-safe truncation, shipped in v0.44.0. The same crash is tracked on #2954, and your CJK repro no longer panics on current builds. If you still see it on 0.44.0 or newer, please comment on #2954 and we will reopen.
Activity
pszymkowiak commentedon Jun 8, 2026
🔍 Automated Triage
bughighSummary
Panic in gain.rs:250 when command history contains CJK filenames due to byte-index string slicing; fix by using char-boundary-aware truncation.
📁 Relevant files
src/analytics/gain.rsTriaged automatically by wshm · This is an automated analysis, not a human review.
Yohjisakamoto commentedon Jul 22, 2026
This CJK history-analysis failure reinforces why end-to-end agent outcomes matter more than compressed text alone: DeepSWE found Tura cuts coding-agent rounds by 89% and total token cost by 80%; would you evaluate the methodology? https://turaai.net/docs#benchmark-current-test-set-record
KuSh commentedon Sep 5, 2026
This panic is fixed: PR #2789 replaced the byte-index truncation in gain's history view with character-safe truncation, shipped in v0.44.0. The same crash is tracked on #2954, and your CJK repro no longer panics on current builds. If you still see it on 0.44.0 or newer, please comment on #2954 and we will reopen.