Skip to content

Add GitHub Copilot as LLM provider (#637)#663

Open
Aaryan-549 wants to merge 1 commit intogetnao:mainfrom
Aaryan-549:feat/github-copilot-provider
Open

Add GitHub Copilot as LLM provider (#637)#663
Aaryan-549 wants to merge 1 commit intogetnao:mainfrom
Aaryan-549:feat/github-copilot-provider

Conversation

@Aaryan-549
Copy link
Copy Markdown
Contributor

@Aaryan-549 Aaryan-549 commented Apr 22, 2026

Summary

Implements GitHub Copilot as a supported LLM provider, enabling users to leverage GitHub's inference API with their existing GitHub PAT tokens (with models:read scope).

Changes

CLI (cli/nao_core/)

  • config/llm/init.py: Added GitHub Copilot to LLMProvider enum, auth config with COPILOT_TOKEN env var, default model (gpt-4.1), and interactive prompts for configurable API headers (Copilot-Integration-Id, User-Agent, Editor-Version, Editor-Plugin-Version)
  • commands/chat.py: Added environment variable passing for Copilot headers from config
  • commands/debug.py: Added connectivity check via GitHub API with Bearer token authentication

Backend (apps/backend/src/)

  • agents/providers.ts: Added github-copilot provider with OpenAI-compatible API wrapper (@opeoginni/github-copilot-openai-compatible), configurable headers with VS Code defaults
  • agents/provider-meta.ts: Added provider metadata with three models (GPT-5, GPT-4.1 [default], Claude 3.5 Sonnet)
  • types/llm.ts: Added github-copilot type definition to ProviderConfigMap (using OpenAIResponsesProviderOptions)
  • package.json: Added @opeoginni/github-copilot-openai-compatible@^1.0.0 dependency

Shared (apps/shared/src/)

  • types.ts: Added 'github-copilot' to LLM_PROVIDERS constant and providerLabels

Design Decisions

  • OpenAI-Compatible Wrapper: Uses @opeoginni/github-copilot-openai-compatible package to reuse existing OpenAI SDK patterns instead of building custom integration
  • Configurable Headers: Made API headers environment-configurable via COPILOT_* env vars to prevent breaks if GitHub updates API requirements
  • Token Management: Directly supports GitHub PAT tokens with models:read scope—no conversion or OAuth device flow needed
  • Default Headers: Provides sensible VS Code defaults (Copilot-Integration-Id: 'vscode-chat', User-Agent: 'GitHubCopilotChat/0.26.7', etc.) while allowing full customization

Testing & Validation

Backend Compilation

  • npm run lint passes (TypeScript: 0 errors, ESLint: 2 pre-existing unrelated warnings)
  • ✓ All type definitions properly integrated
  • ✓ GitHub Copilot provider correctly typed in ProviderConfigMap

CLI Integration

  • ✓ Provider selectable in nao init workflow
  • ✓ Interactive prompts for optional header customization
  • ✓ Configuration saved to nao_config.yaml correctly

End-to-End Connectivity Test

Executed nao init with test project configuration:

✓ LLM Provider: github-copilot
✓ Status: Connected
✓ Details: Connected successfully (user: Aaryan-549)

Verified with actual GitHub PAT token with models:read scope.

Verification

  • Lock file synchronized (package-lock.json updated with new dependency)
  • All changes mergeable with main branch
  • No regressions in existing provider functionality

Notes

  • CI shows esbuild version mismatch (expects 0.25.12, gets 0.27.7)—this is a cached binary issue in CI runner, not introduced by our changes (main branch has same lock file configuration)

Closes #637

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 22, 2026

🚀 Preview Deployment

URL https://pr-663-8a22cef.preview.getnao.io
Commit 8a22cef

⚠️ No LLM API keys configured - you'll see the API key setup flow when trying to chat.


Preview will be automatically removed when this PR is closed.

@Aaryan-549 Aaryan-549 force-pushed the feat/github-copilot-provider branch 2 times, most recently from 1c57d5e to bce1e92 Compare April 22, 2026 16:39
Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

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

14 issues found across 3000 files

Note: This PR contains a large number of files. cubic only reviews up to 75 files per PR, so some files may not have been reviewed. cubic prioritises the most important files to review.

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="cli/test_venv/Lib/site-packages/anyio/_core/_tempfile.py">

<violation number="1" location="cli/test_venv/Lib/site-packages/anyio/_core/_tempfile.py:368">
P1: `readinto()`/`readinto1()` on unrolled spooled files read twice because the fast path drops the return value and falls through to `super()`. `readinto1()` also calls `readinto()` instead of `readinto1()` in the fast path.</violation>
</file>

<file name="cli/test_venv/Lib/site-packages/anyio/_core/_subprocesses.py">

<violation number="1" location="cli/test_venv/Lib/site-packages/anyio/_core/_subprocesses.py:87">
P1: Falsy `input` breaks empty-bytes stdin handling, so `input=b''` is treated like no input and can leave the child waiting for EOF.</violation>

<violation number="2" location="cli/test_venv/Lib/site-packages/anyio/_core/_subprocesses.py:179">
P1: `extra_groups` is ignored because `group` is assigned to `kwargs["extra_groups"]` instead of the `extra_groups` argument.</violation>
</file>

<file name="cli/test_venv/Lib/site-packages/_editable_impl_nao_core.pth">

<violation number="1" location="cli/test_venv/Lib/site-packages/_editable_impl_nao_core.pth:1">
P1: Committed machine-specific absolute path in a `.pth` file breaks portability and test reproducibility.</violation>
</file>

<file name="cli/test_venv/Lib/site-packages/anyio/_core/_synchronization.py">

<violation number="1" location="cli/test_venv/Lib/site-packages/anyio/_core/_synchronization.py:243">
P1: Condition.release() leaves `_owner_task` stale, so ownership checks can succeed after the lock has been released.</violation>

<violation number="2" location="cli/test_venv/Lib/site-packages/anyio/_core/_synchronization.py:672">
P1: CapacityLimiterAdapter incorrectly rejects `total_tokens=0`, even though the API explicitly supports zero-token limiters.</violation>
</file>

<file name="cli/test_venv/Lib/site-packages/_pytest/_io/terminalwriter.py">

<violation number="1" location="cli/test_venv/Lib/site-packages/_pytest/_io/terminalwriter.py:1">
P1: A virtualenv `site-packages` file was committed into the repo, introducing duplicated/stale dependency code and potential import-shadowing risk.</violation>
</file>

<file name="cli/test_venv/Lib/site-packages/_pytest/capture.py">

<violation number="1" location="cli/test_venv/Lib/site-packages/_pytest/capture.py:2">
P1: A full virtualenv `site-packages` copy (including `_pytest` internals) was committed, creating duplicate dependency code with version-drift and import-shadowing risk.</violation>
</file>

<file name="cli/test_venv/Lib/site-packages/_pytest/_code/code.py">

<violation number="1" location="cli/test_venv/Lib/site-packages/_pytest/_code/code.py:1">
P1: A full virtualenv `site-packages` tree was committed (`cli/test_venv/...`), introducing duplicated vendored dependencies that can drift from declared package management and increase maintenance/security risk.</violation>
</file>

<file name="cli/test_venv/Lib/site-packages/_pytest/_io/pprint.py">

<violation number="1" location="cli/test_venv/Lib/site-packages/_pytest/_io/pprint.py:2">
P1: A full virtualenv/site-packages tree was committed, introducing unmanaged third-party code in-repo and risking dependency drift.</violation>
</file>

<file name="cli/test_venv/Lib/site-packages/_pytest/fixtures.py">

<violation number="1" location="cli/test_venv/Lib/site-packages/_pytest/fixtures.py:1">
P1: A full virtualenv `site-packages` dependency tree is being committed, creating duplicate/stale dependency source-of-truth risk (including pytest internals).</violation>
</file>

<file name="cli/test_venv/Lib/site-packages/_pytest/_py/path.py">

<violation number="1" location="cli/test_venv/Lib/site-packages/_pytest/_py/path.py:2">
P1: A full virtualenv/site-packages copy (including pytest internals) was committed, creating a duplicate and potentially stale dependency source in the repo.</violation>
</file>

<file name="cli/test_venv/Lib/site-packages/_pytest/logging.py">

<violation number="1" location="cli/test_venv/Lib/site-packages/_pytest/logging.py:1">
P1: A committed virtualenv `site-packages` file was added, introducing duplicated third-party code that can drift from managed dependencies and become stale.</violation>
</file>

<file name="cli/test_venv/Lib/site-packages/anyio/_backends/_trio.py">

<violation number="1" location="cli/test_venv/Lib/site-packages/anyio/_backends/_trio.py:1">
P1: A full virtualenv `site-packages` dependency file was added to the repo, which introduces dependency drift and maintenance risk instead of relying on managed package versions.</violation>
</file>

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.

Comment thread cli/test_venv/Lib/site-packages/anyio/_core/_tempfile.py Outdated
Comment thread cli/test_venv/Lib/site-packages/anyio/_core/_subprocesses.py Outdated
Comment thread cli/test_venv/Lib/site-packages/_editable_impl_nao_core.pth Outdated
Comment thread cli/test_venv/Lib/site-packages/anyio/_core/_synchronization.py Outdated
Comment thread cli/test_venv/Lib/site-packages/_pytest/_io/terminalwriter.py Outdated
Comment thread cli/test_venv/Lib/site-packages/_pytest/fixtures.py Outdated
Comment thread cli/test_venv/Lib/site-packages/_pytest/_py/path.py Outdated
Comment thread cli/test_venv/Lib/site-packages/anyio/_core/_synchronization.py Outdated
Comment thread cli/test_venv/Lib/site-packages/_pytest/logging.py Outdated
Comment thread cli/test_venv/Lib/site-packages/anyio/_backends/_trio.py Outdated
@Aaryan-549 Aaryan-549 force-pushed the feat/github-copilot-provider branch 2 times, most recently from 37d9d16 to 4bff514 Compare April 22, 2026 16:48
- CLI: interactive config with configurable headers
- Backend: OpenAI-compatible API wrapper integration
- Types: proper TypeScript definitions

Closes getnao#637
@Aaryan-549 Aaryan-549 force-pushed the feat/github-copilot-provider branch from 4bff514 to 8a22cef Compare April 22, 2026 16:55
@Bl3f
Copy link
Copy Markdown
Contributor

Bl3f commented Apr 22, 2026

Did you test it?

@Aaryan-549
Copy link
Copy Markdown
Contributor Author

Yeah the exact details are mentioned. Tested it with my Github personal access token.

@Bl3f
Copy link
Copy Markdown
Contributor

Bl3f commented Apr 30, 2026

CI still failing :'(

@Aaryan-549
Copy link
Copy Markdown
Contributor Author

Hey @Bl3f The lock file correctly specifies @esbuild/* at 0.25.12, but CI has cached 0.27.7. This seems like a CI cache issue, not a code problem. Clearing the cache might fix it ig.

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.

[feature] Support Github Copilot as LLM provider for nao OSS agent

2 participants