-
Notifications
You must be signed in to change notification settings - Fork 38
Description
Problem
The orchestrator calls o.agent.Execute() directly for plan/implement/review phases (orchestrator.go L442, L502, L616). This bypasses the provider layer entirely, which means:
providers.Copilot.Execute()is never calledIncrementRequestCount()never fires~/.copilot/nightshift-usage.jsonis never writtennightshift budget --provider copilotalways shows 0% used
For Claude and Codex this is less impactful because they read usage from external files (~/.claude/stats-cache.json, ~/.codex/sessions/). But Copilot has no external usage file — the provider's request counter is the only tracking mechanism.
Reproduction
nightshift task run docs-backfill --provider copilot
# completes successfully, opens PR
nightshift budget --provider copilot
# shows 0% used — should show requests consumedSuggested fix
Route agent execution through the provider layer so providers can hook into the execution lifecycle (tracking, rate limiting, cost estimation). Something like:
// Instead of:
execResult, err := o.agent.Execute(ctx, opts)
// Route through provider:
result, err := o.provider.Execute(ctx, task)
// provider.Execute() delegates to agent internally and handles trackingThis would also enable future features like per-provider rate limiting or cost-based model selection.
Context
Found while testing Copilot provider improvements (PRs #54, #55, #56). The provider Execute() method correctly increments the counter, but the orchestrator never calls it.