Repository navigation
fix(ui): surface provider-usage failures instead of silent empty panels - #120309
Conversation
|
Codex review: needs maintainer review before merge. Reviewed August 20, 2026, 7:15 PM ET / 23:15 UTC. ClawSweeper reviewWhat this changesThis PR makes the Usage and Model Providers Control UI pages show a retryable notice when the gateway's provider-usage request fails instead of treating the failure as an empty result. Merge readinessKeep open: current main still collapses rejected provider-usage requests into empty data, while this PR carries that failure as explicit state to both affected Control UI pages. The current-head real-Gateway capture addresses the prior proof request; the remaining work is ordinary merge-head refresh rather than a repair dispatch. Priority: P1 Review scores
Verification
Live VerificationCommand: Result: FAIL (partial) — step 2 Assertions:
How this fits togetherThe Control UI requests provider billing and quota data from the Gateway alongside session usage and model configuration. This change preserves a failed provider-usage request through the shared request boundary so each page can render an intentional unavailable state. flowchart LR
A[Gateway provider usage request] --> B[Shared request boundary]
B --> C{Answered or failed}
C -->|Usage data| D[Page data state]
C -->|Request failure| E[Unavailable state]
D --> F[Usage and Model Providers panels]
E --> F
Before merge
Agent review detailsSecurityNone. PR surfaceSource +50, Tests +519. Total +569 across 21 files. View PR surface stats
Review metrics
Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Keep one shared provider-usage outcome boundary, rebase it onto current main, and validate the warning and its clearing on both Control UI pages from the resulting merge head. Do we have a high-confidence way to reproduce the issue? Yes—source inspection gives a high-confidence path: reject usage.status while loading either Control UI page on current main, where both loaders reduce that rejection to null; the PR also supplies an exact-head real-Gateway demonstration. Is this the best way to solve the issue? Yes—the shared Result boundary is the narrowest maintainable fix because it records the failure at the RPC boundary and gives both views the same explicit state without conflating valid empty data. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against e78b9d3ce4aa. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (8 earlier review cycles)
|
…led usage requests as failed - Add providerUsageUnavailable to the five UsageRouteData fixtures in gateway-source-replacement.test.ts; check-test-types passes again. - requestProviderUsage reports failed only for non-cancelled rejections; an aborted request is the caller superseding its own load, not an outage. - Cover answered, failed, and cancelled outcomes.
|
@clawsweeper re-review |
|
🦞👀 Command router queued. I will update this comment with the next step. |
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. |
… fails - A failed aggregate refresh says nothing about provider usage; the stale flag no longer keeps claiming the last provider request failed after a later usage.cost or sessions.usage rejection. - Sequential regression: usage.status failure, then an aggregate failure, ends with the flag cleared.
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
The canonical Adding |
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
@sasan1200 Thanks—the canonical Please update Evidence for The existing browser tests mock the Gateway, and CI's real-Gateway lane currently exercises auth/Logs instead of these screens. |
|
@steipete done. thanks bro! |
|
Merged via squash.
|
…ls (openclaw#120309) * fix(ui): surface provider-usage failures instead of empty panels * fix(ui): complete typed route-data fixtures and stop reporting cancelled usage requests as failed - Add providerUsageUnavailable to the five UsageRouteData fixtures in gateway-source-replacement.test.ts; check-test-types passes again. - requestProviderUsage reports failed only for non-cancelled rejections; an aborted request is the caller superseding its own load, not an outage. - Cover answered, failed, and cancelled outcomes. * chore(ui): keep ProviderUsageFetch local to its module * fix(ui): clear the provider failure flag when an aggregate usage load fails - A failed aggregate refresh says nothing about provider usage; the stale flag no longer keeps claiming the last provider request failed after a later usage.cost or sessions.usage rejection. - Sequential regression: usage.status failure, then an aggregate failure, ends with the flag cleared. * test(ui): type the usage route data on the test element * test(ui): cover provider usage request outcomes * fix(ui): model provider usage request outcome * fix(ui): preserve provider usage outcomes * fix(ui): resolve provider usage build
Closes #120308
What Problem This Solves
Fixes an issue where operators could not tell a provider-usage outage from an
account with no usage data: all three Control UI consumers of
usage.statusreduced a failed request to
nullwith.catch(() => null)and rendered thesame empty state.
Why This Change Was Made
The request boundary records the fact where it happens:
requestProviderUsagein
ui/src/lib/provider-usage-request.tsreturns{ summary, failed }, andall three former
.catch(() => null)sites — the Usage page load, the Usageroute preloader, and the Model Providers loader — consume it. The Usage page
renders its provider section with a warning callout when the request failed
instead of hiding the section; the Model Providers list shows the same notice
above its cards. A null summary without
failedkeeps the existingempty-state rendering.
A cancelled request is not an outage: a rejection whose abort signal fired is
reported as not-failed, because both task hosts abort only through
supersession, which also discards the settled result. Reporting it as failed
would render the unavailable notice for every navigation that aborts an
in-flight load.
The flag is per-attempt state: a failed aggregate refresh says nothing about
provider usage, so the Usage page's error path clears it instead of letting a
stale flag keep claiming the last provider request failed after a later
usage.costorsessions.usagerejection.The five typed
UsageRouteDatafixtures inui/src/pages/gateway-source-replacement.test.tscarry the new requiredproviderUsageUnavailablefield, socheck-test-typespasses.User Impact
failed. Refresh to retry." instead of silently omitting the provider panel.
instead of empty usage cards with no explanation.
Evidence
ui/src/lib/provider-usage-request.test.tscovers the boundary: answered,failed, and cancelled outcomes; the cancelled case fails with the
classifier reverted.
ui/src/pages/model-providers/load.test.ts: a rejectedusage.statusyields
providerUsageFailed: truewith a null summary and no page-levelerror; a successful load yields
false.ui/src/pages/usage/view.test.ts: the provider section renders the warningcallout when the payload is marked unavailable, and stays hidden for plain
empty data.
ui/src/pages/model-providers/view.test.ts: the provider list renders thenotice when the loader recorded a failure.
pnpm check:test-typespasses at the head; fullui/src/pages/usage,ui/src/pages/model-providers,ui/src/lib, andui/src/pages/gateway-source-replacement.test.tssuites green;git diff --checkclean. The branch is merged with currentmain.ui/src/pages/usage/usage-page.test.tsruns the sequential case: ausage.status failure records the flag, then a later aggregate failure on
usage.costclears it; the test fails with the onError clear reverted.Real behavior proof was captured at exact current head
99984237b8b6f3517a11f32b83e6a4215a655213. Ephemeral gateway on anisolated state dir with token auth, provider HTTP stalled by a fetch wrapper,
the built Control UI served by that gateway, SPA navigation only:
The same sequence on
mainrenders silent empty usage cards with no notice.