feat(gateway): promote GitHub Copilot to a stable backend#14
Open
anxkhn wants to merge 1 commit into
Open
Conversation
The copilot adapter was marked experimental and only spawned a bare `-p` prompt, so it had no structured output, no resume, and could hang on permission prompts. Upgrade it to mirror the stable Claude adapter: - Emit JSONL via --output-format json (final result line carries sessionId and exitCode) and parse Copilot's assistant.message and result events in AgentSession. - Capture sessionId from the result line and resume with --session-id so multi-agent runs keep per-agent context. - Auto-approve non-interactive runs (--allow-all-tools, --allow-all on full access) and never block with --no-ask-user. - Pass --model through. - Set stability stable, supportsResume, supportsStructuredOutput, guardType flag.
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.
What
Promotes the GitHub Copilot adapter in
apps/gateway/src/backends.tsfromexperimentaltostable, bringing it to parity with the Claude/Codex stable adapters. Previously Copilot just spawned a bare-pprompt: no structured output, no session resume, and it could hang on a permission prompt.Why
The CLI is mature enough to drive autonomously. Wiring up the documented one-shot flags makes it usable for multi-agent runs like the existing stable backends.
Changes
apps/gateway/src/backends.ts: copilot is nowstable,supportsResume: true,supportsStructuredOutput: true,guardType: "flag".buildArgsemits--output-format json, auto-approves with--allow-all-tools(--allow-allon full access) and--no-ask-user, resumes via--session-id, and passes--modelthrough.packages/orchestrator/src/agent-session.ts: parse Copilot JSONL: capturesessionIdfrom the finalresultline for resume, and surface the finalassistant.messagecontent (deltas skipped to avoid dupes).Verification (real copilot v1.0.65, authed)
pnpm install; gateway bundles via tsup; orchestrator/gateway typecheck show only 2 pre-existing errors (prompt-templates.ts:406,telegram-channel.ts:391), unchanged by this PR.sessionId/exitCode:0, then resumed with the same--session-idand Copilot correctly recalled prior context.Licensing
This repo has no LICENSE file. Contribution terms are unclear; please confirm how you want external contributions handled before merging.