Follow-ups ignore the current chat, and prompt history is unordered #84

Closed
opened 2026-10-25 05:55:20 -07:00 by westfarn · 1 comment
Owner

What happens

Follow-ups in the same chat ignore the previous turn.

  1. Ask for a stroller/carrier. The answer lists specific products. Ask to put that list in a table with prices and ratings. The reply says it does not have the list in the sources, and does not use the products it just named.
  2. Ask for a joke. Ask "I don't know, why?". The reply searches the web and answers from an unrelated page about form error messages, with a citation, instead of explaining the joke.

The activity panel shows "Searching the web" on the joke follow-up.

Why

  • use_conversation_context defaults to false, so AsyncLLMService sends an empty history. The live turn is only the latest sentence plus web sources.
  • Grounded instructions say to answer only from live sources, so a follow-up cannot reuse the previous answer even when history is present.
  • The grounding decider sees only the latest sentence. "I don't know, why?" is treated as a new lookup.
  • Prompt rows for a conversation are loaded with no order_by (get_messages in both consumers, ConversationDetailView). History can be assembled out of chronological order, and clean[:-1] then drops the wrong turn.

Fix

  • Default same-chat history on, and turn it on for existing accounts. The account toggle stays an opt-out.
  • Always load conversation prompts oldest-first (created, then id).
  • Drop the current user turn from history by matching its text, not by assuming it is the last row.
  • Let grounded answers use the conversation for follow-ups. Cite sources only for facts that come from them. Do not claim the previous list is missing when it is already in the thread.
  • Skip web retrieval for a pure follow-up ("I don't know, why?") when the thread already has prior turns. Still search when the follow-up asks for a new external fact such as price or rating.

Display order of the bubbles is the matching chat_web_app ticket.

## What happens Follow-ups in the same chat ignore the previous turn. 1. Ask for a stroller/carrier. The answer lists specific products. Ask to put that list in a table with prices and ratings. The reply says it does not have the list in the sources, and does not use the products it just named. 2. Ask for a joke. Ask "I don't know, why?". The reply searches the web and answers from an unrelated page about form error messages, with a citation, instead of explaining the joke. The activity panel shows "Searching the web" on the joke follow-up. ## Why - `use_conversation_context` defaults to false, so `AsyncLLMService` sends an empty history. The live turn is only the latest sentence plus web sources. - Grounded instructions say to answer only from live sources, so a follow-up cannot reuse the previous answer even when history is present. - The grounding decider sees only the latest sentence. "I don't know, why?" is treated as a new lookup. - `Prompt` rows for a conversation are loaded with no `order_by` (`get_messages` in both consumers, `ConversationDetailView`). History can be assembled out of chronological order, and `clean[:-1]` then drops the wrong turn. ## Fix - Default same-chat history on, and turn it on for existing accounts. The account toggle stays an opt-out. - Always load conversation prompts oldest-first (`created`, then `id`). - Drop the current user turn from history by matching its text, not by assuming it is the last row. - Let grounded answers use the conversation for follow-ups. Cite sources only for facts that come from them. Do not claim the previous list is missing when it is already in the thread. - Skip web retrieval for a pure follow-up ("I don't know, why?") when the thread already has prior turns. Still search when the follow-up asks for a new external fact such as price or rating. Display order of the bubbles is the matching `chat_web_app` ticket.
Author
Owner

Display-order half of this bug is chat_web_app#136.

Display-order half of this bug is chat_web_app#136.
Sign in to join this conversation.
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: ai_ml_operations/chat_backend#84