Skip to content

fix(ui): system status answers in bounded time and tells down from busy - #5344

Merged
kovtcharov-amd merged 4 commits into
amd:mainfrom
kovtcharov:claude/rel-ui-status-bound
Oct 19, 2026
Merged

kovtcharov-amd merged 4 commits into
amd:mainfrom
kovtcharov:claude/rel-ui-status-bound

Conversation

@kovtcharov

@kovtcharov kovtcharov commented Oct 18, 2026 •

Copy link
Copy Markdown
Contributor

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/status request 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 new lemonade_probe field 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 sets lemonade_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 with timed_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 pass
  • npx tsc --noEmit and npx vitest run in src/gaia/apps/webui
  • python util/lint.py --black --isort --pylint --flake8 --test-lanes
🔍 Technical details
  • The Lemonade probe block in system_status moved into a nested _probe_lemonade() and runs under asyncio.wait_for(..., _STATUS_PROBE_BUDGET_S=20). Fields it set before the budget ran out are kept.
  • httpx.ConnectError → down, no error. ConnectTimeout → down for a remote URL, timed_out with an error for a loopback one (a wedged local server with a full accept queue times out the same way). Any other httpx.TimeoutException → timed_out plus an error. Anything else → error. A completed probe → ok, or error when Lemonade answered non-200.
  • SystemStatus.lemonade_probe is new and optional, typed Literal["ok","down","timed_out","error"]. If /health answered but the slower probes ran out of budget, it stays ok with a probe warning. The API schema and types are regenerated.
  • Not LLM-affecting.

@github-actions github-actions Bot added the tests Test changes label Oct 18, 2026
@kovtcharov
kovtcharov marked this pull request as ready for review October 18, 2026 16:56
@github-actions

Copy link
Copy Markdown
Contributor

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 lemonade_probe field says which of the two happened. The exception ordering and the timeout handling are right, and the four new tests cover the down, busy-local, never-answers, and slow-extras cases. Nothing blocks the merge. Two small follow-ups:

Real-world evidence

N/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 GET /api/system/status request and response against a stopped or wedged Lemonade. This verdict rests on static review. I couldn't run the new tests here because pytest isn't installed in this runner. A captured request and response for the refused, local-timeout, and budget-exceeded cases would be the matching proof.

🔍 Technical details

Issues

🟢 Stale module docstring (tests/unit/chat/ui/test_status_probe_bounds.py:4-9). It says every connect timeout reads as "not running", but test_a_connect_timeout_to_a_local_server_reads_as_busy_not_stopped asserts the opposite for loopback.

"""/api/system/status answers in bounded time and says why Lemonade is unknown.

A refused connection, or a connect timeout to a remote server, reads as "not
running". A connect timeout to a local server reads as busy: it is up, just
not accepting. A server that accepts the connection but never finishes
answering no longer holds the endpoint for the sum of every probe's timeout.
"""

🟢 lemonade_probe undocumented (docs/sdk/sdks/agent-ui.mdx:316-326 and :448-463). Neither the SystemStatus model block nor the GET /api/system/status example lists it, or lemonade_error. Clients are expected to switch on it, so a line naming ok | down | timed_out | error is enough.

🟢 Unneeded raising=False (test_status_probe_bounds.py:81). _STATUS_PROBE_BUDGET_S exists, so raising=False would hide a future rename and the test would quietly run against the real 20 s budget. The next test already drops it.

    monkeypatch.setattr(system_mod, "_STATUS_PROBE_BUDGET_S", 0.5)

Checked and fine

  • httpx.ConnectTimeout is a TimeoutException, not a ConnectError, so the handler order (ConnectError → ConnectTimeout → TimeoutException → catch-all) sends each case to the right branch.
  • asyncio.TimeoutError from wait_for is caught on 3.10 as well as on 3.11+, where it aliases the builtin. httpx timeouts don't subclass it, so they can't land in the budget branch by mistake.
  • The budget (20 s) is larger than the health timeout (10 s), so a slow health answer is still classified by its own httpx exception, not by the budget.
  • When the budget runs out after health returned 200, the response keeps lemonade_running=True and adds a probe warning instead of reading as down. The "lemonade" warning is re-armed only on full success.

Strengths

  • Each commit pins its behaviour change with a test that fails on main.
  • Moving the probe into a nested coroutine keeps the existing per-probe handling unchanged and adds the overall bound in one place.
  • Treating a loopback connect timeout as busy, not stopped, prevents the UI from telling a user to start a server that's already running.

kovtcharov and others added 4 commits October 18, 2026 23:14
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.
@kovtcharov-amd
kovtcharov-amd force-pushed the claude/rel-ui-status-bound branch from 3e360eb to fa1c50c Compare October 19, 2026 06:15
@github-actions github-actions Bot added the documentation Documentation changes label Oct 19, 2026
@kovtcharov-amd
kovtcharov-amd added this pull request to the merge queue Oct 19, 2026
Merged via the queue into amd:main with commit 4bdeb86 Oct 19, 2026
46 of 48 checks passed
@kovtcharov-amd
kovtcharov-amd deleted the claude/rel-ui-status-bound branch October 19, 2026 08:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Documentation changes tests Test changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants