Skip to content

feat: Integrate GitHub Copilot SDK #48

Description

@SergUdo

Summary

Integrate GitHub Copilot SDK as a native LLM provider (CopilotProvider) into the
ai-slop-gate provider pipeline. Currently a stub exists in planning only. This issue
tracks the full implementation.

Background

ai-slop-gate supports multiple LLM providers (Gemini, Groq, Ollama) via a
common LlmProvider base class. GitHub Copilot has announced an extensibility SDK
that allows programmatic access to Copilot's code-aware reasoning. This provider
would add Copilot as a zero-cost option for GitHub-native teams (no separate API key
required for users with an active Copilot subscription).

Goals

  • Implement CopilotProvider extending LlmProvider with kind = "llm", name = "copilot"
  • Replace the current StubCopilotClient with a real CopilotClient backed by the SDK
  • Support both analyze(diff) and collect(base_path) modes
  • Implement analyze_pr(repo, pr_id, token) for native GitHub PR integration
  • Add prompt file at providers/llm/prompts/copilot/deep.prompt
  • Register --provider copilot in CLI
  • Wrap with CachedProvider (same as Gemini/Groq)

Non-Goals

  • No changes to PolicyEngine, reporters, or cache layer
  • No Copilot-specific enforcement logic
  • No changes to existing providers

Architecture

CopilotProvider (providers/llm/copilot.py)
  extends LlmProvider
  kind = "llm"
  name = "copilot"
  
  analyze(code, input_file) -> ProviderObservation
    → loads deep.prompt
    → calls CopilotClient.run(task)
    → parses and validates JSON response
    → retry once with force_strict_json=True on InvalidAgentResponse
    → returns ProviderObservation

  analyze_pr(repo, pr_id, token) -> ProviderObservation
    → fetches PR diff via GitHub API
    → delegates to analyze(diff)

JSON contract (same as all LLM providers):

{
  "issues": [
    {
      "category": "string",
      "signal": "snake_case",
      "message": "non-empty",
      "severity": "low|medium|high|critical",
      "confidence": 0.85,
      "file": "path/to/file.py",
      "line": 42
    }
  ]
}

Implementation Steps

  • Monitor Copilot SDK public availability and API stability
  • Implement CopilotClient (replaces StubCopilotClient)
  • Implement CopilotProvider in providers/llm/copilot.py
  • Write providers/llm/prompts/copilot/deep.prompt
  • Register in providers/registry.py
  • Add --provider copilot to CLI args
  • Write unit tests in tests/unit/providers/test_copilot_provider.py
  • Update ai_slop_gate_snapshot.json (bump version)
  • Update ARCHITECTURE.md provider inventory

Acceptance Criteria

  • python -m ai_slop_gate.cli run --provider copilot --llm-local --policy policy.yml runs without error
  • CopilotProvider returns valid ProviderObservation with observations: List[Observation]
  • Cache works identically to Gemini/Groq (same CachedProvider wrapper)
  • Retry logic triggers on InvalidAgentResponse
  • All existing tests pass without modification

Blocked By

Copilot SDK public availability. SDK does not yet have a stable programmatic API
for non-interactive use outside VS Code. This issue should be revisited when
GitHub Copilot Extensibility exposes a
stable SDK for server-side use.

Labels

enhancement provider llm blocked

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions