Skip to content

feat(agents): add GitHub Copilot agent provider#329

Merged
pocky merged 1 commit into
mainfrom
feature/F089-github-copilot-agent-provider-integratio
May 6, 2026
Merged

feat(agents): add GitHub Copilot agent provider#329
pocky merged 1 commit into
mainfrom
feature/F089-github-copilot-agent-provider-integratio

Conversation

@pocky
Copy link
Copy Markdown
Contributor

@pocky pocky commented May 5, 2026

Summary

  • Add github_copilot as the 6th agent provider, implementing the full AgentProvider interface via the copilot CLI binary with single-turn and multi-turn (session resume) support
  • Support provider-specific options including model, mode (interactive/plan/autopilot), effort (low/medium/high), allowed_tools, denied_tools, and allow_all, with enum validation at awf validate time
  • Integrate GitHub Copilot into the unified display-event abstraction, parsing JSONL streaming output (assistant.message_delta, tool.execution_start) through parseCopilotDisplayEvents
  • Update documentation, CHANGELOG, README, and user guides to reflect 6-provider support and Copilot-specific authentication and configuration options

Changes

Provider Implementation

  • internal/infrastructure/agents/copilot_provider.go: New CopilotProvider struct implementing AgentProvider via baseCLIProvider hooks; builds CLI args for single-turn (-p <prompt> --output-format=json --silent) and multi-turn (--resume=<id>) modes; inlines system prompt for first turn (no --system-prompt flag in Copilot CLI); validates mode and effort enums; parses JSONL display events and extracts assistant.message content; graceful fallback to raw output when session ID extraction fails
  • internal/infrastructure/agents/options.go: Add CopilotProviderOption functional option type and WithCopilotExecutor option for test injection
  • internal/infrastructure/agents/registry.go: Register CopilotProvider in RegisterDefaults() as the 6th provider
  • internal/infrastructure/agents/stream_filter.go: Minor update to accommodate new provider integration
  • pkg/display/event.go: Update display event handling to support Copilot JSONL event types

Tests

  • internal/infrastructure/agents/copilot_provider_unit_test.go: Unit tests for CLI arg construction, name/validate, and option delegation
  • internal/infrastructure/agents/copilot_provider_delegation_test.go: Delegation tests verifying Execute and ExecuteConversation correctly delegate to baseCLIProvider through hooks, covering first-turn, resume-turn, and system-prompt-inlining scenarios
  • internal/infrastructure/agents/copilot_provider_extract_test.go: Tests for extractCopilotTextContent and extractCopilotSessionID covering valid JSONL, missing fields, empty output, and camelCase sessionId key
  • internal/infrastructure/agents/copilot_provider_parse_display_events_test.go: Tests for parseCopilotDisplayEvents covering assistant.message_delta, tool.execution_start, unknown event types, and missing optional fields
  • internal/infrastructure/agents/copilot_provider_validation_unit_test.go: Enum validation tests for mode and effort options
  • internal/infrastructure/agents/provider_options_test.go: Updated to include CopilotProviderOption coverage
  • internal/infrastructure/agents/registry_test.go: Updated registry assertions to expect 6 providers

Documentation

  • CHANGELOG.md: Add F089 entry documenting all Copilot provider capabilities
  • CLAUDE.md: Add architecture rule for provider name prefixes on helper methods; update provider count to 6; remove stale rule
  • README.md: Add GitHub Copilot to feature bullets and provider lists
  • docs/README.md: Update agent-steps link description to include GitHub Copilot
  • docs/user-guide/agent-steps.md: Add GitHub Copilot section with YAML example, all supported options, authentication methods; update provider count to 6 throughout
  • docs/user-guide/conversation-steps.md: Add github_copilot to provider table and session resume flag documentation

Test plan

  • make test-unit passes with all new Copilot provider tests green
  • awf validate reports enum errors for invalid mode/effort values on a Copilot agent step
  • With copilot CLI installed and authenticated, awf run executes a single-turn github_copilot step and returns agent output
  • Multi-turn conversation with continue_from correctly passes --resume=<session-id> on subsequent turns

Closes #328


Generated with awf commit workflow

- `internal/infrastructure/agents/copilot_provider.go`: Implement `github_copilot` provider with single-turn and multi-turn conversation support via `copilot` CLI
- `internal/infrastructure/agents/copilot_provider_unit_test.go`: Add unit tests for provider construction, execution, and session handling
- `internal/infrastructure/agents/copilot_provider_delegation_test.go`: Add delegation tests validating shared behavior contracts
- `internal/infrastructure/agents/copilot_provider_extract_test.go`: Add extraction tests for session ID and output parsing
- `internal/infrastructure/agents/copilot_provider_parse_display_events_test.go`: Add JSONL stream display event parsing tests
- `internal/infrastructure/agents/copilot_provider_validation_unit_test.go`: Add option validation tests for mode and effort enums
- `internal/infrastructure/agents/options.go`: Add Copilot-specific option keys (model, mode, effort, tools, allow_all)
- `internal/infrastructure/agents/provider_options_test.go`: Extend provider options tests to cover Copilot options
- `internal/infrastructure/agents/registry.go`: Register `github_copilot` as 6th provider in `RegisterDefaults()`
- `internal/infrastructure/agents/registry_test.go`: Update registry tests to include Copilot provider assertions
- `internal/infrastructure/agents/stream_filter.go`: Extend JSONL stream filtering to handle Copilot output format
- `pkg/display/event.go`: Update display event parsing to support Copilot JSONL event structure
- `CHANGELOG.md`: Document F089 GitHub Copilot provider addition
- `CLAUDE.md`: Add provider name prefix rule and update project overview
- `README.md`: Update feature descriptions to include GitHub Copilot
- `docs/README.md`: Update agent steps documentation link description
- `docs/user-guide/agent-steps.md`: Add GitHub Copilot provider documentation with options and auth
- `docs/user-guide/conversation-steps.md`: Add `github_copilot` to conversation mode provider list

Closes #328
@pocky pocky marked this pull request as ready for review May 5, 2026 12:13
@pocky pocky merged commit db9c1d0 into main May 6, 2026
6 of 7 checks passed
@pocky pocky deleted the feature/F089-github-copilot-agent-provider-integratio branch May 6, 2026 19:02
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.

F089: GitHub Copilot Agent Provider Integration

1 participant