fix(ui): run /ask off the request path so the composer clears immediately (LC-676) #638
Loading…
Reference in a new issue
No description provided.
Delete branch "fix/LC-676-ask-async-composer"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Follow-up to LC-676 (the composer half). This is a SINGLE-commit PR so it can't lose a trailing commit like #636/#637 did.
Why a new PR
The async-ask commit (
483646b) was pushed onto the #637 branch, but #637 was merged at its first commit (87befc8, the retrieval fix) before the async commit was picked up - the same drop that happened to #636. So the retrieval fix landed but the composer fix did not. Cherry-picked here as its own commit.Symptom (1.png, 2.png)
After sending
/ask ..., the composer keeps the typed text and the slash argument-hint stays up - for the whole answer duration - and the "The assistant is thinking..." placeholder shows in the meantime.Root cause
handle_askposted the placeholder and then ran the LLM synchronously, holding the/askPOST open for the whole multi-second local-model answer. The composer clears its text and dismisses the slash hint on the POST's return, so both hung until the answer resolved.Fix
handle_asknow posts the placeholder and returns immediately, running retrieval + the LLM in a spawned task that replaces the placeholder body in place when ready./askanswers with a fast 204 - the composer clears its text and slash hint at once - and the assistant works in the background (the placeholder is still the instant loading feedback). A failed answer resolves the placeholder to a friendly italic note instead of leaving "thinking..." forever (build_ask_answernever fails).Tests
routes_assistantnow polls for the async answer and still asserts one message (placeholder edited in place), the quiet quote, and no leftover "thinking". routes_assistant, fmt, clippy green.🤖 Generated with Claude Code
https://claude.ai/code/session_013pGppokMfgq5W46EY2Takg