Fix session usage showing 100% when actual usage is 1%#1
Merged
Conversation
The normalizeUsedPercent boundary condition <= 1 incorrectly caught usedPercent values of exactly 1 (meaning 1% in 0-100 scale) and multiplied them to 100. This only manifested in session windows where low usage values hit the boundary. Change to < 1 so that integer percentage values pass through without normalization.
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
normalizeUsedPercent()boundary condition (<= 1→< 1) that incorrectly multipliedusedPercent: 1(1% in 0-100 scale) to 100%1Root Cause
The normalization heuristic detects 0-1 decimal range values and multiplies by 100. The condition
usedPercent > 0 && usedPercent <= 1incorrectly catches the integer value1(meaning 1% used) and converts it to100.Codex reports "99% left" (= 1% used) → API returns
usedPercent: 1→ our code multiplies to100→ displays "100% used".Weekly is unaffected because its cumulative values are typically > 1 (e.g., 11, 30).