Skip to content

feat(ui): show authenticated account and plan on startup - #17413

Closed
keithguerin wants to merge 1 commit into
google-gemini:mainfrom
keithguerin:feat-show-account-on-startup
Closed

feat(ui): show authenticated account and plan on startup#17413
keithguerin wants to merge 1 commit into
google-gemini:mainfrom
keithguerin:feat-show-account-on-startup

Conversation

@keithguerin

@keithguerin keithguerin commented Jan 23, 2026

Copy link
Copy Markdown
Contributor

Summary

Displays the currently authenticated user's email and plan (tier) in the chat history when the Gemini CLI starts up. This provides users with immediate context about their session identity.

Details

  • Modified AppContainer.tsx to check for authentication status on component mount.
  • Uses UserAccountManager to retrieve the cached Google account email.
  • Uses config.getUserTier() to retrieve the user's plan.
  • Adds a system message to the history if the user is authenticated via Google Login or ADC.
  • Ensures the message is only shown for fresh sessions (not when resuming) to avoid clutter.
  • New: Added ui.showAuthOnStartup setting (default true) to disable this feature.

Related Issues

Fixes #17413

How to Validate

  1. Build the project: npm run build
  2. Run the CLI: npm start
  3. Ensure you are authenticated.
  4. Restart the CLI.
  5. Observe the message "Authenticated as: (Plan: )" at the top of the chat history.
  6. Add "ui": { "showAuthOnStartup": false } to settings.
  7. Restart CLI and verify message is gone.

Pre-Merge Checklist

  • Updated relevant documentation and README (if needed)
  • Added/updated tests (if needed)
  • Noted breaking changes (if any)
  • Validated on required platforms/methods:
    • MacOS
      • npm run
      • npx
      • Docker
      • Podman
      • Seatbelt
    • Windows
      • npm run
      • npx
      • Docker
    • Linux
      • npm run
      • npx
      • Docker

@keithguerin
keithguerin requested a review from a team as a code owner January 23, 2026 22:26
@gemini-code-assist

Copy link
Copy Markdown
Contributor

Summary of Changes

Hello @keithguerin, 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 enhances the user experience of the Gemini CLI by providing immediate feedback on the authenticated user's identity and plan upon application launch. By integrating this information directly into the chat history, users can quickly confirm their session context, while also offering a new configuration option to tailor this behavior to individual preferences.

Highlights

  • Startup Authentication Display: The CLI now prominently displays the authenticated user's email and plan (tier) directly within the chat history upon application startup.
  • Configurable Visibility: A new UI setting, ui.showAuthOnStartup, has been introduced, allowing users to easily enable or disable this feature, with a default setting of true.
  • Session Awareness: The authentication message is intelligently displayed only for fresh CLI sessions, ensuring that the chat history remains uncluttered when resuming previous sessions.
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.

@keithguerin
keithguerin marked this pull request as draft January 23, 2026 22:28
@keithguerin

Copy link
Copy Markdown
Contributor Author

@sehoon38 Can you take this from here please?

@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 introduces a feature to display the authenticated user's account and plan on startup, which is a nice addition for user context. The implementation is mostly sound, with a new configuration option to control this behavior. However, I've identified a significant performance issue related to synchronous file I/O that blocks the main thread during startup. My review includes a high-severity comment with a suggested refactoring to address this by using asynchronous operations, which will improve the application's responsiveness.

Comment on lines +169 to 209
const initialHistoryItems = useMemo(() => {
const items: HistoryItem[] = [];
if (resumedSessionData) return items;

// Check if the user has disabled showing auth on startup
if (settings.merged.ui.showAuthOnStartup === false) return items;

// We can't use authState here because it's initialized in useAuthCommand which is called later.
// However, we can check config directly since we know startup just finished.
const authType = config.getContentGeneratorConfig()?.authType;
if (
authType === AuthType.LOGIN_WITH_GOOGLE ||
authType === AuthType.COMPUTE_ADC
) {
try {
const userAccountManager = new UserAccountManager();
const email = userAccountManager.getCachedGoogleAccount();
const tier = config.getUserTier();

if (email) {
let message = `Authenticated as: ${email}`;
if (tier) {
message += ` (Plan: ${tier})`;
}
items.push({
id: Date.now(), // Use timestamp as ID for initial item
type: MessageType.INFO,
text: message,
});
}
} catch (_e) {
// Ignore errors during initial auth check
}
}
return items;
}, [config, resumedSessionData, settings.merged.ui.showAuthOnStartup]);

const historyManager = useHistory({
chatRecordingService: config.getGeminiClient()?.getChatRecordingService(),
initialItems: initialHistoryItems,
});

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.

high

The useMemo hook for initialHistoryItems performs synchronous file I/O via userAccountManager.getCachedGoogleAccount(), which can block the event loop. This is a performance concern and goes against the project's guideline of using asynchronous file operations.

This logic should be moved into a useEffect hook to handle it asynchronously. This would also allow you to use historyManager.addItem(), which correctly generates unique IDs for history items, avoiding the use of Date.now() as a React key.

I'm providing a code suggestion to refactor this. I've added a TODO comment to highlight that the synchronous call still needs to be addressed, ideally by adding an async method to UserAccountManager.

  const historyManager = useHistory({
    chatRecordingService: config.getGeminiClient()?.getChatRecordingService(),
  });
  const { addItem } = historyManager;

  useEffect(() => {
    if (resumedSessionData || settings.merged.ui.showAuthOnStartup === false) {
      return;
    }

    const authType = config.getContentGeneratorConfig()?.authType;
    if (
      authType !== AuthType.LOGIN_WITH_GOOGLE &&
      authType !== AuthType.COMPUTE_ADC
    ) {
      return;
    }

    try {
      // TODO: This should be made asynchronous to avoid blocking the event loop.
      const userAccountManager = new UserAccountManager();
      const email = userAccountManager.getCachedGoogleAccount();
      const tier = config.getUserTier();

      if (email) {
        let message = `Authenticated as: ${email}`;
        if (tier) {
          message += ` (Plan: ${tier})`;
        }
        addItem({
          type: MessageType.INFO,
          text: message,
        });
      }
    } catch (_e) {
      // Ignore errors during initial auth check
    }
  }, [config, resumedSessionData, settings.merged.ui.showAuthOnStartup, addItem]);
References
  1. When selecting an item from a list where simple IDs may not be unique, use a guaranteed unique identifier, such as an index or a composite key, to avoid ambiguity when retrieving the selected item with methods like Array.prototype.find().

@sehoon38 sehoon38 self-assigned this Jan 23, 2026
@gemini-cli

gemini-cli Bot commented Jan 24, 2026

Copy link
Copy Markdown
Contributor

Hi there! Thank you for your contribution to Gemini CLI.

To improve our contribution process and better track changes, we now require all pull requests to be associated with an existing issue, as announced in our recent discussion and as detailed in our CONTRIBUTING.md.

This pull request is being closed because it is not currently linked to an issue. You can easily reopen this PR once you have linked it to an issue.

How to link an issue:
Add a keyword followed by the issue number (e.g., Fixes #123) in the description of your pull request. For more details, see the GitHub Documentation.

Thank you for your understanding and for being a part of our community!

@gemini-cli gemini-cli Bot closed this Jan 24, 2026
@yunaseoul yunaseoul assigned yunaseoul and unassigned sehoon38 Jan 26, 2026
@sripasg sripasg added the size/m A medium sized PR label Jun 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/m A medium sized PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants