Repository navigation
fix(ui): system status answers in bounded time and tells down from busy - #5344
Conversation
|
Verdict: Approve with suggestions The status endpoint now answers within a fixed 20-second budget instead of hanging for up to ~30 s, and it tells "nothing listening" apart from "busy". A new
Real-world evidenceN/A: no evidence bundle was produced for this run. The change is a backend HTTP route, and the PR body cites unit-test reproductions, not a live 🔍 Technical detailsIssues 🟢 Stale module docstring ( 🟢 🟢 Unneeded Checked and fine
Strengths
|
A connect timeout fell into the generic handler, so the Agent UI showed 'status unavailable' (busy) for a Lemonade that was not answering at all. And the status endpoint ran its health, catalog, stats and device probes one after another with only per-call timeouts, so a server that accepted connections but never answered held each request for up to half a minute. A connect timeout now reads as not running, like a refused connection; the Lemonade probes share a 20 s budget; and the new lemonade_probe field says how the probe ended (ok, down, timed_out, error).
…running When /health answered but the slower catalog, stats or device probes used up the status budget, the response said the server did not answer while also saying it was running. It now reports the server as running and the skipped details as a probe warning.
A connect timeout to a Lemonade on this machine means it is up but not accepting (a full accept queue, a wedged server), not stopped; telling the user to start it was wrong. Only a remote server's connect timeout reads as down. lemonade_probe is now a typed enum, and a healthy probe re-arms its warning.
The status endpoint's API doc now lists lemonade_probe and lemonade_error, since clients will switch on the probe result. The new test's docstring said every connect timeout reads as not running; a local one reads as busy. The budget monkeypatch no longer hides a future rename.
3e360eb to
fa1c50c
Compare
Before: when Lemonade didn't answer a connection in time, the Agent UI showed "status unavailable", as if the server were busy, when nothing was answering at all. A server that accepted the connection but never answered held every
/api/system/statusrequest for the sum of its probes' timeouts (up to about half a minute), so the UI's status poll piled up. After: a refused connection, or a connect timeout to a remote server, reads as "not running". A connect timeout to a Lemonade on this machine reads as busy: it's up, just not accepting, so the UI no longer tells you to start it. The probes share a 20-second budget, and a newlemonade_probefield says how the probe ended, so clients can tell "down" from "busy" from "error".Reproduced by
tests/unit/chat/ui/test_status_probe_bounds.py: on main, a connect timeout setslemonade_error, and a server that never answers holds the request for 30 s. Here it's "down" with no error, and answers in under 1 s withtimed_out.Asked for by the clients reliability work (#5316/#5317), which can now drop its 60-second client wait.
Test plan
pytest tests/unit/chat/ui tests/unit/test_model_server_info.py: all passnpx tsc --noEmitandnpx vitest runinsrc/gaia/apps/webuipython util/lint.py --black --isort --pylint --flake8 --test-lanes🔍 Technical details
system_statusmoved into a nested_probe_lemonade()and runs underasyncio.wait_for(..., _STATUS_PROBE_BUDGET_S=20). Fields it set before the budget ran out are kept.httpx.ConnectError→down, no error.ConnectTimeout→downfor a remote URL,timed_outwith an error for a loopback one (a wedged local server with a full accept queue times out the same way). Any otherhttpx.TimeoutException→timed_outplus an error. Anything else →error. A completed probe →ok, orerrorwhen Lemonade answered non-200.SystemStatus.lemonade_probeis new and optional, typedLiteral["ok","down","timed_out","error"]. If/healthanswered but the slower probes ran out of budget, it staysokwith a probe warning. The API schema and types are regenerated.