Skip to content

fix: prevent Recent Token Usage from being cleared during gateway status reconciliation - #3

Open
SmartBunBun wants to merge 1 commit into
Arain-sh:mainfrom
SmartBunBun:fix/recent-token-usage
Open

fix: prevent Recent Token Usage from being cleared during gateway status reconciliation#3
SmartBunBun wants to merge 1 commit into
Arain-sh:mainfrom
SmartBunBun:fix/recent-token-usage

Conversation

@SmartBunBun

Copy link
Copy Markdown

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

  • Bug fix
  • New feature
  • Documentation
  • Refactor
  • Other

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

  • I ran relevant checks/tests locally.
  • I updated docs if behavior or interfaces changed.
  • I verified there are no unrelated changes in this PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant