feat: add PRU-aware budget config with Copilot plan presets#55
Draft
maxbeizer wants to merge 1 commit intomarcus:mainfrom
Draft
feat: add PRU-aware budget config with Copilot plan presets#55maxbeizer wants to merge 1 commit intomarcus:mainfrom
maxbeizer wants to merge 1 commit intomarcus:mainfrom
Conversation
- 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 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
Replaces the hardcoded
weeklyBudget * 4monthly limit approximation with proper Copilot plan-aware budget configuration.Changes
internal/config/config.goMonthlyLimitandCopilotPlanfields toProviderConfigCopilotPlanLimitsmap with all GitHub Copilot plan tiersGetCopilotMonthlyLimit()with cascading resolution:monthly_limit(user override)copilot_planpreset lookupweekly_tokens * 4fallback (backwards compatible)internal/budget/budget.go— UpdatedGetUsedPercent()to useGetCopilotMonthlyLimit()cmd/nightshift/commands/doctor.go— Updated doctor to use config-driven limitPlan Presets
freepropro_plusbusinessenterpriseConfig Example
Testing
8 new table-driven tests covering all plan presets, explicit override priority, unknown plan fallback, and backwards compatibility. All existing tests pass (one pre-existing
TestCurrentBranchflake unrelated to this change).Related: Builds on #54 (Copilot provider Execute wiring).