fix: cap cache percentage at 100% in status output (#26643)#26686
Open
Jimmy-xuzimo wants to merge 4 commits intoopenclaw:mainfrom
Open
fix: cap cache percentage at 100% in status output (#26643)#26686Jimmy-xuzimo wants to merge 4 commits intoopenclaw:mainfrom
Jimmy-xuzimo wants to merge 4 commits intoopenclaw:mainfrom
Conversation
- Add 'google' to the list of reasoning tag providers in provider-utils.ts - This fixes issue openclaw#26551 where google provider (used by gemini-api-key auth) was not being recognized for reasoning tag filtering - Add corresponding test case for google provider
- Fix issue openclaw#26643 where cache hit rate shows >100% (e.g., 1142%) - Use Math.min(100, ...) to cap the percentage display - This is a display-only fix for edge cases where cacheRead exceeds tokens used
|
This pull request has been automatically marked as stale due to inactivity. |
faf0088 to
4ccf9a9
Compare
- Rebasing on latest main branch - PR is still valid and ready for review - No functional changes in this update
Contributor
Author
Following up on this PRThis PR fixes cache hit rate display showing values over 100% (e.g., 1142%) in CLI status output. Summary
This is a display-only fix with minimal risk. Could a maintainer please review? Thank you! |
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
Fixes issue #26643 - Cache hit rate can display values greater than 100% (e.g., 1142%) in the CLI status output.
Root Cause
The cache hit rate calculation divides
cacheReadbytotal(tokens used). In some edge cases,cacheReadcan exceedtokens used, resulting in percentages over 100%.Fix
Cap the displayed percentage at 100% using
Math.min(100, ...).Changes
src/commands/status.format.ts: AddedMath.min(100, ...)to cap cache percentage displayBefore/After
Before:
After:
Testing
Impact
This is a display-only fix. The actual token counts are unaffected; only the percentage display is capped at 100% for display correctness.
Greptile Summary
Caps cache hit rate display at 100% to fix #26643 where cache reads could exceed tokens used and show percentages over 100% (e.g., 1142%). Also includes two additional fixes: adds
googleprovider support for reasoning tag filtering (#26551), and adds Windows bash detection to skip bash-dependent tests when bash isn't available.Confidence Score: 5/5
Math.min, the provider addition is a simple string match extension, and the test improvements add proper platform checks for Windows compatibility. Changes are well-tested and match the repository's coding standards.Last reviewed commit: faf0088
(5/5) You can turn off certain types of comments like style here!