Skip to content

Conversation

@gemini-cli-robot
Copy link
Collaborator

This PR automatically cherry-picks commit 54de675 to patch version v0.21.0-preview.2 in the preview release to create version 0.21.0-preview.3.

⚠️ Merge Conflicts Detected

This cherry-pick resulted in merge conflicts that need manual resolution.

🔧 Next Steps:

  1. Review the conflicts: Check out this branch and review the conflict markers
  2. Resolve conflicts: Edit the affected files to resolve the conflicts
  3. Test the changes: Ensure the patch works correctly after resolution
  4. Update this PR: Push your conflict resolution

📋 Files with conflicts:

The commit has been created with conflict markers for easier manual resolution.

🚨 Important:

  • Do not merge this PR until conflicts are resolved
  • The automated patch release will trigger once this PR is merged

…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
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @gemini-cli-robot, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request automates the cherry-picking of a significant commit aimed at enhancing the clarity and presentation of token statistics and user quota information within the CLI's UI. The changes involve refining metric names, adjusting token calculations to highlight uncached input, and introducing dynamic rendering logic to simplify the statistics display based on the presence of quota data. However, the automated process encountered merge conflicts, necessitating manual intervention to integrate these improvements.

Highlights

  • Cherry-Pick Operation: This pull request is an automated cherry-pick of commit 54de675 to create a new preview release, 0.21.0-preview.3.
  • Merge Conflicts: The cherry-pick operation resulted in merge conflicts that require manual resolution before the PR can be merged.
  • UI Text Renaming: The 'Cached' token metric has been renamed to 'Cache Reads', and 'Prompt' has been renamed to 'Input' for improved clarity in the ModelStatsDisplay.
  • Input Token Calculation Refinement: The 'Input' token count now specifically displays uncached input tokens (total prompt tokens minus cached tokens).
  • Dynamic Stats Display: The StatsDisplay component now dynamically adjusts the ModelUsageTable columns and content based on whether user quota information is present, simplifying the display when quotas are available. Sections like 'Efficiency & Optimizations' and 'Savings Highlight' are conditionally hidden.
  • Quota Display Terminology: The 'Usage limit remaining' text in the quota display has been updated to 'Usage left'.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

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 is a cherry-pick that has resulted in several merge conflicts, as noted in the description. I've identified unresolved merge conflict markers in StatsDisplay.tsx, StatsDisplay.test.tsx, and its corresponding snapshot file. These are critical issues that must be resolved before the PR can be merged. Additionally, within one of the conflict blocks in StatsDisplay.tsx, there's a reference to an undefined variable VALID_GEMINI_MODELS which will cause a build failure. Please resolve all conflicts and ensure the code compiles and all tests pass.

Comment on lines 79 to 83
<<<<<<< HEAD
expect(output).not.toContain('Efficiency & Optimizations');
expect(output).not.toContain('Model'); // The table header
=======
>>>>>>> 54de67536 (feat(cli): polish cached token stats and simplify stats display when quota is present. (#14961))
Copy link
Contributor

Choose a reason for hiding this comment

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

critical

This test file contains unresolved merge conflicts. Please resolve them to ensure the tests are running correctly.

Comment on lines 73 to 126
<<<<<<< HEAD
=======
// Logic for building the unified list of table rows
const buildModelRows = (
models: Record<string, ModelMetrics>,
quotas?: RetrieveUserQuotaResponse,
) => {
const getBaseModelName = (name: string) => name.replace('-001', '');
const usedModelNames = new Set(Object.keys(models).map(getBaseModelName));

// 1. Models with active usage
const activeRows = Object.entries(models).map(([name, metrics]) => {
const modelName = getBaseModelName(name);
const cachedTokens = metrics.tokens.cached;
const totalInputTokens = metrics.tokens.prompt;
const uncachedTokens = Math.max(0, totalInputTokens - cachedTokens);
return {
key: name,
modelName,
requests: metrics.api.totalRequests,
cachedTokens: cachedTokens.toLocaleString(),
uncachedTokens: uncachedTokens.toLocaleString(),
totalInputTokens: totalInputTokens.toLocaleString(),
outputTokens: metrics.tokens.candidates.toLocaleString(),
bucket: quotas?.buckets?.find((b) => b.modelId === modelName),
isActive: true,
};
});

// 2. Models with quota only
const quotaRows =
quotas?.buckets
?.filter(
(b) =>
b.modelId &&
VALID_GEMINI_MODELS.has(b.modelId) &&
!usedModelNames.has(b.modelId),
)
.map((bucket) => ({
key: bucket.modelId!,
modelName: bucket.modelId!,
requests: '-',
cachedTokens: '-',
uncachedTokens: '-',
totalInputTokens: '-',
outputTokens: '-',
bucket,
isActive: false,
})) || [];

return [...activeRows, ...quotaRows];
};

>>>>>>> 54de67536 (feat(cli): polish cached token stats and simplify stats display when quota is present. (#14961))
Copy link
Contributor

Choose a reason for hiding this comment

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

critical

This file has several unresolved merge conflicts. This is one of them. Please resolve all conflicts before this PR can be merged.

?.filter(
(b) =>
b.modelId &&
VALID_GEMINI_MODELS.has(b.modelId) &&
Copy link
Contributor

Choose a reason for hiding this comment

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

critical

The constant VALID_GEMINI_MODELS is used here but it is not defined or imported within this file. This will cause a compilation error. Please ensure it is properly imported or defined after resolving the merge conflicts.

Comment on lines 148 to 180
<<<<<<< HEAD
=======
exports[`<StatsDisplay /> > Quota Display > renders quota information for unused models 1`] = `
"╭──────────────────────────────────────────────────────────────────────────────────────────────────╮
│ │
│ Session Stats │
│ │
│ Interaction Summary │
│ Session ID: test-session-id │
│ Tool Calls: 0 ( ✓ 0 x 0 ) │
│ Success Rate: 0.0% │
│ │
│ Performance │
│ Wall Time: 1s │
│ Agent Active: 0s │
│ » API Time: 0s (0.0%) │
│ » Tool Time: 0s (0.0%) │
│ │
│ │
│ Model Usage Reqs Usage left │
│ ────────────────────────────────────────────────────────────────────────────────────────────── │
│ gemini-2.5-flash - 50.0% (Resets in 2h) │
│ │
│ Usage limits span all sessions and reset daily. │
│ /auth to upgrade or switch to API key. │
│ │
│ │
│ » Tip: For a full token breakdown, run \`/stats model\`. │
│ │
╰──────────────────────────────────────────────────────────────────────────────────────────────────╯"
`;

>>>>>>> 54de67536 (feat(cli): polish cached token stats and simplify stats display when quota is present. (#14961))
Copy link
Contributor

Choose a reason for hiding this comment

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

critical

This snapshot file contains unresolved merge conflicts. After resolving the conflicts in the component and test files, please update the snapshots accordingly.

Copy link
Collaborator

@jacob314 jacob314 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 enabled auto-merge (squash) December 12, 2025 01:11
@github-actions
Copy link

github-actions bot commented Dec 12, 2025

Size Change: +4.48 kB (+0.02%)

Total Size: 21.6 MB

Filename Size Change
./bundle/gemini.js 21.6 MB +4.48 kB (+0.02%)
ℹ️ 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
Collaborator

@jacob314 jacob314 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 merged commit 73add0f into release/v0.21.0-preview.2-pr-14961 Dec 12, 2025
19 checks passed
@jacob314 jacob314 deleted the hotfix/v0.21.0-preview.2/0.21.0-preview.3/preview/cherry-pick-54de675/pr-14961 branch December 12, 2025 06:36
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.

3 participants