Tidy Usage page and recover from disconnected gateway - #508
Conversation
Layout: - Drop the emoji from the page title (no emoji on WinUI surfaces per openclaw-design skill); update en-us/fr-fr/nl-nl/zh-cn/zh-tw resw. - Switch 3 stat cards from horizontal StackPanel to a 3-column Grid with equal widths so they share available width cleanly. - Replace raw FontSize/FontWeight with Fluent typography styles (TitleLarge for the hero Total Cost, Subtitle for the small stats) per winuxe Critical Rule #4 — also gives the page proper hierarchy. Bug fix (page not loading / no values): - OpenClawGatewayClient.RequestUsageAsync/CostAsync/StatusAsync silently no-op when !IsConnectedToGateway, so navigating while the gateway was reconnecting left the progress rings spinning forever. - Treat (client == null || !client.IsConnectedToGateway) as disconnected in Initialize and SelectPeriod. - Subscribe to client.StatusChanged so the page self-heals when the gateway comes online later (re-fires the three requests on the UI thread). Unsubscribe in Unloaded. - After Fail() the loading state is !IsRefreshing && !HasLoaded, which hid loading + content + empty all at once. Surface a 'Couldn't load. Check your gateway connection.' message in that state. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
Codex review: needs real behavior proof before merge. Latest ClawSweeper review: 2026-05-22 22:19 UTC / May 22, 2026, 6:19 PM ET. Workflow note: Future ClawSweeper reviews update this same comment in place. How this review workflow works
Summary Reproducibility: yes. by source inspection: current main can enter Usage with a non-null but disconnected GatewayClient, while RequestUsageAsync returns early when the WebSocket is not connected. I did not run the WinUI app, so this is source-reproducible rather than runtime-reproduced. PR rating Rank-up moves:
What the crustacean ranks mean
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics. Real behavior proof Mantis proof suggestion Risk before merge
Maintainer options:
Next step before merge Security Review findings
Review detailsBest possible solution: Route Usage refresh through the connection manager/AppState so client swaps and status changes both reload the selected period, keep all visible strings resource-backed, and require proof of the offline-to-reconnected Usage flow. Do we have a high-confidence way to reproduce the issue? Yes by source inspection: current main can enter Usage with a non-null but disconnected GatewayClient, while RequestUsageAsync returns early when the WebSocket is not connected. I did not run the WinUI app, so this is source-reproducible rather than runtime-reproduced. Is this the best way to solve the issue? No. The branch points in the right direction, but the maintainable fix needs to avoid the implicit 30-day response race, observe operator-client replacement, and use localized resources for new visible text. Label changes:
Label justifications:
Full review comments:
Overall correctness: patch is incorrect What I checked:
Likely related people:
Codex review notes: model gpt-5.5, reasoning high; reviewed against 8560086ebeae. |
|
ClawSweeper PR egg 🎁 Pass real behavior proof to wake the egg and unlock a hatchable treat. Where did the egg go?
|
The Usage page fires two usage.cost requests per refresh: one indirectly via RequestUsageAsync() (always days=30) and one directly via the period selector (default 7). UpdateUsageCost rejected any response where cost.Days != _currentPeriodDays, so when the gateway only replied to one of the two -- or didn't honor the days request param -- valid data was silently thrown away and the Daily Cost spinner ran forever. Now: - Accept any usage.cost response and apply its data. - If cost.Days is a valid selector value (7 or 30) but doesn't match the user's current pick, silently snap the SelectorBar to that period so the header isn't lying about what data is on screen. - Clear ConnectionInfoBar on a successful UpdateUsageCost/UsageStatus so late replies after a disconnect recover the UI. - Remove the hardcoded 284.5K fake value from TokenCountText: it had x:Uid='TokenCountText' bound to a resw entry that hardcoded '284.5K' across all five locales, masking the real loading bug by making it look like Tokens had populated when no usage.cost reply ever arrived. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Summary
Cleans up the Usage page and fixes the "page not loading / no values" report.
Layout (openclaw-design + winuxe)
StackPanelto a 3-columnGrid(equal widths) so they share available width cleanly.FontSize/FontWeightwith Fluent typography styles (TitleLargeTextBlockStylefor the hero Total Cost,SubtitleTextBlockStylefor the small stats) per winuxe Critical Rule Fix WinUI tray menu crash with invisible anchor window pattern #4.MaxWidth=900to match Permissions/Connection/Settings.Bug fix: page not loading
Root cause:
OpenClawGatewayClient.RequestUsage*calls silently no-op when!IsConnectedToGateway. Navigating while the WebSocket was reconnecting left the progress rings spinning forever and afterFail()the visual helpers hid loading, content, and empty — leaving completely blank cards.client == null || !client.IsConnectedToGatewayas disconnected inInitializeandSelectPeriod.client.StatusChangedso the page self-heals when the gateway comes online later (re-fires the three requests on the UI thread); unsubscribe inUnloaded.Validation
./build.ps1✅