fix: prevent Recent Token Usage from being cleared during gateway status reconciliation - #3
Open
SmartBunBun wants to merge 1 commit into
Open
Conversation
…tus reconciliation
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.
Summary
This PR fixes a Models page regression where Recent Token Usage could be cleared even though historical usage data still existed locally.
The root cause was that the page treated Gateway status changes as a reason to hide or replace usage history. In practice, the Gateway store performs periodic status reconciliation, so transient state changes could cause the Models page to render No token usage history yet until the view was reloaded.
This change updates the Models page to preserve the last successful usage history instead of clearing it during transient Gateway status changes, empty refresh responses, or fetch timeouts. This better matches the actual data source, since token usage history is derived from local transcript files rather than requiring the Gateway to stay continuously running.
It also adds coverage for the case where token usage remains visible after the Models page has loaded and the Gateway later stops.
Related Issue(s)
N/A
Type of Change
Validation
Verified the Models page logic to confirm Recent Token Usage was being cleared when Gateway status changed during periodic reconciliation.
Updated the page to retain the last successful usage history instead of replacing it with an empty state on transient Gateway status changes, empty refresh responses, or fetch timeouts.
Checklist