Skip to content

feat(cli): polish cached token stats and simplify stats display when quota is present.#14961

Merged
jacob314 merged 1 commit intomainfrom
cache_breakdown
Dec 11, 2025
Merged

feat(cli): polish cached token stats and simplify stats display when quota is present.#14961
jacob314 merged 1 commit intomainfrom
cache_breakdown

Conversation

@jacob314
Copy link
Contributor

@jacob314 jacob314 commented Dec 11, 2025

Summary

This commit refactors the CLI's statistics display (/stats and /stats model) to provide a cleaner and more focused user experience.

The primary change is to simplify the main /stats view when user quota information is available. In this context, the display prioritizes the user's quota status, as that is the most actionable information. The detailed token breakdown, which can create a cluttered view, is hidden. Users who need to see the full token breakdown can use the more detailed /stats model view.

Specific changes include:

  • Simplified Main Stats View (/stats):

    • When quota information is displayed, the model usage table is condensed to show only the model name, request count, and remaining usage.
    • The detailed token columns (Input Tokens, Cache Reads, Output Tokens) and the "Savings Highlight" are now conditionally hidden in the presence of quota data to reduce information density.
  • Improved Detailed View (/stats model):

    • The token breakdown is now more precise. "Prompt" tokens have been split into "Input" (uncached tokens) and "Cache Reads" to give a clearer view of cache efficiency.
    • Labels have been updated for clarity (e.g., "Cached" is now "Cache Reads").
    • Colors and layout have been polished for better readability.
  • Test snapshots have been updated to reflect these intentional UI improvements.

Details

/stats when using OAuth
image
/stats when not using OAuth
image

/stats model example:
Screenshot 2025-12-11 at 12 50 45 PM

How to test

Run both signed in with an API key and OAuth. Verify that you don't see spurious messages about cost savings when using Oath and that the main /stats page does not show token usage when using OAuth.

Verify that when using API Key you do not see anything quota related when using /stats and that you see Input Tokens, Output Tokens, and Cached Reads.

@jacob314 jacob314 requested a review from a team as a code owner December 11, 2025 20:22
@github-actions
Copy link

github-actions bot commented Dec 11, 2025

Size Change: +3.23 kB (+0.01%)

Total Size: 21.6 MB

Filename Size Change
./bundle/gemini.js 21.6 MB +3.23 kB (+0.01%)
ℹ️ View Unchanged
Filename Size
./bundle/sandbox-macos-permissive-closed.sb 1.03 kB
./bundle/sandbox-macos-permissive-open.sb 890 B
./bundle/sandbox-macos-permissive-proxied.sb 1.31 kB
./bundle/sandbox-macos-restrictive-closed.sb 3.29 kB
./bundle/sandbox-macos-restrictive-open.sb 3.36 kB
./bundle/sandbox-macos-restrictive-proxied.sb 3.56 kB

compressed-size-action

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request polishes the statistics display by improving labels, colors, and layout. The changes in ModelStatsDisplay make the token breakdown clearer. However, the refactoring of StatsDisplay and its ModelUsageTable component has led to a significant regression: key statistical information, such as token usage columns and cache savings highlights, is now hidden when user quota information is displayed. This removes valuable context for the user. My review includes feedback to address this loss of information to ensure the stats display remains comprehensive.

@jacob314 jacob314 changed the title Polish stats display feat(cli): simplify stats display when quota is present. Dec 11, 2025
@jacob314 jacob314 changed the title feat(cli): simplify stats display when quota is present. feat(cli): polish cached token stats and simplify stats display when quota is present. Dec 11, 2025
@google-gemini google-gemini deleted a comment from gemini-code-assist bot Dec 11, 2025
@jacob314
Copy link
Contributor Author

Code Review

This pull request polishes the statistics display by improving labels, colors, and layout. The changes in ModelStatsDisplay make the token breakdown clearer. However, the refactoring of StatsDisplay and its ModelUsageTable component has led to a significant regression: key statistical information, such as token usage columns and cache savings highlights, is now hidden when user quota information is displayed. This removes valuable context for the user. My review includes feedback to address this loss of information to ensure the stats display remains comprehensive.

This is a misunderstanding of what the pr is doing.

const usageLimitWidth = quotas ? 30 : 0;
const usageLimitWidth = showQuotaColumn ? 28 : 0;

const cacheEfficiencyColor = getStatusColor(cacheEfficiency, {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

assume this was just missed before. Gemini added it back and I left it.

width={requestsWidth}
flexDirection="column"
alignItems="flex-end"
flexShrink={0}
Copy link
Contributor Author

@jacob314 jacob314 Dec 11, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

UX is broken if this shrinks. Same elsewhere

Copy link
Collaborator

@abhipatel12 abhipatel12 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@jacob314 jacob314 added this pull request to the merge queue Dec 11, 2025
Merged via the queue into main with commit 54de675 Dec 11, 2025
20 checks passed
@jacob314 jacob314 deleted the cache_breakdown branch December 11, 2025 23:27
@jacob314
Copy link
Contributor Author

/patch preview

@jacob314
Copy link
Contributor Author

/patch stable

@github-actions
Copy link

Patch workflow(s) dispatched successfully!

📋 Details:

  • Channels: preview
  • Commit: 54de67536da3af801bba8ab4657769d54dd30c2a
  • Workflows Created: 1

🔗 Track Progress:

@github-actions
Copy link

Patch workflow(s) dispatched successfully!

📋 Details:

  • Channels: stable
  • Commit: 54de67536da3af801bba8ab4657769d54dd30c2a
  • Workflows Created: 1

🔗 Track Progress:

github-actions bot pushed a commit that referenced this pull request Dec 12, 2025
…quota is present. (#14961)

# Conflicts:
#	packages/cli/src/ui/components/StatsDisplay.test.tsx
#	packages/cli/src/ui/components/StatsDisplay.tsx
#	packages/cli/src/ui/components/__snapshots__/StatsDisplay.test.tsx.snap
@github-actions
Copy link

🚀 Patch PR Created!

📋 Patch Details:

📝 Next Steps:

  1. ⚠️ Resolve conflicts in the hotfix PR first: #14967
  2. Test your changes after resolving conflicts
  3. Once merged, the patch release will automatically trigger
  4. You'll receive updates here when the release completes

🔗 Track Progress:

github-actions bot pushed a commit that referenced this pull request Dec 12, 2025
…quota is present. (#14961)

# Conflicts:
#	packages/cli/src/ui/components/StatsDisplay.test.tsx
#	packages/cli/src/ui/components/StatsDisplay.tsx
#	packages/cli/src/ui/components/__snapshots__/StatsDisplay.test.tsx.snap
@github-actions
Copy link

🚀 Patch PR Created!

📋 Patch Details:

📝 Next Steps:

  1. ⚠️ Resolve conflicts in the hotfix PR first: #14968
  2. Test your changes after resolving conflicts
  3. Once merged, the patch release will automatically trigger
  4. You'll receive updates here when the release completes

🔗 Track Progress:

@github-actions
Copy link

🚀 Patch Release Started!

📋 Release Details:

  • Environment: prod
  • Channel: preview → publishing to npm tag preview
  • Version: v0.21.0-preview.2
  • Hotfix PR: Merged ✅
  • Release Branch: release/v0.21.0-preview.2-pr-14961

⏳ Status: The patch release is now running. You'll receive another update when it completes.

🔗 Track Progress:

@github-actions
Copy link

Patch Release Complete!

📦 Release Details:

🎉 Status: Your patch has been successfully released and published to npm!

📝 What's Available:

🔗 Links:

theerud pushed a commit to theerud/gemini-cli that referenced this pull request Dec 12, 2025
thacio added a commit to thacio/auditaria that referenced this pull request Dec 13, 2025
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