Skip to content

feat(chat): explain why a reply is stalled when the endpoint isn't ready#108

Open
michaelroy-amd wants to merge 2 commits into
fix/serve-ready-promotionfrom
feat/chat-readiness-reason
Open

feat(chat): explain why a reply is stalled when the endpoint isn't ready#108
michaelroy-amd wants to merge 2 commits into
fix/serve-ready-promotionfrom
feat/chat-readiness-reason

Conversation

@michaelroy-amd

Copy link
Copy Markdown
Member

Stacked on #101 (EAI-7352). Review/merge #101 first; this PR's base is fix/serve-ready-promotion, so its own diff is just the chat-readiness work.

Summary

Sending a message to a local endpoint whose model was still coming up showed only a generic ⠿ waiting for the agent… spinner — indistinguishable from a slow reply or an outright hang. The chat input never consulted the readiness of the instance it was pointed at.

Root Cause

crates/rocm-dash-tui/src/ui/tabs/chat.rs::draw_input() rendered a fixed "waiting for the agent…" line whenever chat_sending was set, regardless of whether the backing endpoint was actually up. The dashboard already tracks each managed instance's status in AppState.instances, but chat made no use of it.

Changes

  • draw_input() now matches the chat endpoint to its daemon-surfaced instance (by port parsed from the configured base_url) and, when that instance is not answering, replaces the generic spinner with a specific reason:
    • Starting → "the model is still starting up — hang tight"
    • Stopped → "the endpoint has stopped — restart the service to chat"
    • Error → "the endpoint reported an error — check the service logs"
  • A live (Running) instance, a remote gateway URL (no local instance to inspect), an unmatched port, or an Unknown state all fall back to the existing plain spinner — unchanged behavior.
  • Parsing and the reason mapping are pure, unit-tested helpers (port_from_base_url, chat_backend_wait_reason), so the render path stays thin.

Scope / Notes

Test Plan

  • cargo build -p rocm-dash-tui
  • cargo clippy -p rocm-dash-tui --all-targets --all-features -- -D warnings (clean)
  • cargo test -p rocm-dash-tui -- --test-threads=1 — 547 + 16 + 5 green, incl. new tests: port_from_base_url_parses_local_endpoints, backend_wait_reason_reflects_instance_status, sending_input_surfaces_startup_reason_not_generic_spinner, sending_input_falls_back_to_generic_spinner_for_remote_endpoint

Relates to EAI-7348

Sending a message to a local endpoint whose model was still coming up
showed only a generic "waiting for the agent…" spinner, indistinguishable
from a slow reply or a hang. The chat input never consulted the readiness
of the instance it was pointed at.

Match the chat endpoint to its daemon-surfaced instance by port and, when
that instance is not answering, replace the generic spinner with a
specific reason: the model is still starting up, the endpoint has stopped,
or it reported an error. A live instance, a remote gateway (no local
instance to inspect), or an unknown state falls back to the plain spinner
unchanged. Parsing and the reason mapping are pure, unit-tested helpers
(port_from_base_url, chat_backend_wait_reason).

Stacked on #101 (EAI-7352).

Relates to EAI-7348

Signed-off-by: Michael Roy <michael.roy@amd.com>
… alone

chat_backend_wait_reason matched the chat endpoint to a daemon-surfaced
instance by TCP port only. Daemon-tracked instances are always co-located
(scraped over loopback), but a remote gateway URL that happens to share a
port number with a local managed service -- e.g. both on 8000 -- would
false-match that unrelated local instance and could wrongly show a
"still starting up" reason for a perfectly healthy remote endpoint.

Add host_from_base_url and only attempt the match when the endpoint's host
is loopback (reusing llm::is_loopback_host, now pub(crate)); a non-loopback
host always falls back to the generic spinner regardless of port.

Added host_from_base_url unit tests and a
backend_wait_reason_ignores_remote_endpoint_sharing_a_local_port_number test
exercising the exact false-match scenario (remote host, same port as a
Starting local instance) to prove the generic spinner is kept.

Regenerated THIRD_PARTY_NOTICES.txt (pre-existing ordering drift, unrelated
to this change).

Relates to EAI-7348

Signed-off-by: Michael Roy <michael.roy@amd.com>
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