fix(ui): flip /usage gauge color thresholds#2046
Open
he-yufeng wants to merge 1 commit intoMoonshotAI:mainfrom
Open
fix(ui): flip /usage gauge color thresholds#2046he-yufeng wants to merge 1 commit intoMoonshotAI:mainfrom
he-yufeng wants to merge 1 commit intoMoonshotAI:mainfrom
Conversation
_format_row computes ratio as (limit - used) / limit, i.e. the remaining fraction, and the caller labels it "% left". _ratio_color, however, reads ratio like a "used" gauge — 90%+ remaining renders red and anything below 70% remaining renders green, which is the opposite of the intended warning signal. Flip the comparisons so red kicks in once 10% or less remains and yellow once 30% or less remains, matching the "% left" label. Fixes MoonshotAI#2019
This was referenced Apr 24, 2026
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.
Fixes #2019.
_format_rowinsrc/kimi_cli/ui/shell/usage.pycomputesi.e. the remaining fraction (and the caller renders it as
{percent:.0f}% left). The color helper below readsratioas if it were a "used" gauge:So the progress bar is green while usage is almost full and turns red right after a reset. This PR flips the thresholds so
redkicks in when ≤10% remains andyellowwhen ≤30% remains, which matches the% leftlabel.Reporter (@sunmy2019) also gave the same fix in the issue. Added a short comment explaining the direction since the variable name alone doesn't make it obvious.