Session Closeout: Streaming Display Race Condition Fix (2026-05-07)

Context

Discord #requests response was cut off: the bot reply started mid-word with the entire beginning lost. Traced to an async race condition in streamingDisplay.js.

Root Cause

In _doEdit(), when freezing a message that exceeded 1800 chars, overflow was computed as a string snapshot before await. During the yield, append() calls added text to accumulatedText (new string via +=). After the yield, accumulatedText = overflow overwrote with the stale snapshot, silently discarding all text appended during the await.

Fix

Trim accumulatedText immediately before the first await (not after), so concurrent append() calls correctly extend the overflow portion. Applied to both _doEdit() and finalize().

Repos

  • centralDiscord: commit 12596ad, deployed to VM (claude-bot)

Duration

~15 minutes

Leave a Reply

Your email address will not be published. Required fields are marked *