Skip to content

Conversation

@aka1976mb
Copy link

Summary

Details

Related Issues

How to Validate

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

aka1976mb and others added 17 commits November 28, 2025 01:48
Co-authored-by: riddhi <[email protected]>

## Summary

<!-- Concisely describe what this PR changes and why. Focus on impact and
urgency. -->

## Details

<!-- Add any extra context and design decisions. Keep it brief but complete. -->

## Related Issues

<!-- Use keywords to auto-close issues (Closes google-gemini#123, Fixes google-gemini#456). If this PR is
only related to an issue or is a partial fix, simply reference the issue number
without a keyword (Related to google-gemini#123). -->

## How to Validate

<!-- List exact steps for reviewers to validate the change. Include commands,
expected results, and edge cases. -->

## Pre-Merge Checklist

<!-- Check all that apply before requesting review or merging. -->

- [ ] 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
This commit introduces a new setting in `.vscode/settings.json` to store the Gemini API key.
This key will be used for authentication when interacting with the Gemini API.
…configuration file. Here's a cleaned up version that resolves the issues:

```yaml
have_fun: false
code_review:
  disable: false
  comment_severity_threshold: 'MEDIUM'  # Changed from HIGH to MEDIUM
  max_review_comments: 20               # Changed from -1 to 20
  pull_request_opened:
    help: false
    summary: true
    code_review: true
ignore_patterns:
  - "**/*.md"
  - "**/package-lock.json"
  - "**/dist/"
```

1. **Removed duplicate `ignore_patterns`** - You had two separate `ignore_patterns` sections
2. **Resolved conflicting values** - The later settings were overriding the earlier ones
3. **Applied your intended changes** - Now using MEDIUM severity and 20 comment limit

- **More detailed reviews** (MEDIUM severity catches more issues than HIGH)
- **Prevents comment overload** (max 20 comments instead of unlimited)
- **Ignores common noise files** (docs, lock files, build outputs)
- **Still provides summaries and code reviews** on PR open

This should give you balanced, actionable code reviews without being overwhelmed by too many comments!
…onfigurations for code formatting and linting. These changes aim to improve code consistency and quality across the project.
This commit updates the `.github/CODEOWNERS` file to reflect recent team changes and ensure proper ownership of code. These changes aim to improve maintainability and streamline the code review process.
@aka1976mb aka1976mb requested review from a team as code owners December 6, 2025 00:40
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @aka1976mb, 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 primarily focuses on refining the management of the Gemini API key by introducing a direct configuration option and establishing a clear hierarchy for its retrieval. This ensures consistency and predictability in how the API key is sourced across different environments. Additionally, the changes include updates to the project's dependency lock file, likely to standardize peer dependency declarations, and minor enhancements to the VS Code development environment.

Highlights

  • Gemini API Key Configuration: Introduced a new geminiApiKey field in the configuration schema and ConfigParameters interface, allowing the Gemini API key to be set directly within the application's configuration.
  • API Key Resolution Priority: Updated the logic for resolving the Gemini API key to establish a clear precedence: the geminiApiKey from the Config object is now prioritized, followed by a key loaded from credential storage, and then the GEMINI_API_KEY environment variable.
  • New Test Coverage for API Key Handling: Added a dedicated test file (geminiApiKey.test.ts) to thoroughly validate the new Gemini API key configuration logic, including the priority order of key sources and ensuring that the API key is masked when used in proxy configurations to prevent accidental leakage.
  • Dependency Lock File Updates: Numerous peer: true flags were added or removed for various dependencies within package-lock.json. This likely reflects an update or standardization of how peer dependencies are declared and managed in the project's dependency tree.
  • VS Code Developer Experience Improvements: Added new settings to .vscode/settings.json to ignore the main branch for GitHub Pull Requests and enabled Copilot's next edit suggestions, enhancing the developer workflow within VS Code.
Ignored Files
  • Ignored by pattern: .gemini/** (1)
    • .gemini/config.yaml
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 introduces a mechanism to provide the Gemini API key via configuration, establishing a clear priority for key resolution. The changes include adding a geminiApiKey to the configuration schema, updating the core logic to use it, and adding new tests to verify the behavior. My review found a critical issue in the API key resolution logic. The implementation's priority order for sourcing the API key does not match the behavior asserted in the new tests. This could lead to using an incorrect API key. I've provided a specific comment and a code suggestion to fix this discrepancy.

aka1976mb and others added 2 commits December 7, 2025 04:33
Now there's a **third critical issue**! The API key resolution priority is incorrect. You need to fix this as well.

## **Fix 3: Correct API key priority order**

Open `packages/core/src/core/contentGenerator.ts` and change lines 68-71 from:

```typescript
config?.geminiApiKey ||
(await loadApiKey()) ||
process.env['GEMINI_API_KEY'] ||
undefined;
```

To:

```typescript
config?.geminiApiKey ||
process.env['GEMINI_API_KEY'] ||
(await loadApiKey()) ||
undefined;
```

## **Why this matters:**

The priority order should be:
1. **Config file API key** (highest priority) - explicit user setting
2. **Environment variable** - system/process level setting  
3. **Loaded API key** (from file, etc.) - lowest priority

The current code uses `loadApiKey()` before checking environment variables, which could cause:
- **Security issues**: Using a less secure/outdated API key
- **Billing issues**: Charging the wrong account
- **Functionality issues**: Using an invalid or rate-limited key

## **Summary of all 3 critical fixes:**

1. **Fix missing import** in `GetRemoteName.ts`
   ```typescript
   import { run_shell_command } from '../core/shell.js';
   ```

2. **Implement API key redaction** in `config.ts`
   ```typescript
   getRedactedProxy(): string | undefined {
     if (!this.proxy) return undefined;
     let redacted = this.proxy;
     if (this.geminiApiKey) {
       const escaped = this.geminiApiKey.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
       redacted = redacted.replace(new RegExp(escaped, 'g'), '***');
     }
     return redacted;
   }
   ```

3. **Fix API key priority** in `contentGenerator.ts`
   ```typescript
   config?.geminiApiKey ||
   process.env['GEMINI_API_KEY'] ||
   (await loadApiKey()) ||
   undefined;
   ```

Make all 3 changes, then commit and push. Your PR should pass all checks once these critical issues are resolved.

Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
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.

2 participants