Skip to content

feat(clink): add GitHub Copilot CLI integration#413

Open
TejGandham wants to merge 4 commits intoBeehiveInnovations:mainfrom
TejGandham:feat/copilot-clink-support
Open

feat(clink): add GitHub Copilot CLI integration#413
TejGandham wants to merge 4 commits intoBeehiveInnovations:mainfrom
TejGandham:feat/copilot-clink-support

Conversation

@TejGandham
Copy link
Copy Markdown

@TejGandham TejGandham commented Mar 7, 2026

Summary

  • Adds GitHub Copilot CLI as a supported clink agent, enabling multi-model collaboration via Copilot's $10/mo subscription
  • Implements CopilotAgent (prompt via -p flag, DEVNULL stdin) and CopilotJSONLParser (parses assistant.message + result JSONL events)
  • Includes CLI client config (conf/cli_clients/copilot.json) and default/planner/codereviewer roles

Test plan

  • 6 parser unit tests: success, multiple messages, missing message error, non-JSON line handling, stderr capture, empty content filtering
  • 6 agent unit tests: success path, -p flag verification, DEVNULL stdin, error recovery, unparseable output, executable-not-found
  • All 877 existing unit tests still pass (1 pre-existing failure in test_registry_lists_roles unrelated to this change)
  • Integration test with copilot CLI installed locally

Closes #406

Add Copilot as a supported CLI agent for clink, enabling multi-model
collaboration through GitHub Copilot's CLI at $10/mo subscription cost.

- CopilotAgent: passes prompt via -p flag, uses DEVNULL stdin
- CopilotJSONLParser: parses JSONL output (assistant.message + result events)
- CLI client config with --allow-all-tools and default/planner/codereviewer roles
- Internal defaults with copilot_jsonl parser and --output-format json

Includes 12 unit tests covering parser and agent behavior.

Closes BeehiveInnovations#406
@gemini-code-assist
Copy link
Copy Markdown
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 introduces native support for the GitHub Copilot CLI within the clink framework. By integrating Copilot as a new agent, it expands the system's capabilities for multi-model collaboration, allowing users to leverage Copilot's AI functionalities directly. The changes involve adding a dedicated agent and parser, along with necessary configuration, to seamlessly execute and interpret responses from the Copilot CLI.

Highlights

  • GitHub Copilot CLI Integration: Added GitHub Copilot CLI as a new supported agent, enabling multi-model collaboration.
  • New Agent Implementation: Introduced CopilotAgent to interact with the Copilot CLI, passing prompts via the -p flag and handling process execution.
  • New Parser Implementation: Developed CopilotJSONLParser to specifically parse the JSONL output from the Copilot CLI, extracting assistant messages and relevant metadata.
  • Configuration and Testing: Included a new client configuration file for Copilot and comprehensive unit tests for both the agent and the parser.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Changelog
  • clink/agents/init.py
    • Imported CopilotAgent.
    • Registered CopilotAgent in the _AGENTS dictionary.
  • clink/agents/copilot.py
    • Added CopilotAgent class for interacting with the GitHub Copilot CLI.
  • clink/constants.py
    • Added copilot entry to CLI_INTERNAL_DEFAULTS with its parser and arguments.
  • clink/parsers/init.py
    • Imported CopilotJSONLParser.
    • Registered CopilotJSONLParser in the _PARSER_CLASSES dictionary.
  • clink/parsers/copilot.py
    • Added CopilotJSONLParser class for parsing JSONL output from the Copilot CLI.
  • conf/cli_clients/copilot.json
    • Added a new configuration file for the copilot CLI client, defining its command and roles.
  • tests/test_clink_copilot_agent.py
    • Added unit tests for the CopilotAgent.
  • tests/test_clink_copilot_parser.py
    • Added unit tests for the CopilotJSONLParser.
Activity
  • The author has completed 6 unit tests for the new parser.
  • The author has completed 6 unit tests for the new agent.
  • All 877 existing unit tests have passed, with one known pre-existing failure unrelated to these changes.
  • An integration test with the copilot CLI installed locally is planned.
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
Copy Markdown
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 adds support for the GitHub Copilot CLI, including a new agent, a JSONL parser, and corresponding configuration and tests. However, it introduces two security concerns: the use of the --allow-all-tools flag, which increases the risk of prompt injection leading to unauthorized tool execution, and the logging of user prompts, which may contain sensitive information. Additionally, there is a maintainability concern regarding code duplication between the new CopilotAgent and the BaseCLIAgent.

Comment thread conf/cli_clients/copilot.json Outdated
Comment thread clink/agents/copilot.py
Reformat 10 test files that were formatted with Python 3.13 syntax
which Black on Python 3.11 (used in CI) cannot parse.
- Remove --allow-all-tools from default config to prevent unauthorized
  tool execution via prompt injection; users can opt-in explicitly
- Redact prompt content (-p argument) from debug logs to avoid
  leaking PII or credentials
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 5df43eb61b

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread clink/agents/copilot.py
The -p prompt value was flowing through sanitized_command into
AgentOutput metadata and tool output, leaking conversation history
and sensitive user text. Now redacted at the source so both logs
and metadata contain [REDACTED] instead of the actual prompt.
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.

Enable Github Copilot CLI Integration alongside Claude Code, Gemini CLI and Codex CLI

1 participant