Skip to content

fix(patch): cherry-pick ea48bd9 to release/v0.30.1-pr-20577 [CONFLICTS]#20591

Open
gemini-cli-robot wants to merge 3 commits intorelease/v0.30.1-pr-20577from
hotfix/v0.30.1/0.30.2/stable/cherry-pick-ea48bd9/pr-20577
Open

fix(patch): cherry-pick ea48bd9 to release/v0.30.1-pr-20577 [CONFLICTS]#20591
gemini-cli-robot wants to merge 3 commits intorelease/v0.30.1-pr-20577from
hotfix/v0.30.1/0.30.2/stable/cherry-pick-ea48bd9/pr-20577

Conversation

@gemini-cli-robot
Copy link
Collaborator

This PR automatically cherry-picks commit ea48bd9 to patch version v0.30.1 in the stable release to create version 0.30.2.

⚠️ 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

Co-authored-by: Gal Zahavi <38544478+galz10@users.noreply.github.com>
# Conflicts:
#	packages/cli/src/test-utils/render.tsx
#	packages/cli/src/ui/AppContainer.tsx
#	packages/cli/src/ui/contexts/UIActionsContext.tsx
#	packages/core/src/utils/errors.test.ts
#	packages/core/src/utils/errors.ts
@gemini-cli-robot gemini-cli-robot requested a review from a team as a code owner February 27, 2026 18:41
@gemini-code-assist
Copy link
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 backports a critical enhancement to the CLI's authentication system. It improves the user experience by providing more specific feedback when an account is suspended, guiding users towards resolution through a new interactive dialog. This change ensures that users encountering account suspension issues are clearly informed and presented with actionable steps, rather than a generic authentication failure.

Highlights

  • Enhanced Authentication Error Handling: The CLI now specifically detects and handles account suspension errors during authentication, providing a structured response that includes details about the suspension.
  • New Account Suspension Dialog: A dedicated UI component, BannedAccountDialog, has been introduced to display account suspension messages, provide appeal URLs, and offer options to appeal or change authentication methods.
  • Refactored Authentication Result: The performInitialAuth function now returns a comprehensive InitialAuthResult object, which encapsulates both general authentication errors and specific account suspension information.
  • Error Type Definition: A new AccountSuspendedError class has been added to packages/core/src/utils/errors.ts to represent and carry details about account suspensions, including appeal URLs and link text.
Changelog
  • packages/cli/src/core/auth.test.ts
    • Updated authentication tests to align with the new structured return type of performInitialAuth.
    • Added a new test case to verify correct handling and return of account suspension errors.
  • packages/cli/src/core/auth.ts
    • Modified performInitialAuth to return an InitialAuthResult object, which now includes authError and accountSuspensionInfo.
    • Implemented logic to detect AccountSuspendedError and populate the accountSuspensionInfo field accordingly.
  • packages/cli/src/core/initializer.test.ts
    • Updated tests to accommodate the new return type of performInitialAuth and the expanded InitializationResult interface.
  • packages/cli/src/core/initializer.ts
    • Modified initializeApp to destructure authError and accountSuspensionInfo from the performInitialAuth result.
    • Included accountSuspensionInfo in the InitializationResult interface to propagate suspension details.
  • packages/cli/src/gemini.test.tsx
    • Updated mockInitializationResult to include the new accountSuspensionInfo property.
  • packages/cli/src/test-utils/AppRig.tsx
    • Updated the mock for useAuth and initializationResult to include accountSuspensionInfo and setAccountSuspensionInfo.
  • packages/cli/src/test-utils/render.tsx
    • Added new mocks for getPreferredEditor and clearAccountSuspension within mockUIActions.
    • Included context capture for overflow state and actions.
  • packages/cli/src/ui/AppContainer.tsx
    • Modified useAuthCommand to accept initialAccountSuspensionInfo as a parameter.
    • Updated UIState and UIActions contexts to properly handle and propagate account suspension information.
  • packages/cli/src/ui/auth/BannedAccountDialog.test.tsx
    • Added a new test file for the BannedAccountDialog component.
    • Tested rendering of suspension messages, menu options, browser opening functionality, and exit behavior.
  • packages/cli/src/ui/auth/BannedAccountDialog.tsx
    • Added a new React component BannedAccountDialog to display account suspension details.
    • Implemented functionality to show appeal URLs, provide options for appeal or changing authentication, and handle browser interactions.
  • packages/cli/src/ui/auth/snapshots/BannedAccountDialog.test.tsx.snap
    • Added a snapshot test file for the BannedAccountDialog component to ensure consistent UI rendering.
  • packages/cli/src/ui/auth/useAuth.ts
    • Modified useAuthCommand to manage the accountSuspensionInfo state.
    • Updated error handling logic to detect and set AccountSuspendedError when appropriate.
  • packages/cli/src/ui/components/DialogManager.tsx
    • Imported the new BannedAccountDialog component.
    • Added conditional rendering logic to display the BannedAccountDialog when accountSuspensionInfo is present in the UI state.
  • packages/cli/src/ui/contexts/UIActionsContext.tsx
    • Updated the UIActions interface to include getPreferredEditor and clearAccountSuspension methods.
  • packages/cli/src/ui/contexts/UIStateContext.tsx
    • Defined the AccountSuspensionInfo interface to structure account suspension details.
    • Added accountSuspensionInfo to the UIState interface to track suspension status.
  • packages/core/src/utils/errors.test.ts
    • Added new tests for toFriendlyError to ensure it correctly identifies and converts API errors with TOS_VIOLATION details into AccountSuspendedError instances.
  • packages/core/src/utils/errors.ts
    • Imported parseGoogleApiError for structured API error parsing.
    • Defined the AccountSuspendedError class, extending ForbiddenError, to include appealUrl and appealLinkText properties.
    • Updated toFriendlyError to detect TOS_VIOLATION errors within API responses and return the new AccountSuspendedError.
Activity
  • This pull request was automatically generated by gemini-cli-robot to cherry-pick commit ea48bd9 to the release/v0.30.1-pr-20577 branch.
  • Merge conflicts were detected during the automatic cherry-pick process, requiring manual resolution.
  • The PR description provides clear instructions for resolving conflicts, testing changes, and updating the PR.
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 cherry-picks changes to handle account suspension errors, specifically for "Terms of Service" violations. The changes introduce a new BannedAccountDialog to inform the user and provide options to appeal or change authentication. The authentication flow and related types have been updated to carry accountSuspensionInfo.

However, the cherry-pick has resulted in several unresolved merge conflicts across multiple files. These conflicts contain <<<<<<< HEAD, =======, and >>>>>>> markers, which will prevent the code from compiling and must be resolved. Critical comments have been added to each file where these conflicts are present.

Comment on lines 224 to 239
<<<<<<< HEAD
=======
getPreferredEditor: vi.fn(),
clearAccountSuspension: vi.fn(),
};

let capturedOverflowState: OverflowState | undefined;
let capturedOverflowActions: OverflowActions | undefined;
const ContextCapture: React.FC<{ children: React.ReactNode }> = ({
children,
}) => {
capturedOverflowState = useOverflowState();
capturedOverflowActions = useOverflowActions();
return <>{children}</>;
>>>>>>> ea48bd941 (feat: better error messages (#20577))
};
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 contains unresolved merge conflict markers. Please resolve the conflict to ensure the code is valid and can be compiled.

Comment on lines +2300 to +2307
<<<<<<< HEAD
=======
getPreferredEditor,
clearAccountSuspension: () => {
setAccountSuspensionInfo(null);
setAuthState(AuthState.Updating);
},
>>>>>>> ea48bd941 (feat: better error messages (#20577))
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 contains unresolved merge conflict markers. Please resolve the conflict to ensure the code is valid and can be compiled.

Comment on lines +85 to +89
<<<<<<< HEAD
=======
getPreferredEditor: () => EditorType | undefined;
clearAccountSuspension: () => void;
>>>>>>> ea48bd941 (feat: better error messages (#20577))
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 contains unresolved merge conflict markers. Please resolve the conflict to ensure the code is valid and can be compiled.

Comment on lines +282 to +328
<<<<<<< HEAD
=======

describe('getErrorType', () => {
it('should return error name for standard errors', () => {
expect(getErrorType(new Error('test'))).toBe('Error');
expect(getErrorType(new TypeError('test'))).toBe('TypeError');
expect(getErrorType(new SyntaxError('test'))).toBe('SyntaxError');
});

it('should return constructor name for custom errors', () => {
expect(getErrorType(new FatalAuthenticationError('test'))).toBe(
'FatalAuthenticationError',
);
expect(getErrorType(new FatalInputError('test'))).toBe('FatalInputError');
expect(getErrorType(new FatalSandboxError('test'))).toBe(
'FatalSandboxError',
);
expect(getErrorType(new FatalConfigError('test'))).toBe('FatalConfigError');
expect(getErrorType(new FatalTurnLimitedError('test'))).toBe(
'FatalTurnLimitedError',
);
expect(getErrorType(new FatalToolExecutionError('test'))).toBe(
'FatalToolExecutionError',
);
expect(getErrorType(new FatalCancellationError('test'))).toBe(
'FatalCancellationError',
);
expect(getErrorType(new ForbiddenError('test'))).toBe('ForbiddenError');
expect(getErrorType(new AccountSuspendedError('test'))).toBe(
'AccountSuspendedError',
);
expect(getErrorType(new UnauthorizedError('test'))).toBe(
'UnauthorizedError',
);
expect(getErrorType(new BadRequestError('test'))).toBe('BadRequestError');
});

it('should return "unknown" for non-Error objects', () => {
expect(getErrorType('string error')).toBe('unknown');
expect(getErrorType(123)).toBe('unknown');
expect(getErrorType({})).toBe('unknown');
expect(getErrorType(null)).toBe('unknown');
expect(getErrorType(undefined)).toBe('unknown');
});
});
>>>>>>> ea48bd941 (feat: better error messages (#20577))
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 contains unresolved merge conflict markers. Please resolve the conflict to ensure the code is valid and can be compiled.

Comment on lines +113 to +139
<<<<<<< HEAD
if (error && typeof error === 'object' && 'response' in error) {
// eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion
const gaxiosError = error as GaxiosError;
const data = parseResponseData(gaxiosError);
=======
// First, try structured parsing for TOS_VIOLATION detection.
const googleApiError = parseGoogleApiError(error);
if (googleApiError && googleApiError.code === 403) {
const tosDetail = googleApiError.details.find(
(d): d is ErrorInfo =>
d['@type'] === 'type.googleapis.com/google.rpc.ErrorInfo' &&
'reason' in d &&
d.reason === 'TOS_VIOLATION',
);
if (tosDetail) {
return new AccountSuspendedError(
googleApiError.message,
tosDetail.metadata,
);
}
}

// Fall back to basic Gaxios error parsing for other HTTP errors.
if (isGaxiosError(error)) {
const data = parseResponseData(error);
>>>>>>> ea48bd941 (feat: better error messages (#20577))
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 contains unresolved merge conflict markers. Please resolve the conflict to ensure the code is valid and can be compiled.

@gemini-cli gemini-cli bot added the status/need-issue Pull requests that need to have an associated issue. label Feb 27, 2026
@github-actions
Copy link

Size Change: +7.11 kB (+0.03%)

Total Size: 24.5 MB

Filename Size Change
./bundle/gemini.js 24.5 MB +7.11 kB (+0.03%)
ℹ️ View Unchanged
Filename Size
./bundle/sandbox-macos-permissive-open.sb 890 B
./bundle/sandbox-macos-permissive-proxied.sb 1.31 kB
./bundle/sandbox-macos-restrictive-open.sb 3.36 kB
./bundle/sandbox-macos-restrictive-proxied.sb 3.56 kB
./bundle/sandbox-macos-strict-open.sb 4.82 kB
./bundle/sandbox-macos-strict-proxied.sb 5.02 kB

compressed-size-action

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

status/need-issue Pull requests that need to have an associated issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants