Skip to content

[CLI] Chat ingest drops final version of streamed messages — responses render empty/"..." #2817

Backlog

Description

@PennybagsCX

Summary

Responses render as empty bubbles or a literal ... even though the full text exists in ui_messages.json. The final (non-partial) version of a streamed message is silently discarded by the chat ingest.

Cause

apps/cli/src/ui/hooks/useMessageHandlers.ts → handleSayMessage:

if (seenMessageIds.current.has(messageId) && !partial) { return }

When a message streams a partial first (attempt completions arrive as one late block, so the partial is empty), its id enters the seen-set. The finalized version then arrives under the same id and is dropped. The task record (ui_messages.json) contains the full say|completion_result text while the TUI shows none — this also explains reports of answers "only appearing in thinking".

Fix

On final-of-seen, correct the stored message in place instead of dropping:

updateMessage(messageId, text, false)
return

Partials should still fall through (store.addMessage debounces streaming updates).

Environment: macOS arm64, source build of a292226, CLI v0.1.17.


Solution (applied locally 2026-12-03)

Update — solved locally; here's the working fix.

Root cause confirmed: when a message streamed a partial first, its id entered the dedup set; the finalized full-text version arriving under the same id was then dropped, so completion_result text never reached the chat.

Fix in handleSayMessage:

if (seenMessageIds.current.has(messageId) && !partial) {
    // Final version of an already-streamed message: correct it in place
    updateMessage(messageId, text, false)
    return
}

Partials still fall through to store.addMessage (which debounces streaming updates), so live streaming is unaffected. Verified: full completion text now renders; transcript and TUI agree.

Note: pair with hiding empty assistant bubbles in ChatHistoryItem — and make sure any emptiness guard runs before the message.content || "..." placeholder default, otherwise the default converts empties to a literal "..." and bypasses the guard.
Happy to send a PR.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions