feat: Add GitHub Copilot CLI adapter#66
Open
benferse wants to merge 2 commits into
Open
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
copilot --acphas occasional delays, and seemingly exposed a race in the cleanup between runs. Added a potential fix for that too