Skip to content

feat: Add GitHub Copilot CLI adapter#66

Open
benferse wants to merge 2 commits into
wiggumdev:mainfrom
benferse:feat/copilot
Open

feat: Add GitHub Copilot CLI adapter#66
benferse wants to merge 2 commits into
wiggumdev:mainfrom
benferse:feat/copilot

Conversation

@benferse
Copy link
Copy Markdown

  • Add an adapter to drive GitHub Copilot CLI via ACP
  • The preview startup of copilot --acp has occasional delays, and seemingly exposed a race in the cleanup between runs. Added a potential fix for that too
  • Doc updates to include copilot

benferse and others added 2 commits May 21, 2026 20:43
Adds a fourth ACP-based adapter for `copilot --acp`, alongside the
existing Claude, OpenCode, and Gemini adapters. All four adapters share
the AcpAdapter base class — no protocol-layer changes required.

The adapter sets Copilot's Autopilot session mode (URL ID
`https://agentclientprotocol.com/protocol/session-modes#autopilot`),
described by the agent as 'Autonomous mode that enables allow-all and
runs until task completion without user interaction.' Permission
requests still flow over ACP for writes/exec; Ralph's existing yolo
handling auto-approves them for unattended runs.

Resume uses the form: `copilot --resume=<id>`.

Pre-flight verified live against copilot 1.0.52-0:
- agentCapabilities.loadSession: true
- ACP requestPermission flow used for writes/exec
- No _meta.toolName field (base extractToolName remains correct)
- End-to-end smoke test: ralph run --once created an expected file

Changes:
- packages/cli/src/adapters/copilot.ts (new) — CopilotAcpAdapter
- packages/cli/src/adapters/index.ts — register in factory
- packages/cli/src/config/schema.ts — add 'copilot' to AdapterType enum
- packages/cli/src/commands/init.ts — add as choice 4 in selectAdapter
- Tests: adapters/index.test.ts, config/schema.test.ts,
  commands/init.test.ts (+7 passing tests, parity with other adapters)
- Docs: README.md, configuration/cli/installation/quickstart/architecture/
  acp announcement mdx files

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
The same AcpAdapter instance is reused across ralph run iterations. When
iteration 1 finishes, two cleanup() chains start concurrently (one from
run()'s finally, one from the actor dispose calling cancel()) while
xstate has already invoked iteration 2 and called run() again. A late
cleanup could null this.connection mid-run, causing iteration 2 to fail
with 'undefined is not an object (evaluating this.connection.newSession)'.

Track a shared cleanupPromise and await it at the start of run() so the
previous iteration is fully torn down before spawning the new subprocess
and ClientSideConnection.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
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