Bug Report
Version: v0.0.7
File: src/cortex-cli/src/agent_cmd/handlers/list.rs
Description
When cortex agent list is run and any agent has a description longer than 38 bytes containing multi-byte UTF-8 characters (CJK, accented letters, emoji), the command panics with "byte index 35 is not a char boundary". The truncation logic at line 102 uses raw byte indexing instead of character-aware slicing.
Screenshot

Root Cause
// src/cortex-cli/src/agent_cmd/handlers/list.rs, lines 100-107
let desc = agent
.description
.as_ref()
.map(|d| {
if d.len() > 38 { // byte length check
format!("{}...", &d[..35]) // BYTE SLICE at index 35 → PANIC if mid-char
} else {
d.clone()
}
})
.unwrap_or_else(|| "-".to_string());
A description like "中文描述测试中文描述测试abc" (12 CJK chars × 3 bytes + 3 ASCII = 39 bytes) triggers the condition d.len() > 38, then &d[..35] slices at byte 35 which falls inside a multi-byte character.
Steps to Reproduce
# Create agent with CJK description (>38 bytes, <38 chars)
cat > ~/.cortex/agents/test-agent.toml << EOF
[agent]
name = "test-agent"
description = "中文描述测试中文描述测试abc"
EOF
cortex agent list
# PANIC: byte index 35 is not a char boundary
Expected Behavior
cortex agent list should display a truncated description like 中文描述测试中文描...
Fix
if d.chars().count() > 35 {
let truncated: String = d.chars().take(32).collect();
format!("{}...", truncated)
} else {
d.clone()
}
Hotkey: 5CzBkL6CJWFa7QSFoWxqiodobsGmxD6oLxLQa24tNxvsT9dn
UID: 137
Bug Report
Version: v0.0.7
File:
src/cortex-cli/src/agent_cmd/handlers/list.rsDescription
When
cortex agent listis run and any agent has a description longer than 38 bytes containing multi-byte UTF-8 characters (CJK, accented letters, emoji), the command panics with "byte index 35 is not a char boundary". The truncation logic at line 102 uses raw byte indexing instead of character-aware slicing.Screenshot
Root Cause
A description like
"中文描述测试中文描述测试abc"(12 CJK chars × 3 bytes + 3 ASCII = 39 bytes) triggers the conditiond.len() > 38, then&d[..35]slices at byte 35 which falls inside a multi-byte character.Steps to Reproduce
Expected Behavior
cortex agent listshould display a truncated description like中文描述测试中文描...Fix
Hotkey: 5CzBkL6CJWFa7QSFoWxqiodobsGmxD6oLxLQa24tNxvsT9dn
UID: 137