feat: add GitHub Copilot SDK backend with CLI fallback - #2392
Open
nimide wants to merge 2 commits into
Open
Conversation
nimide
marked this pull request as ready for review
August 2, 2026 13:10
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.
Summary
Add GitHub Copilot as an explicit headless LLM backend for Graphify through two transports:
copilot-sdk— preferred structured integration using the official Python SDK and a persistent Copilot runtime.copilot-cli— standalone one-shot subprocess backend and automatic compatibility fallback.The integration covers semantic extraction, LLM-assisted deduplication, community naming, PR triage, usage reporting, model selection, timeout handling, and raster-image attachments through the SDK.
Related: #959, #975, #976, #981
Prior implementation discussion: #1041
Motivation
Graphify already supports API-backed providers and a local CLI transport. Copilot users should also be able to run Graphify's semantic pass through their existing Copilot entitlement and authenticated GitHub environment without Graphify parsing or persisting OAuth credentials.
The SDK is the preferred transport because it provides structured sessions, responses, image attachments, and a long-lived runtime. The CLI adapter remains valuable for diagnostics, Python 3.10 compatibility, managed environments that do not install the Python SDK, and SDK/runtime incompatibilities.
What changed
New
copilot-clibackendcopilotexecutable with the prompt on standard input.New
copilot-sdkbackendgithub-copilot-sdk>=1.0.7,<2on Python 3.11+.mode="empty", registers no tools or MCP servers, rejects permission requests, and disables memory, infinite sessions, configuration discovery, and remote sessions.copilot-clion SDK import, startup, transport, timeout, session, response, or cleanup failures unlessGRAPHIFY_COPILOT_SDK_FALLBACK=0is set.Integration, packaging, and portability
copilotoptional dependency extra while retaining Graphify's Python 3.10 floor.uv.lock, including the Python 3.11 marker forgithub-copilot-sdk==1.0.7.source_filevalues are stable across Windows and POSIX systems.Usage
Development install:
Use an existing GitHub.com login, or authenticate to a GitHub Enterprise Cloud data-residency host:
copilot login --host https://example.ghe.com export COPILOT_GH_HOST=example.ghe.comRun the preferred SDK backend:
Select the CLI transport directly:
Require SDK success and disable fallback:
export GRAPHIFY_COPILOT_SDK_FALLBACK=0Compatibility
copilot-sdkcan use the direct CLI fallback;copilot-cliremains directly selectable.Security and privacy behavior
Validation
Focused and adjacent regression suite:
Additional checks:
A bounded extraction-CLI comparison produced the same 20 environment-related failures on the unchanged source snapshot and the feature branch. Those tests require tree-sitter packages that were unavailable in the offline validation environment, and several spawn an isolated interpreter where the checkout was not installed. No Copilot backend test failed.
A live Copilot request was not made from the validation environment because it had no authenticated Copilot account or approved test corpus. SDK and CLI behavior was exercised with controlled protocol/subprocess fakes.
Checklist