Skip to content

Conversation

@m7medVision
Copy link
Owner

…e gh auth login error

@m7medVision m7medVision self-assigned this Oct 26, 2025
@m7medVision m7medVision linked an issue Oct 26, 2025 that may be closed by this pull request
@gemini-code-assist
Copy link

Summary of Changes

Hello @m7medVision, 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 introduces significant improvements to the application's authentication flow, particularly for the Copilot provider, by integrating with the GitHub CLI for token management. It also enhances cross-platform compatibility, specifically for Windows environments, by refining configuration path resolution. These changes aim to resolve authentication errors and provide a more robust and user-friendly experience.

Highlights

  • GitHub CLI Integration for Authentication: The application now leverages the GitHub CLI (gh auth token) to retrieve authentication tokens for the Copilot provider, enhancing security and simplifying the setup process by removing reliance on environment variables.
  • Improved Windows Compatibility: Configuration directory detection on Windows has been refined to use os.UserHomeDir(), addressing previous issues and improving reliability for Windows users.
  • Simplified Copilot Token Handling: The internal token exchange mechanism for Copilot has been streamlined by removing the exchangeGitHubToken function, directly using the GitHub token obtained from the CLI as the bearer token.
  • Model Naming Standardization: Default model names for both OpenAI and Copilot providers have been updated to openai/gpt-5-mini for consistency across the application.
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.

@m7medVision m7medVision merged commit f29166e into main Oct 26, 2025
@m7medVision m7medVision deleted the 25-fix-windows-problem branch October 26, 2025 21:46
Copy link

@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 introduces several fixes, primarily focused on GitHub authentication and improving Windows compatibility. Key changes include integrating with the gh CLI to fetch authentication tokens, removing the now-obsolete Copilot token exchange mechanism, and correcting the configuration directory path logic for Windows. My review identifies a critical issue where the application would exit if the user's home directory couldn't be found on Windows. I've also pointed out a medium-severity regression where support for configuring API keys via environment variables was removed, and I've provided suggestions to address both points.

Comment on lines +265 to 268
if err != nil {
fmt.Println("Error getting user home directory:", err)
os.Exit(1)
}

Choose a reason for hiding this comment

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

critical

Calling os.Exit(1) within a library function like getConfigDir is a critical issue, as it will terminate the entire application if it fails to determine the user's home directory. This makes the package non-reusable and difficult to test. The function should handle this error gracefully instead of exiting. For instance, it could log the error to stderr and fall back to a sensible default, such as the current directory.

		if err != nil {
			fmt.Fprintf(os.Stderr, "Warning: could not determine user home directory: %v. Using current directory for config.\n", err)
			return "."
		}

Comment on lines +214 to 217
tok, err := tryGetTokenFromGHCLI()
if err == nil && tok != "" {
return tok, nil
}

Choose a reason for hiding this comment

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

medium

This change removes the logic for loading the GitHub token from GITHUB_TOKEN or GITHUB_MODELS_TOKEN environment variables. This is a regression in functionality, as users who previously relied on these environment variables will find that they no longer work. It's a common and good practice to check for environment variables before falling back to other methods like executing an external command, as it's faster and provides a conventional configuration method.

    if token := os.Getenv("GITHUB_TOKEN"); token != "" {
		return token, nil
	}
	if token := os.Getenv("GITHUB_MODELS_TOKEN"); token != "" {
		return token, nil
	}
	tok, err := tryGetTokenFromGHCLI()
	if err == nil && tok != "" {
		return tok, nil
	}

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.

On Windows, it fails unless an empty config file is created

2 participants