splitLongMessage slices line[i:end] on byte offsets (messageMaxLen = 4000 bytes). Any line ≥ 4001 bytes containing multi-byte UTF-8 cuts mid-rune (e.g. 1334 × '界': parts[0] ends on a lead byte, parts[1] starts with continuation bytes). finalize feeds these parts to EditMessageText, and on edit rejection the fallback re-splits the same content into the same invalid chunks — the authoritative reply arrives mangled or not at all for exactly the long, non-ASCII replies the split path exists to serve. All existing tests use ASCII input only.
Failure: a model produces a long answer with CJK/emoji or a base64 blob crossing a 4000-byte boundary; Telegram rejects the malformed part and the user gets the stale live frame plus a corrupted reply.
Design
Split on rune boundaries (iterate runes, accumulate up to messageMaxLen runes). Add a test with multi-byte input crossing the boundary asserting every part is valid UTF-8 and no part exceeds the bound.
Acceptance criteria
A long CJK/emoji/base64 reply splits into valid, bounded parts; test covers non-ASCII content crossing the boundary.
Close reason
Fixed in internal/channels/telegram/live.go and telegram.go: finalize/abandon strip context cancellation before sending (mirroring each other), ToolCall escapes Markdown metacharacters via bot.EscapeMarkdown, splitLongMessage splits on rune boundaries. All new/changed tests verified red-then-green; task check clean; adversarial review pass found no blocking issues.
Imported from beads archie-core-5efv · GitHub #482 · type bug · priority P1 · created 2026-08-14 · closed 2026-08-14
splitLongMessage slices line[i:end] on byte offsets (messageMaxLen = 4000 bytes). Any line ≥ 4001 bytes containing multi-byte UTF-8 cuts mid-rune (e.g. 1334 × '界': parts[0] ends on a lead byte, parts[1] starts with continuation bytes). finalize feeds these parts to EditMessageText, and on edit rejection the fallback re-splits the same content into the same invalid chunks — the authoritative reply arrives mangled or not at all for exactly the long, non-ASCII replies the split path exists to serve. All existing tests use ASCII input only.
Failure: a model produces a long answer with CJK/emoji or a base64 blob crossing a 4000-byte boundary; Telegram rejects the malformed part and the user gets the stale live frame plus a corrupted reply.
### Design
Split on rune boundaries (iterate runes, accumulate up to messageMaxLen runes). Add a test with multi-byte input crossing the boundary asserting every part is valid UTF-8 and no part exceeds the bound.
### Acceptance criteria
A long CJK/emoji/base64 reply splits into valid, bounded parts; test covers non-ASCII content crossing the boundary.
### Close reason
Fixed in internal/channels/telegram/live.go and telegram.go: finalize/abandon strip context cancellation before sending (mirroring each other), ToolCall escapes Markdown metacharacters via bot.EscapeMarkdown, splitLongMessage splits on rune boundaries. All new/changed tests verified red-then-green; task check clean; adversarial review pass found no blocking issues.
---
_Imported from beads `archie-core-5efv` · GitHub #482 · type bug · priority P1 · created 2026-08-14 · closed 2026-08-14_
sam
added the highbug labels 2026-10-27 13:38:57 +00:00
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
splitLongMessage slices line[i:end] on byte offsets (messageMaxLen = 4000 bytes). Any line ≥ 4001 bytes containing multi-byte UTF-8 cuts mid-rune (e.g. 1334 × '界': parts[0] ends on a lead byte, parts[1] starts with continuation bytes). finalize feeds these parts to EditMessageText, and on edit rejection the fallback re-splits the same content into the same invalid chunks — the authoritative reply arrives mangled or not at all for exactly the long, non-ASCII replies the split path exists to serve. All existing tests use ASCII input only.
Failure: a model produces a long answer with CJK/emoji or a base64 blob crossing a 4000-byte boundary; Telegram rejects the malformed part and the user gets the stale live frame plus a corrupted reply.
Design
Split on rune boundaries (iterate runes, accumulate up to messageMaxLen runes). Add a test with multi-byte input crossing the boundary asserting every part is valid UTF-8 and no part exceeds the bound.
Acceptance criteria
A long CJK/emoji/base64 reply splits into valid, bounded parts; test covers non-ASCII content crossing the boundary.
Close reason
Fixed in internal/channels/telegram/live.go and telegram.go: finalize/abandon strip context cancellation before sending (mirroring each other), ToolCall escapes Markdown metacharacters via bot.EscapeMarkdown, splitLongMessage splits on rune boundaries. All new/changed tests verified red-then-green; task check clean; adversarial review pass found no blocking issues.
Imported from beads
archie-core-5efv· GitHub #482 · type bug · priority P1 · created 2026-08-14 · closed 2026-08-14