Skip to content

Add GitHub Copilot agent adapter#291

Merged
0xroylee merged 1 commit into
mainfrom
feature/github-copilot-adapter
Jun 3, 2026
Merged

Add GitHub Copilot agent adapter#291
0xroylee merged 1 commit into
mainfrom
feature/github-copilot-adapter

Conversation

@johnku2011
Copy link
Copy Markdown
Collaborator

Summary

  • Add a GitHub Copilot CLI-backed agent adapter with registry metadata, configuration docs, validation, error mapping, and focused adapter tests.
  • Wire GitHub Copilot backend config through CLI env/project resolution, onboarding checks, usage/model metadata, and web runtime labels.
  • Add onboard secret detection for configured tokens in tracked config files.

Validation

  • bun run check
  • bun run typecheck
  • bun test

Copilot AI review requested due to automatic review settings June 2, 2026 08:32
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds a new GitHub Copilot CLI–backed agent adapter to the agent-adapters package, then wires it through the CLI config/onboarding flows and the web UI runtime labeling so it can be selected, validated, and surfaced consistently.

Changes:

  • Introduces a github-copilot agent adapter with registry metadata, configuration docs, validation, output parsing, and error mapping.
  • Plumbs GitHub Copilot runtime configuration through CLI env/project resolution and adds onboarding checks (binary availability + secret detection in tracked config).
  • Updates web UI runtime labels to display “GitHub Copilot” for multiple runtime key variants.

Reviewed changes

Copilot reviewed 27 out of 27 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
packages/web/src/lib/agents/use-agent-monitor.ts Adds runtime label mappings for GitHub Copilot variants.
packages/web/src/components/runtimes/runtimes-panel-utils.ts Adds runtime label mappings for GitHub Copilot variants.
packages/cli/tests/onboard.test.ts Adds onboarding tests for Copilot binary failure + token-in-config detection.
packages/cli/tests/config.test.ts Adds env var coverage for GitHub Copilot backend/config loading.
packages/cli/tests/agent-adapters.test.ts Ensures CLI adapter factory returns GitHubCopilotAdapter.
packages/cli/src/features/workflow/usage-cost.ts Includes github-copilot model in fallback model resolution.
packages/cli/src/features/workflow/agents/agent-log-metadata.ts Includes github-copilot model in agent log metadata.
packages/cli/src/features/onboard/checks-helpers.ts Adds helper to format missing Copilot binary messages.
packages/cli/src/features/onboard/checks-collection.ts Adds tracked-config secret scan (incl. Copilot token).
packages/cli/src/features/onboard/checks-binaries.ts Adds Copilot CLI binary availability check when configured.
packages/cli/src/features/config/types/runtime.types.ts Adds githubCopilot runtime config + backend enum value.
packages/cli/src/features/config/project-agent-config.ts Resolves/merges GitHub Copilot runtime config across scopes.
packages/cli/src/features/config/env-normalizers.ts Allows AGENT_BACKEND=github-copilot.
packages/cli/src/features/config/env-agent-config.ts Loads GitHub Copilot settings from env vars into runtime config.
packages/agent-adapters/tests/opencode.test.ts Updates registry expectations to include github-copilot.
packages/agent-adapters/tests/github-copilot.test.ts Adds focused tests for GitHub Copilot adapter behavior.
packages/agent-adapters/tests/cursor.test.ts Updates registry expectations to include github-copilot.
packages/agent-adapters/tests/adapters.test.ts Updates factory/registry expectations and normalization coverage.
packages/agent-adapters/src/validation.ts Extends schemas to support github-copilot runtime config.
packages/agent-adapters/src/types/agent-adapter.types.ts Adds github-copilot backend + runtime config typing.
packages/agent-adapters/src/registry.ts Registers GitHub Copilot backend definition + factory.
packages/agent-adapters/src/github-copilot/output.ts Adds stdout-to-finalMessage extraction helper.
packages/agent-adapters/src/github-copilot/errors.ts Adds Copilot-specific error mapping to AgentAdapterError.
packages/agent-adapters/src/github-copilot/constants.ts Defines backend id, label/description, and model metadata.
packages/agent-adapters/src/github-copilot/configuration-doc.ts Provides configuration documentation for env/config fields.
packages/agent-adapters/src/github-copilot/adapter.ts Implements the GitHub Copilot CLI adapter.
packages/agent-adapters/package.json Exposes ./github-copilot export entry.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +9 to +18
export function mapGitHubCopilotError(
command: string,
args: string[],
result: { code: number; stdout: string; stderr: string },
context: GitHubCopilotErrorContext = {},
): Error {
const output = result.stderr || result.stdout;
const lower = output.toLowerCase();
const base = `${command} ${args.join(" ")} failed with exit code ${result.code}`;

Comment on lines +1 to +3
export function extractFinalMessage(output: string): string {
return output.trim() || output;
}
Comment on lines +81 to +85
checks.push({
name: "Tracked config secrets",
status: "pass",
message: "no configured secrets found in tracked config files",
});
@0xroylee 0xroylee merged commit d748107 into main Jun 3, 2026
4 of 6 checks passed
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.

3 participants