#151 — BUG: Wrong persisted items order from LLM chat websocket response.

Repo: Twill-AI/facade State: closed | Status: done Assignee: Unassigned

Created: 2024-10-22 · Updated: 2025-09-15

Description

Steps to reproduce:

  1. In staging: Start a new conversation, or open up an existing conversation
  2. Prompt LLM with “show me a chart of my top 5 vendors”

Expected behavior: Expect websocket “done” status to come with persisted items that matches the order the LLM responded

Actual behavior: “Done” status changes the order, making text responses to always be first, table responses to be next, and chart responses to always be the last item. This changes the reply, and makes it unreadable.

Implementation details

“persisted_items” in WS message are returned as is, while in API they are always sorted by “created_at,desc”. Order here by db ID which is not always follows created_at. So fix is to sort items as API.

Notes

Add implementation notes, blockers, and context here

Add wikilinks to related people, meetings, or other tickets