fix(timeline): four correctness bugs in the message body - #281
Merged
Conversation
`MAX_DESCRIPTION_LENGTH` counts bytes and the slice cut at a fixed byte offset,
so any description longer than the limit panicked whenever byte 177 landed
inside a multi-byte character:
&description[..(MAX_DESCRIPTION_LENGTH - 3)]
Pure CJK happens to survive — 177 is divisible by 3, so it always lands on a
boundary — but text mixing CJK with ASCII does not: sampling 200 such strings,
57% cut mid-character and would have taken the process down as soon as the
preview scrolled into view.
Truncate by characters instead. Tests cover a mixed-script string (asserting the
old byte offset was *not* a char boundary, so the case cannot silently stop
being a regression test), CJK, emoji, and the short-string passthrough.
Latent rather than live on a homeserver that refuses previews — matrix.palpo.im
answers 403 for every URL, so `description` is never populated there.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…n kinds Three defects in the message body, all reachable in a normal agent-chat room. **Folding fought the stream.** A streaming reply's body grows every frame, so the moment it crossed the fold threshold it collapsed to three lines and took the typewriter cursor with it — the reply read as having stalled, mid-sentence. `populate_bot_text_message_content` now takes `is_streaming` and suppresses both the fold and its toggle until the message settles. (Regression from #274, which added folding without exempting the streaming call site.) **A recycled slot kept the previous bot card.** Those two visibilities are only written by the bot text path, but the PortalList hands the same `Message` template to the server-notice and unsupported/redacted paths too. A slot that had held a bot reply therefore kept drawing that reply's card while the new content sat hidden underneath — a redaction would still show the text it was meant to remove. Both paths now call `reset_bot_message_card` first; the helper says why any future branch rendering into `content.message` must do the same. **The fold toggle turned white when clicked.** `SmallStateGroupToggleButton` defines color/hover/down but no focus colour, and the toggle only overrode `color`, so clicking it left the label on an undefined focus value until an unrelated redraw reset it. All four widgets added in #274 — the toggle and the permalink link, in both the Message and CondensedMessage templates — now spell out every state. The permalink link had the same gap and is fixed alongside, rather than waiting for someone to hover it. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Caught by the `typos` CI gate. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This was referenced Jul 31, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Four defects, all reachable in a normal agent-chat room. Two of them arrived with #274; this is the follow-up that was deliberately kept out of the colour-only PR (#276).
Folding fought the stream
A streaming reply's body grows on every frame, so the moment it crossed the fold threshold it collapsed to three lines and took the typewriter cursor with it. Mid-sentence, the reply read as having stalled.
populate_bot_text_message_contentnow takesis_streamingand suppresses both the fold and its toggle until the message settles. Regression from #274, which added folding without exempting the streaming call site.A recycled slot kept the previous bot card
content.bot_message_card/content.messagevisibility is only ever written by the bot text path — butlist.item_with_existed(cx, item_id, id!(Message))hands the same template to the server-notice and unsupported/redacted paths as well.So a slot that had held a bot reply kept drawing that reply's card while the new content sat hidden underneath it. A redaction would still show the text it was supposed to remove.
Both paths now call
reset_bot_message_cardfirst. The helper's doc comment records why any future branch rendering intocontent.messagehas to do the same — the constraint is invisible at the call site otherwise.The fold toggle turned white when clicked
SmallStateGroupToggleButtondefinescolor/color_hover/color_downbut no focus colour, and the toggle overrode onlycolor. Clicking it left the label on an undefined focus value — white on a white card — until an unrelated redraw reset it. Scrolling away and back "fixed" it, which is what made it look intermittent.All four widgets #274 added — the toggle and the permalink link, in both the
MessageandCondensedMessagetemplates — now spell out every state. The permalink link had the identical gap and is fixed here rather than waiting for someone to hover it.Description truncation panicked on mixed scripts
MAX_DESCRIPTION_LENGTHcounts bytes, so this cut at a fixed byte offset and panicked whenever byte 177 landed inside a multi-byte character. Pure CJK survives by luck — 177 is divisible by 3, so it always lands on a boundary — but mixed CJK/ASCII does not: of 200 sampled strings, 57% cut mid-character and would have taken the process down as the preview scrolled into view.Now truncates by characters. Latent rather than live on a homeserver that refuses previews (matrix.palpo.im answers 403 for every URL, so
descriptionis never populated), which is why it had not been hit yet.Testing
cargo test --lib --features agent_chat— 589 pass, including 3 new truncation tests. One asserts the old byte offset was not a char boundary for its input, so that case cannot quietly stop being a regression test.Exercised against a live agent-chat room: streamed a long reply and confirmed it no longer collapses mid-flight, the toggle keeps its colour through click and hover, and a redaction in a room with bot replies renders the redaction rather than the previous card. Also confirmed from the app log that no
RBX_*property fails to resolve — the failure mode thatcargo checkcannot see.🤖 Generated with Claude Code