mirror of
https://github.com/openclaw/openclaw.git
synced 2026-03-12 07:20:45 +00:00
When an agent streams text and then immediately runs tool calls, the webchat UI drops the streamed content: the "final" event arrives with message: undefined (buffer consumed by sub-run), and the client clears chatStream without saving it to chatMessages. Before clearing chatStream on a "final" event, check whether the stream buffer has content. If no finalMessage was provided but the stream is non-empty, synthesize an assistant message from the buffered text — mirroring the existing "aborted" handler's preservation logic. Closes #31895