Skip to content

Keep chat answers through the markdown toggle and report chat_ready only when the engine can serve#533

Merged
tobocop2 merged 2 commits into
mainfrom
fix/markdown-toggle-blank
Jul 14, 2026
Merged

Keep chat answers through the markdown toggle and report chat_ready only when the engine can serve#533
tobocop2 merged 2 commits into
mainfrom
fix/markdown-toggle-blank

Conversation

@tobocop2

Copy link
Copy Markdown
Owner

Problem

Two readiness-and-rendering bugs observed live:

  1. In the TUI, toggling chat rendering with ctrl+r from Markdown to plain text and back blanked every assistant answer. The rebuilt Markdown widget was filled via update() before being mounted, and Textual's Markdown re-renders from its constructor argument on mount, which wiped the pre-mount update and left an empty bubble.

  2. On a fresh lilbee serve, /api/health reported chat_ready:true before any engine existed. RoutingProvider.role_ready returned True for native refs when no local engine had been built yet, so a client that gated on the flag and then POSTed /api/chat got a 503 from the backend while llama-swap was still coming up.

Solution

  1. Pass the accumulated answer text to the content widget's constructor instead of updating it pre-mount, so the mount lifecycle renders it. A regression test covers the plain-to-markdown round trip, and streaming into a plain-text message is pinned as literal content.

  2. role_ready is now positive readiness: a native ref with no local engine reports False instead of True. Health's chat_ready and chat_status become truthful during startup (loading, then ready), the RAG stream emits its warming notice when the engine is genuinely cold, the CLI announces cold starts, and the TUI's first prompt lands on its designed warm-wait path. Verified live: a fresh serve holds chat_ready:false while warming, and the first /api/chat sent the moment the flag flips returns a cited answer instead of 503.

tobocop2 added 2 commits July 14, 2026 01:00
Toggling ctrl+r to plain text and back blanked every assistant answer.
The rebuilt Markdown widget was filled via update() before mounting, and
Textual's Markdown re-renders from its constructor argument on mount,
which wiped the pre-mount update. Pass the accumulated text to the
widget constructor instead so the mount lifecycle renders it.
RoutingProvider.role_ready returned True for native refs when no local
engine had been built yet, so /api/health advertised chat_ready:true on
a fresh serve before anything could produce a token; a client that
gated on the flag then got a 503 from the backend on its first
/api/chat. Readiness is now positive: a native ref with no engine
reports False, which also routes the TUI's first prompt onto its
designed warm-wait path and lets the CLI announce the cold start.
@tobocop2
tobocop2 merged commit 6d398ed into main Jul 14, 2026
32 of 34 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant