Skip to content

feat(agents): add GitHub Copilot CLI as an agent runtime - #684

Merged
artempartos merged 7 commits into
developfrom
feat/copilot-cli-runtime
Nov 11, 2026
Merged

artempartos merged 7 commits into
developfrom
feat/copilot-cli-runtime

Conversation

@artempartos

@artempartos artempartos commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

What

GitHub Copilot CLI (@github/copilot 1.0.108) as the eighth agent runtime, copilot_cli. A user connects their GitHub account from the profile (one-time code) and runs sessions and workflow steps on their Copilot plan, with any model the plan offers and its reasoning effort. Each session's cost is the AI credits GitHub charged for it.

Design and the measured results: docs/design/copilot-cli-runtime.md (§0.1 "As built and measured").

How it fits

  • Registry, image: config/agent_runtimes.json entry, docker/copilot-cli/Dockerfile (npm install pinned; self-update off; the CLI's ~250 MB JavaScript unpacked at build so sessions don't write it; a build check that the CLI still loads the context file).
  • Credential: copilot login --device-code in the auth terminal. settings.json storeTokenPlaintext pre-answers the keychain question, the token is read out of config.json (JSONC). Sessions get it as COPILOT_GITHUB_TOKEN from a 0600 file in the shell that starts the CLI, never in the container env, and the CLI hides it from its shells and MCP servers (--secret-env-vars). COPILOT_GITHUB_TOKEN outranks GH_TOKEN/GITHUB_TOKEN, so nothing a project sets can swap the account.
  • Sessions: TUI in both modes (-i + --no-ask-user for automatic ones), --allow-all, built-in GitHub MCP off, /workspace pre-trusted, continueOnAutoMode so a model rate limit switches to Auto instead of asking.
  • Models and effort: there is no CLI command or documented API for a plan's catalogue; the CLI's ACP server gives the catalogue and each model's effort levels with no prompt sent (docker/copilot-cli/aixle-copilot-models.mjs), read at login and session cleanup into the credential's metadata.
  • Cost: OTLP traces — each model call's chat span carries tokens and github.copilot.nano_aiu. docker/otlp-ingest now accepts /v1/traces (the three signals share one handler) and UsageStatisticsService routes and authenticates span batches like metrics and logs. COPILOT_AI_CREDIT_USD (default 0.01).
  • Detectors: auth errors, Copilot limit messages, the folder-trust and rate-limit dialogs, and the idle screen after a turn (TurnEndDetector), so an automatic step that ends its turn without finish_session is reminded, as Kiro steps are.

Fixes found on the way (all runtimes)

  • MCP on the 2026-07-28 protocol. Our stateless per-request MCP servers answered subscriptions/listen with a stream that ended at once while server/discover advertised listChanged. Copilot's client treats that as a dead transport and drops the server: the agent had no finish_session. Both endpoints now refuse the method and stop advertising it (serve_subscriptions_listen: false).
  • Typed reminders. Copilot takes a reminder-length burst of text for a paste and drops an Enter right behind it, so the turn-end reminder stayed a draft. Sessions::PaneInput now pauses 0.2 s before Enter, inside the same tmux call.
  • Model picker cache. A picker opened before the catalogue was read cached the one-entry fallback for an hour; storing credential metadata now clears that cache.

Not included

  • A pasted fine-grained PAT or a *.ghe.com host in the auth terminal (decided: device-code only).
  • Microsoft Entra sign-in: the CLI offers it on macOS/Windows only (native broker), and it is not reachable in a Linux container; what it would take is in the design doc.
  • Phases 2–3 of the design (our own GitHub App user token, org-billed installation tokens).

Operators

A deployment that routes the OTLP collector by path must route /v1/traces too. New optional variables: COPILOT_AI_CREDIT_USD, AGENT_IMAGE_COPILOT_CLI.

A deployment that builds or mirrors the agent images into its own registry needs a copilot-cli repository there before the first release with this runtime (the hosted deployment's is a separate infra change).

Verified

  • Live against a Copilot Business seat on a local stack: profile login through the auth terminal (token captured, 23-model catalogue stored), an interactive session, and an automatic session that wrote its file and ended itself through finish_session, priced from OTLP (3.5 AI credits on GPT-5.3-Codex at low effort); and a workflow step whose agent ended its turn without finish_session, which the monitor reminded once and which then finished.
  • docker compose exec -T web make check_all: the full run passed brakeman, fsd, typescript, vite-build, system, watcher, worker-boot and zeitwerk, and found runtime counts hard-coded in six frontend tests and one Rails test, a prettier line and five rubocop offenses. Those are fixed, and each failing check was re-run on its own and passes (rubocop clean across the tree, the four frontend test files, the Rails tests). The full suite was not re-run after the fixes; CI is the judge.
  • OTLP contract fixture captured with bin/capture-agent-otlp copilot_cli (offline BYOK against the mock).

🤖 Generated with Claude Code

artempartos and others added 3 commits November 10, 2026 22:22
Both MCP endpoints build an MCP::Server per request, so the SDK's default
`subscriptions/listen` answered with an SSE stream that ended at once while
`server/discover` advertised `listChanged`. A client on the 2026-07-28
protocol whose transport treats that stream as a dead connection drops the
whole server: Copilot CLI 1.0.108 listed no aixle-tools at all and could
not call finish_session. The method is now refused and nothing advertises it.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Artem Petrov <[email protected]>
A team that already pays for Copilot can run sessions and workflow steps on
the seats it owns. The runtime signs in with `copilot login --device-code`,
hands the CLI its token as COPILOT_GITHUB_TOKEN from a private file (it
outranks GH_TOKEN and GITHUB_TOKEN, so nothing a project sets can swap the
account), reads the plan's model catalogue and reasoning-effort levels from
the CLI's ACP server, and prices each session from the AI credits on the
CLI's OpenTelemetry trace spans.

Traces were the one signal the platform did not ingest: otlp-ingest now
accepts /v1/traces and UsageStatisticsService routes and authenticates span
batches like metrics and logs. Storing credential metadata also drops a
model list a picker cached before the catalogue was read.

Measured against a Copilot Business seat on CLI 1.0.108; the results and the
reasons Microsoft Entra sign-in is not offered are in
docs/design/copilot-cli-runtime.md.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Artem Petrov <[email protected]>
TurnEndDetector now knows Copilot CLI's idle screen, measured at 30x20 to
220x50 and in the web terminal: the `← open sidebar · Interactive` hint four
lines under the `Session: … AIC used` line (`● Working` while a turn runs,
`@ files/sessions` with a draft in the box).

The reminder only reached Copilot as a draft: a reminder-length burst of text
is taken for a paste and the Enter right behind it is dropped. PaneInput now
pauses 0.2 s before Enter, inside the same tmux call. Verified live: a
workflow step that ended its turn without finish_session was reminded once
and finished.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Artem Petrov <[email protected]>
@artempartos
artempartos force-pushed the feat/copilot-cli-runtime branch from 837386b to a1ffa20 Compare November 10, 2026 14:23
Copilot CLI's catalogue listed `auto` twice on a staging account, and every
model picker is a Mantine Select, which throws on a repeated value and took
the profile, sessions and other pages down with it. The adapter drops the
repeat, and agent_models_for_props now offers each model of any runtime once.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Artem Petrov <[email protected]>
artempartos added a commit that referenced this pull request Nov 11, 2026
* origin/feat/copilot-cli-runtime:
  fix(agents): offer each model once in the model pickers
  feat(sessions): remind a Copilot CLI step that ends its turn unfinished
  feat(agents): add GitHub Copilot CLI as an agent runtime
  fix(mcp): stop offering a notification stream the server cannot hold
… addresses

The external-runner work (task #216) hands adapters the session's callback
addresses instead of letting them read Settings. Accepting them now keeps the
Copilot adapter working on both sides of that change; without them a session
still reports to the platform's collector.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Artem Petrov <[email protected]>
artempartos added a commit that referenced this pull request Nov 11, 2026
* origin/feat/copilot-cli-runtime:
  refactor(agents): let the Copilot adapter take the session's callback addresses
With a project's full tool set Copilot CLI defers tools behind a search tool.
On staging an automatic session found `aixle-tools-finish_session` that way,
called `finish_session` instead, was told it does not exist, and never
finished. `toolSearch` and `dynamicRetrieval.mcp` are now off.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Artem Petrov <[email protected]>
artempartos added a commit that referenced this pull request Nov 11, 2026
* origin/feat/copilot-cli-runtime:
  fix(agents): keep the MCP tools in Copilot CLI's own tool list
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Artem Petrov <[email protected]>
@artempartos
artempartos merged commit 15961e2 into develop Nov 11, 2026
17 checks passed
@artempartos
artempartos deleted the feat/copilot-cli-runtime branch November 11, 2026 08:21
NOX73 added a commit that referenced this pull request Nov 11, 2026
…s-0-1-0

* origin/develop:
  feat(coder): clone GitLab, Bitbucket and Azure DevOps repos in coder_prepare_repo (#703)
  fix(agents): show each runtime's own logo everywhere (#704)
  feat(teams): assign cards to a team and run triggers as a team (#701)
  feat(agents): collect the Copilot CLI transcript as a session log (#700)
  fix(agents): keep Grok and Antigravity conversations in the terminal scrollback (#698)
  feat(billing): redesign the Billing tab around active and previous subscriptions (#646)
  feat(web): switch the UI, admin, public pages and emails to Inter (#699)
  chore(deps): weekly dependency batch — aws-sdk-core 3.267 retry fix, prism 2, Mantine 9.7.5, runner Go 1.27.4 (#697)
  fix(board): leave archived tasks out of agent board listings (#690)
  feat(agents): add GitHub Copilot CLI as an agent runtime (#684)
  feat(runners): the callback proxy — the proxy sidecar, the host runner relay and the gateway proxy route (task #216, 8b) (#677)

Signed-off-by: Rozhnov Alexandr <[email protected]>
aixle-com Bot pushed a commit that referenced this pull request Nov 11, 2026
Conflicts were between staging's feature-branch merges of #677, #684 and an
earlier head of #689 and develop's squash-merges of #677/#684 (plus #700,
#704). Each hunk takes develop's side (the final, reviewed version), except
config/settings.yml, which keeps the runners.release block of #689, and
CHANGELOG.md, which keeps both sides' entries. Staging-only content (#494)
merged without conflict and is kept.
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.

1 participant