Repository navigation
fix(chat): stop blaming Lemonade when the model just answered empty - #5552
Conversation
After Stop, the next message got the stopped answer anyway: the model saw the stopped request with a blank reply, took it as still pending, and answered it before the new question. A stopped turn now reads to the model as withdrawn, and so does a turn cut off when GAIA closed. - History for in-process agents, relayed sidecars and Retry with... comes from model_context_messages, which replaces a "Cancelled." or cut-off reply with a short note saying it was stopped and not to continue it. - A turn stopped mid-answer records what it showed plus that note. - The footer of a stopped or cut-off bubble says "Stopped after 16 s" / "Interrupted after 16 s" instead of "Answered in 16 s".
A turn that ran tools and then wrote no answer ended on an empty bubble with no explanation, and the chat list showed it as done. Empty content is now kept only when a render card answered the turn; otherwise the turn ends failed with "GAIA ran its tools but didn't write an answer. Send your message again, or try another model." and keeps its tool steps.
A turn with no answer and no tool steps always told the user to make sure Lemonade Server was running, even when it was up and the model simply returned nothing (seen with Qwen3.5 4B and Gemma 4 E4B on a healthy server). The tail now asks Lemonade's /health first. Down or unhealthy: say so with the host's own start hint. Up but the model isn't loaded: say that. Up with the model loaded: report an empty model answer and suggest resending or switching models. Eval runs on Claude skip the probe.
|
Verdict: Approve with suggestions When a reply comes back empty, the Agent UI no longer tells the user to check that Lemonade is running. It now asks Lemonade's health endpoint and names the real cause: server down (with this machine's start hint), model not loaded, or the model simply returned nothing. The diff also includes the stacked #5543 work: stopped or cut-off replies are marked as withdrawn for the model, and their footer reads "Stopped after…" rather than "Answered in…". The logic is sound and well tested. Nothing blocks the merge. Worth a look before merging:
Real-world evidenceN/A: no evidence bundle was produced for this run. The verdict rests on static review and the PR's unit tests. The two manual Test-plan items (an empty reply with Lemonade up, and a message sent with Lemonade stopped) are unchecked, and the Agent UI before→after screenshot is still pending the strix-halo lane. 🔍 Technical details🟢 Minor
Strengths
|
… for sidecars An empty answer from a Lemonade that rejects GAIA's key (401/403) now says to check LEMONADE_API_KEY instead of telling the user to start a server that is already running. A reply stopped partway through now reads as withdrawn to a relayed sidecar too: the sidecar's history carries the stop note, including when the stopped turn itself was relayed and recorded no model messages. A test also keeps the Agent UI's copy of the cut-off notices in step with the backend.
|
All three review points are addressed, and CI is green. An empty reply from a Lemonade that rejects GAIA's key now says to check the key rather than to start the server. A reply stopped partway through now reads as withdrawn to sidecar agents too.
🔍 Technical details
|
amd#5543 landed on main as a squash, so its stacked commits conflicted. Kept this branch's health-checked empty-answer copy and sidecar stop note, kept main's parametrized notice drift test, and read the turn's model from result_holder now that main dropped session_model.
When a chat reply came back with no answer and no tool steps, the Agent UI always told the user to make sure Lemonade Server was running, even when Lemonade was up and the model had simply returned nothing (seen live with Qwen3.5 4B and Gemma 4 E4B on a working server). Now GAIA checks Lemonade's health before saying why. If the server is down, the message says so and how to start it on this machine. If the model isn't loaded, it says that. If everything is fine, it says the model returned an empty answer and suggests sending again or switching models.
Stacked on #5543. Merge that first; this PR then shows only its own commit.
Error classification changed, so watch the error_recovery eval category on the next RC.
Test plan
python -m pytest tests/unit/chat/ui/test_chat_helpers.py tests/unit/chat/ui/test_empty_answer_tail.py: covers server down, unhealthy (HTTP 503), up without the model, up with the model loaded,user.id matching, cloud model, and eval-on-Claude (no probe)python util/lint.py --black --isort --flake8lemonade-server serve🔍 Technical details
_empty_answer_backend_problem(async) reads/healththroughLemonadeManager.get_base_url()with auth headers. It runs only when the turn has no steps and wasn't cancelled.errorSSE, as before. Server fine →faileddone event with_EMPTY_MODEL_ANSWER_MSG, the same path as the tools-but-no-answer case.model_idis preferred over the session model for the loaded check. Cloud models skip that check.docs/guides/agent-ui.mdx.