feat: wire Copilot provider Execute() to agent and add PRU multipliers#54
Draft
maxbeizer wants to merge 4 commits intomarcus:mainfrom
Draft
feat: wire Copilot provider Execute() to agent and add PRU multipliers#54maxbeizer wants to merge 4 commits intomarcus:mainfrom
maxbeizer wants to merge 4 commits intomarcus:mainfrom
Conversation
- Connect providers.Copilot.Execute() to agents.CopilotAgent via CopilotExecutor interface (avoids import cycle) - Add PRUMultiplier map with current GitHub Copilot model costs (GPT-4.1=0x, Sonnet=1x, Opus=10x, o3-pro=50x, etc.) - Add EstimatePRUCost() helper for budget-aware task routing - Add Task.Prompt and Result.Output/ExitCode fields to provider types - Increment request counter on each execution for budget tracking - Tests for Execute wiring, error handling, and PRU cost estimates Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Add MonthlyLimit and CopilotPlan fields to ProviderConfig - Add CopilotPlanLimits map: free=50, pro=300, pro_plus=1500, business=300, enterprise=1000 PRUs/month - Add GetCopilotMonthlyLimit() with resolution order: MonthlyLimit > CopilotPlan preset > weeklyTokens*4 fallback - Update budget.Manager to use GetCopilotMonthlyLimit() instead of hardcoded weeklyBudget*4 approximation - Update doctor command to use config-driven monthly limit - Table-driven tests for all plan presets and fallback behavior Config example: [providers.copilot] copilot_plan = "pro" # auto-sets 300 PRUs/month # or: monthly_limit = 500 # explicit override Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This was referenced Mar 9, 2026
The old check looked for gh-copilot in 'gh extension list', but modern gh versions have copilot built-in (not as an extension). This caused Available() to return false even when 'gh copilot' worked fine. Now probes 'gh copilot --version' which works for both built-in and extension-based installs. 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.
Summary
Connects the Copilot provider's
Execute()method to the existingCopilotAgentand adds PRU (Premium Request Unit) cost awareness.Changes
internal/providers/copilot.goCopilotExecutorinterface to bridge provider → agent without import cycleExecute()to delegate to the agent, increment request counter on each callPRUMultipliermap with current GitHub Copilot model costs (GPT-4.1=0x free, Sonnet=1x, Opus=10x, o3-pro=50x)EstimatePRUCost()helper for budget-aware task routinginternal/providers/provider.goPrompt,WorkDir,Filesfields toTaskOutput,ExitCodefields toResultinternal/providers/copilot_test.goEstimatePRUCost()across all model tiersWhy
The Copilot provider had a fully implemented agent (
internal/agents/copilot.go) but the provider'sExecute()was a no-op stub. This wires them together so the orchestrator can use Copilot end-to-end.The PRU multiplier map enables future budget-aware model selection — nightshift can pick cheap models (GPT-4.1, 0 PRUs) for simple tasks like lint-fix and reserve expensive models (Opus, 10 PRUs) for complex work like bug-finding.
Testing
All existing tests pass + 4 new tests added.
Related: Part of a series improving Copilot support. See also upcoming PRs for PRU-aware budget config and COPILOT_INTEGRATION.md.