Skip to content

feat(agents): land GitHub Copilot CLI provider#1124

Open
anxkhn wants to merge 1 commit into
manufosela:mainfrom
anxkhn:feat/copilot-agent-fix
Open

feat(agents): land GitHub Copilot CLI provider#1124
anxkhn wants to merge 1 commit into
manufosela:mainfrom
anxkhn:feat/copilot-agent-fix

Conversation

@anxkhn

@anxkhn anxkhn commented Jun 29, 2026

Copy link
Copy Markdown

What this PR solves

Lands GitHub Copilot CLI as a first-class provider, sitting next to claude, codex, gemini, aider, and opencode. CopilotAgent mirrors the Gemini/OpenCode adapters and drives the verified copilot v1.0.65 non-interactive surface:

  • copilot -p "<prompt>" -s --allow-all-tools --no-ask-user [--model] so it never blocks on a permission or ask-user prompt.
  • reviewTask adds --output-format json and parses the JSONL stream: the answer is the last assistant.message content, tokens_out sums per-message outputTokens, and the final result line carries sessionId/exitCode. Copilot exposes no prompt tokens, so tokens_in/cached_tokens stay 0 (unmeasured) instead of being faked.
  • Wires copilot into the registry, KNOWN_AGENTS, host detection (COPILOT_CLI), model registry, install hints, and the fallback-provider message.

This supersedes #1085, which used wrong flags (--allow-all, --silent) and a guessed OpenAI prompt_tokens schema that never matched copilot output. Pi is intentionally left out to keep this PR atomic.

How to test it

  • npm install
  • npm run lint (0 errors), npm run lint:syntax, npx prettier --check on changed files (clean)
  • npx vitest run tests/agents tests/config tests/brain tests/commands tests/integration (all pass)
  • Real CLI smoke (copilot v1.0.65 authed): reviewTask returned ok=true exit=0 output="smoke-ok" tokens_out=36, confirming the JSONL assistant.message/result parsing.

Tests added or modified

  • tests/agents/copilot-agent.test.js (new): surface flags, --model, exit codes, JSONL content + token parsing.
  • tests/agents/agent-detect.test.js, tests/integration/agents-index-contract.test.js: extend coverage to copilot.

Notes for the reviewer

Net source delta stays under the 200-LOC shrink budget (~194). README and docs are excluded by the gate.


Qué resuelve este PR

Incorpora la CLI de GitHub Copilot como proveedor de primera clase. CopilotAgent replica los adaptadores Gemini/OpenCode y usa la superficie verificada de copilot v1.0.65: -p con -s --allow-all-tools --no-ask-user [--model], y en reviewTask añade --output-format json para parsear el JSONL (contenido de assistant.message, outputTokens, y la línea result con sessionId/exitCode). Reemplaza los flags y el esquema JSON incorrectos de #1085. Pi se deja fuera para mantener el PR atómico.

Cómo probarlo

npm install, npm run lint, tests de agentes/config/brain/commands/integration, y smoke real con la CLI.

Tests añadidos o modificados

copilot-agent.test.js nuevo, mas extensiones en agent-detect e index-contract.

Notas para el revisor

Delta neto por debajo del presupuesto de 200 LOC.

Add a CopilotAgent adapter that mirrors the Gemini/OpenCode pattern and
uses the verified copilot v1.0.65 surface: a single prompt via -p, clean
final output with -s, autonomous runs with --allow-all-tools and
--no-ask-user, and --model passthrough. reviewTask adds --output-format
json and parses the JSONL stream (assistant.message content as the answer,
per-message outputTokens as tokens_out; the final result line carries
sessionId/exitCode). Register copilot in the agent index, KNOWN_AGENTS,
host detection (COPILOT_CLI), model registry, install hints, and the
fallback provider message. Replaces the wrong flags and guessed JSON
schema attempted in manufosela#1085.
@changeset-bot

changeset-bot Bot commented Jun 29, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 362d9e5

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

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