Repository navigation
feat: screens that stay current without polling, and a menu bar that shows what is running - #105
Merged
Merged
Conversation
…shows what is running An audit of every live-updating screen found one timed poll that core already pushes for, several screens that never changed once open, events the app ignored, and a push channel that could lose events silently. Core v0.25.0 (ThinkWatch-Core#102) adds what was missing on its side; this uses it. Lost events - core now tells a subscriber that fell behind (events_dropped), and the Rust bridge sends the same marker when it reconnects after a drop. useRequests takes the in-flight snapshot again and re-reads the history; a row still "in progress" that the history already has gets its ending from the stored row (mergeHistory), so a lost ending no longer leaves a row running forever. useLive resyncs its in-progress count and refills the chart, every useCoreEvent page refreshes, and App re-reads the overview. Polling replaced - The Upstreams page stops asking every 30 s. Quota comes straight from quota_seen; the 24-hour requests, cost and TTFB are re-read after requests land and when the window regains focus. - Quota resets are moments (resets_at_ms), and countdowns are recomputed locally as time passes. A window whose reset has passed is no longer shown as current, in the table, the ChatGPT account section and the menu bar. Screens that did not update - Opening a request that is still running shows what is known so far and follows it; the row is complete once its priced event arrives, which core sends in the same lock as the database write. Replay, content and usage say they are available when the request ends. - An open session refreshes as its requests land; the Keys page's last used and 24-hour usage follow requests; the MCP page rescans on scan_alert and clients_changed. - The Upstreams table shows a rejected credential and a needed sign-in, and the proxy table shows the failure the gateway found, whichever of that and a manual test is newer. The overview is re-read on auth_changed, proxy_changed, credential_expired and the first quota report for an upstream. - The traffic list takes the upstream from request_routed, so a request that failed over is attributed to the upstream that served it. Rust side - The menu bar's second line shows the requests in progress and the output rate (tokens per second of generation, over requests finished in the last minute) instead of hard-coded blanks; both are counted from events, and ticks recompute them without asking core. - A core binary that cannot run is a state (failed:<reason>) with the reason and a retry, instead of "starting" forever, plus a critical notice. A wedged core that was replaced leaves an in-app notice. The first autostart hint is a system notification that respects the notice mode; before, it went to a webview that is never open at login. - Tauri events nobody listened to are gone: core-restarting, core-safe-mode, core-failed, core-wedged, app-exiting, first-autostart. Pin core v0.25.0 (control API 8). Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
An audit of every screen that shows live data found:
request_routed, so a request that failed over stayed attributed to the upstream that failed;Core v0.25.0 (ThinkWatchProject/ThinkWatch-Core#102) adds what was missing on its side:
EventsDropped, quota reset times as moments, the current credential and proxy state in the overview, and details of a request still running. This PR uses them.What changed
Lost events. Core tells a subscriber that fell behind, and the Rust bridge sends the same
events_droppedmarker after it reconnects.useRequeststakes the in-flight snapshot again and re-reads the history; a row still in progress that the history already has gets its ending from the stored row (mergeHistory).useLiveresyncs its count and refills the chart, everyuseCoreEventpage refreshes, and App re-reads the overview (now coalesced, so a burst of triggers reads once).Polling replaced. The Upstreams page takes quota straight from
quota_seenand re-reads the 24-hour requests, cost and TTFB after requests land and when the window regains focus. Reset countdowns are computed locally fromresets_at_ms(resetAt,useNow); a window whose reset has passed is no longer shown as current, in the table, the ChatGPT account section and the menu bar.Screens that did not update.
scan_alert/clients_changed.auth_changed,proxy_changed,credential_expired, and the first quota report for an upstream.request_routed.Rust side.
N ▶) and the output rate (tokens per second of generation over requests finished in the last minute) are counted from events in a newtallymodule. While a countdown or a rate is shown, a 10 s tick recomputes them without asking core.failed:<reason>, with the reason, a retry button, and a critical notice. Before, the app showed "starting" forever.announce), and it respects the notice mode. It used to be emitted to a webview that is never open at login.core-restarting,core-safe-mode,core-failed,core-wedged,app-exiting,first-autostart.Pins core v0.25.0 (control API 8).
Test plan
pnpm typecheckpnpm test: 197 passed. New:resetAt,request_routedmoving the upstream,mergeHistoryending a row whose ending was lostcargo fmt --check,cargo clippy -- -D warnings,cargo testonsrc-tauri: 118 passed. New: thetallycount and rate (incl. a resync while the snapshot is on its way),Failedfrom a binary that cannot run, the failed and wedged notices, notices readingresets_at_ms🤖 Generated with Claude Code