Skip to content

Conversation

@jeffnash
Copy link
Contributor

Summary

Adds foundational infrastructure for GitHub Copilot support.

Changes

  • feat(util): Add auth directory management helper, random hex generator, and machine ID helper
  • feat(config): Add Copilot configuration options (agent-initiator-persist, scanner buffer size, account type)

Stack

This is PR 1/5 in the Copilot feature stack:

  1. [This PR] Infrastructure & Config
  2. Auth Flow
  3. Executor & Models
  4. Gemini Reasoning
  5. Tests

- Add auth directory management helper (GetAuthDir)
- Add random hex string generator for request IDs
- Add helper for generating unique machine identifiers
@chatgpt-codex-connector
Copy link

Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits.
Credits must be used to enable repository wide code reviews.

@gemini-code-assist
Copy link

Summary of Changes

Hello @jeffnash, 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 establishes the foundational infrastructure and configuration necessary for integrating GitHub Copilot support. It introduces new utility functions for managing authentication directories, defines specific configuration options for Copilot, and adds a general scanner buffer size setting. This is the first in a series of five pull requests aimed at fully enabling Copilot functionality, focusing on setting up the core components before diving into authentication, execution, and reasoning.

Highlights

  • GitHub Copilot Configuration: New configuration options for GitHub Copilot have been introduced, allowing specification of account type (individual, business, enterprise), proxy settings, and an agent-initiator-persist flag to optimize rate limit handling for long-running agent interactions. Authentication notes emphasize OAuth device code flow and auth-dir storage.
  • Authentication Directory Management: A new utility function, EnsureAuthDir, has been added to manage the authentication directory. This function ensures the directory exists, creates it with appropriate permissions (0755) if it doesn't, and validates its path, providing a robust foundation for secure token storage.
  • Scanner Buffer Size: A ScannerBufferSize configuration option has been added to control the buffer size for reading response streams. This allows for fine-tuning performance when handling large responses, with a default of 20MB if not specified.
  • Configuration Sanitization: Logic to sanitize Copilot configurations has been implemented. This includes normalizing the AccountType field by trimming whitespace and converting to lowercase, and setting a default account type if an invalid one is provided, ensuring consistent configuration handling.
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

@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 lays the groundwork for GitHub Copilot integration by adding necessary configuration options and utility functions. The changes are well-structured and clear. I've made a few suggestions related to naming in the configuration to improve clarity and avoid potential confusion, as the term 'key' is used for a configuration that doesn't involve API keys. Overall, this is a solid first step for the Copilot feature.

#
# After OAuth login, tokens are managed automatically and stored in auth-dir.
# The entries below only configure account type and optional proxy settings.
#copilot-api-key:

Choose a reason for hiding this comment

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

medium

The configuration key copilot-api-key is misleading since this configuration does not involve an API key, as noted in the comments. To improve clarity, consider renaming it to copilot.

#copilot:

CodexKey []CodexKey `yaml:"codex-api-key" json:"codex-api-key"`

// CopilotKey defines GitHub Copilot API configurations.
CopilotKey []CopilotKey `yaml:"copilot-api-key" json:"copilot-api-key"`

Choose a reason for hiding this comment

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

medium

To align with the suggested change in config.example.yaml, this YAML tag should be updated from copilot-api-key to copilot. This makes the configuration key more accurate, as this section is for configuration, not for an API key.

Suggested change
CopilotKey []CopilotKey `yaml:"copilot-api-key" json:"copilot-api-key"`
CopilotKey []CopilotKey "yaml:\"copilot\" json:\"copilot\""


// CopilotKey represents the configuration for GitHub Copilot API access.
// Authentication is handled via device code OAuth flow, not API keys.
type CopilotKey struct {

Choose a reason for hiding this comment

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

medium

The struct name CopilotKey is inconsistent with its purpose, as it doesn't hold an API key. Renaming it to CopilotConfig would make the code more self-documenting and easier to understand. This change would need to be applied to all usages of the type in this file.

Suggested change
type CopilotKey struct {
type CopilotConfig struct {

- Add Copilot section with agent-initiator-persist flag
- Add scanner buffer size configuration
- Add account type configuration option
- Add copilot types with account type validation
- Document configuration options in example config
- Add tests for util and copilot types
@jeffnash jeffnash force-pushed the feat/copilot-infrastructure branch from 09d6cc1 to a895864 Compare November 30, 2025 21:48
@luispater
Copy link
Collaborator

Since the creation of the CLIProxyAPI project, our first rule has been "No third-party resellers."

So, we created a new repository for third-party reseller providers.

You can open a PR to the new repository: CLIProxyAPIPlus

@luispater luispater closed this Dec 1, 2025
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