Skip to content

Conversation

@MuriloFP
Copy link
Contributor

@MuriloFP MuriloFP commented Jan 29, 2025

Description

fix: prevent context token counter flickering during API requests

Maintains the last valid context token count between API requests by:

  • Adding tracking of last valid context tokens
  • Using last known value as fallback when current request lacks token data
  • Only updating when new valid token counts are available

This prevents the context counter from flickering to "-" during tool calls
and API request transitions, improving the UI stability.

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

How Has This Been Tested?

Manually in the debug mode

Checklist:

  • My code follows the patterns of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation

Additional context

Related Issues

Reviewers


Important

Fixes context token counter flickering in getApiMetrics.ts by using last valid token count as fallback during API requests.

  • Behavior:
    • Prevents context token counter flickering by maintaining last valid context token count in getApiMetrics().
    • Uses last valid context tokens as fallback when current request lacks valid token data.
    • Updates context tokens only when new valid token counts are available.
  • Implementation:
    • Adds lastValidContextTokens variable to track last valid token count in getApiMetrics.ts.
    • Modifies logic to use lastValidContextTokens if current request tokens are invalid.

This description was created by Ellipsis for 86eb383. It will automatically update as commits are pushed.

Maintains the last valid context token count between API requests by:
- Adding tracking of last valid context tokens
- Using last known value as fallback when current request lacks token data
- Only updating when new valid token counts are available

This prevents the context counter from flickering to "-" during tool calls
and API request transitions, improving the UI stability.
@changeset-bot
Copy link

changeset-bot bot commented Jan 29, 2025

⚠️ No Changeset found

Latest commit: 86eb383

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@mrubens mrubens merged commit b20af10 into RooCodeInc:main Jan 29, 2025
6 checks passed
@MuriloFP MuriloFP deleted the fix/stable-context-counter branch January 29, 2025 01:44
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.

2 participants