Skip to content

[SSR Agent] Issue Fix (24587): Fix misleading admin error for personal accounts - #28819

Merged
joneba-google merged 1 commit into
google-gemini:mainfrom
JonE01:ssr-agent-24587
Aug 17, 2026
Merged

joneba-google merged 1 commit into
google-gemini:mainfrom
JonE01:ssr-agent-24587

Conversation

@joneba-google

Copy link
Copy Markdown
Contributor

fixes #24587

Related Issue

Original Issue URL: #24587

Context & Problem

When an authenticated user on a personal account selects a Gemini model that is not available for personal accounts, the CLI displays a misleading enterprise-specific error message referencing admin settings and Preview Release Channels. This is because the ModelNotFoundError handler in useQuotaAndFallback.ts hardcoded this enterprise-specific error message for valid Gemini models without validating whether the user is on a personal or managed account tier.

Detailed Changes

  • packages/cli/src/ui/hooks/useQuotaAndFallback.ts: Updated the ModelNotFoundError handling logic for VALID_GEMINI_MODELS to conditionally inspect the userTier. If the tier is UserTierId.FREE (representing a personal user), the CLI now raises a clean, context-specific error indicating the model is unavailable for personal accounts without mentioning administrative permissions or Preview Release Channels. In other tiers, the original administrator warning is preserved.
  • packages/cli/src/ui/hooks/useQuotaAndFallback.test.ts: Split the ModelNotFoundError unit test into two comprehensive tests: one verifying personal accounts (UserTierId.FREE) and ensuring they receive the simplified personal-account message (asserting no mention of 'admin' or 'Preview Release Channel'), and one verifying enterprise/workspace accounts (UserTierId.STANDARD) retaining the administrative instructions.

Verification

  • Executed unit tests in useQuotaAndFallback.test.ts via Vitest to assert correct behavior and expected text outputs for both personal and enterprise user tiers.
  • Verified ESLint checks ran successfully without any warnings or errors.

@joneba-google
joneba-google requested a review from a team as a code owner August 14, 2026 20:56
@gemini-code-assist

Copy link
Copy Markdown
Contributor

Summary of Changes

Hello, 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 addresses a UX issue where personal account users were receiving confusing, enterprise-specific error messages when attempting to access restricted Gemini models. By checking the user's tier during model access failures, the CLI now provides accurate feedback based on the user's account type, improving clarity and reducing support friction.

Highlights

  • Error Message Correction: Updated the ModelNotFoundError handler to distinguish between personal and enterprise accounts, providing a clear, non-misleading error message for personal users.
  • Enhanced Test Coverage: Split existing unit tests to explicitly verify error message content for both UserTierId.FREE and UserTierId.STANDARD tiers.
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 the 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 counterproductive. 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.

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. ↩

@github-actions github-actions Bot added the size/m A medium sized PR label Aug 14, 2026
@github-actions

github-actions Bot commented Aug 14, 2026 •

Copy link
Copy Markdown

📊 PR Size: size/M

  • Lines changed: 65
  • Additions: +60
  • Deletions: -5
  • Files changed: 2

@google-cla

google-cla Bot commented Aug 14, 2026

Copy link
Copy Markdown

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

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

Copy link
Copy Markdown
Contributor

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 updates the useQuotaAndFallback hook and its tests to display a distinct error message when a ModelNotFoundError occurs for personal (free) accounts versus enterprise/workspace accounts. Feedback on the changes suggests refactoring the message construction logic to extract the common prefix and avoid duplicating the array creation and joining code, which improves readability and maintainability.

Comment thread packages/cli/src/ui/hooks/useQuotaAndFallback.ts Outdated
@gemini-cli gemini-cli Bot added priority/p2 Important but can be addressed in a future release. area/core Issues related to User Interface, OS Support, Core Functionality 🔒 maintainer only ⛔ Do not contribute. Internal roadmap item. labels Aug 14, 2026
@joneba-google joneba-google reopened this Aug 17, 2026
…l accounts

$fixes google-gemini#24587

### Related Issue
Original Issue URL: google-gemini#24587

### Context & Problem
When an authenticated user on a personal account selects a Gemini model that is not available for personal accounts, the CLI displays a misleading enterprise-specific error message referencing admin settings and Preview Release Channels. This is because the `ModelNotFoundError` handler in `useQuotaAndFallback.ts` hardcoded this enterprise-specific error message for valid Gemini models without validating whether the user is on a personal or managed account tier.

### Detailed Changes
- **packages/cli/src/ui/hooks/useQuotaAndFallback.ts**: Updated the `ModelNotFoundError` handling logic for `VALID_GEMINI_MODELS` to conditionally inspect the `userTier`. If the tier is `UserTierId.FREE` (representing a personal user), the CLI now raises a clean, context-specific error indicating the model is unavailable for personal accounts without mentioning administrative permissions or Preview Release Channels. In other tiers, the original administrator warning is preserved.
- **packages/cli/src/ui/hooks/useQuotaAndFallback.test.ts**: Split the `ModelNotFoundError` unit test into two comprehensive tests: one verifying personal accounts (`UserTierId.FREE`) and ensuring they receive the simplified personal-account message (asserting no mention of 'admin' or 'Preview Release Channel'), and one verifying enterprise/workspace accounts (`UserTierId.STANDARD`) retaining the administrative instructions.

### Verification
- Executed unit tests in `useQuotaAndFallback.test.ts` via Vitest to assert correct behavior and expected text outputs for both personal and enterprise user tiers.
- Verified ESLint checks ran successfully without any warnings or errors.

@adamfweidman adamfweidman left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM!

@joneba-google
joneba-google added this pull request to the merge queue Aug 17, 2026
Merged via the queue into google-gemini:main with commit 40fe44a Aug 17, 2026
33 checks passed
@joneba-google
joneba-google deleted the ssr-agent-24587 branch August 17, 2026 23:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/core Issues related to User Interface, OS Support, Core Functionality 🔒 maintainer only ⛔ Do not contribute. Internal roadmap item. priority/p2 Important but can be addressed in a future release. size/m A medium sized PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Misleading "Admin Access" Error for Personal Accounts

2 participants