Skip to content

Commit cc7f8bf

Browse files
kevin-dpclaude
andcommitted
refactor(agents-server-ui): use usage.ratio in the breakdown header [review #4596]
The popover header recomputed `min(1, usedTokens/contextWindow)` locally — exactly what `computeContextUsage` already stored as `usage.ratio` (and what the trigger gauge uses). Use it directly so the two can't drift. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent 0776889 commit cc7f8bf

1 file changed

Lines changed: 1 addition & 6 deletions

File tree

packages/agents-server-ui/src/components/ContextUsageDetails.tsx

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,17 +26,12 @@ export function ContextUsageDetails({
2626
segments,
2727
modelId,
2828
}: ContextUsageDetailsProps): React.ReactElement {
29-
const usedRatio =
30-
usage.contextWindow > 0
31-
? Math.min(1, usage.usedTokens / usage.contextWindow)
32-
: 0
33-
3429
return (
3530
<div className={styles.panel}>
3631
<div className={styles.header}>
3732
<span className={styles.title}>Context usage</span>
3833
<span className={styles.headline}>
39-
{formatContextUsagePercent(usedRatio)}
34+
{formatContextUsagePercent(usage.ratio)}
4035
</span>
4136
</div>
4237
<div className={styles.subhead}>

0 commit comments

Comments
 (0)