Skip to content

Support Copilot CLI offline mode + BYOK for gatewayed deployments #1922

@lpcox

Description

@lpcox

Context

Upstream issue: github/gh-aw-mcpg#3563

Since gh-aw gateways all LLM inference through the API proxy sidecar (--enable-api-proxy), we should support running Copilot CLI in offline mode + BYOK so it talks directly to the sidecar without needing GitHub authentication.

Reference: https://github.blog/changelog/2026-04-07-copilot-cli-now-supports-byok-and-local-models/

Current State

AWF already has partial BYOK support:

  • API proxy sidecar (172.30.0.30) injects real API keys and forwards through Squid
  • COPILOT_API_KEY and COPILOT_GITHUB_TOKEN are held in the sidecar, never exposed to the agent
  • Agent calls the sidecar with no auth (e.g., http://172.30.0.30:10002 for Copilot)
  • PR feat: add Copilot BYOK support via COPILOT_API_KEY #1918 is expanding BYOK support with resolveCopilotAuthToken() precedence logic

What's Missing

When Copilot CLI supports offline/BYOK mode, the firewall should:

  1. Configure Copilot CLI for offline mode — Set the appropriate env vars so Copilot CLI skips GitHub auth handshake and uses a direct API endpoint instead. This avoids the OAuth token exchange and reduces startup latency.

  2. Point Copilot CLI at the sidecar — The API proxy sidecar already handles credential injection. Copilot CLI's BYOK endpoint config should point at http://172.30.0.30:10002 so requests flow: Agent → Sidecar (injects key) → Squid → upstream API.

  3. Eliminate GitHub auth dependency for inference — With offline mode, the agent container wouldn't need COPILOT_GITHUB_TOKEN at all for LLM calls (it would still need GITHUB_TOKEN for MCP tools like issues/PRs). This simplifies the auth model and removes a failure mode.

  4. Reduce allowed domains — If Copilot CLI doesn't need to do the OAuth handshake with api.github.com for token exchange, we could potentially remove GitHub API domains from the inference allow-list, tightening the network policy.

Benefits

  • Faster startup: No OAuth token exchange for LLM inference
  • Simpler auth model: Separate concerns — GITHUB_TOKEN for tools, BYOK key for inference
  • Better isolation: Agent never touches inference credentials
  • Reduced attack surface: Fewer allowed domains needed

Dependencies

  • Copilot CLI offline mode GA (currently in changelog preview)
  • Understanding of the exact env vars / CLI flags Copilot CLI uses for offline + BYOK

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions