fix(#19): config max_projects, budget day-boundary, codex fallback flags#42
Merged
fix(#19): config max_projects, budget day-boundary, codex fallback flags#42
Conversation
Allow configuring AI models per provider in config.yaml:
Config:
- providers.<provider>.model: model name to use
- Supports Claude, Codex, and Copilot providers
Implementation:
- Add Model field to ProviderConfig
- Add Model field to ExecuteOptions (agents)
- Update all agents to pass --model flag
- Add WithModel/WithCodexModel/WithCopilotModel options
Usage:
providers:
claude:
model: "claude-sonnet-4.5"
codex:
model: "gpt-5.2-codex"
copilot:
model: "claude-sonnet-4.6"
Models default to CLI defaults if not specified.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Add a new 'Models' step to the setup wizard between Safety and Task presets. Users can navigate providers with ↑/↓ and cycle through available models with ←/→. Model options: - Claude: claude-opus-4-6, claude-sonnet-4-6, claude-haiku-4-5 - Codex: gpt-5.3-codex, gpt-5.3-codex-spark, gpt-5.2-codex, gpt-5.2, gpt-5.1-codex-max, gpt-5.1-codex, gpt-5.1, gpt-5-codex, gpt-5 - Copilot: full list of 17 supported --model values Selected model is saved to cfg.Providers.<X>.Model and picked up by the agent helpers introduced in the model-selection branch. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Replace WriteString(fmt.Sprintf(...)) with fmt.Fprintf(&buf, ...) across setup.go, report.go, analysis/report.go, reporting/run_report.go, reporting/summary.go (QF1012) - Remove empty branch in helpers.go copilot DangerouslySkipPermissions check (SA9003) - Remove unused requestCount and lastReset fields from providers.Copilot struct (unused) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Bug 1 — schedule.max_projects config value ignored by run command: - Add MaxProjects/MaxTasks fields to ScheduleConfig in config.go - In runRun(), after loading config, apply cfg.Schedule.MaxProjects when --max-projects was not explicitly passed on the CLI - Same treatment for max-tasks / cfg.Schedule.MaxTasks Bug 2 — budget calibration reports exhausted at day/week boundary: - At week boundary (no snapshots for new week yet), calibrator returned config value which could be 0 when user relies on calibration - Add loadPreviousWeeklySamples() and fall back to prior week's data before returning the config default - Refactor loadClaudeWeeklySamples/loadCodexWeeklySamples to share loadWeeklySamplesForWeek() implementation Bug 3 — Codex provider crashes (exit 2) as automatic fallback: - newCodexAgentFromConfig() always passed WithDangerouslyBypassApprovals AndSandbox(cfg.Providers.Codex.DangerouslyBypassApprovalsAndSandbox) - Go bool zero value is false, so unconfigured Codex got bypassPerm=false, stripping --dangerously-bypass-approvals-and-sandbox from exec args - Fix: only override agent default when config value is true; agent already defaults bypassPerm=true for non-interactive (headless) operation Tests: add targeted tests for all three fixes. Fixes #19
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.
Fixes three bugs reported in #19.
Bug 1 —
schedule.max_projectsconfig value ignored byruncommandRoot cause:
runRun()read the--max-projectsflag value at startup (defaulting to 1), then never checkedcfg.Schedule.MaxProjectsafter loading config.Fix:
MaxProjectsandMaxTasksfields toScheduleConfiginconfig.go(schedule.max_projects,schedule.max_tasks)runRun(), apply the config value when the CLI flag was not explicitly changed:Bug 2 — Budget calibration reports "exhausted" at day/week boundary despite 0% usage
Root cause: At a week boundary (midnight, new week starts), the calibrator queries snapshots by
week_startand finds 0 rows for the new week. It then falls back tocfg.GetProviderBudget()which is 0 when the user relies on calibration rather than a hardcodedweekly_tokens. A 0-token budget causes the budget calculation to report 0 allowance → provider appears exhausted.Fix:
loadPreviousWeeklySamples()that queries the prior week's snapshot rowsloadClaudeWeeklySamples/loadCodexWeeklySamplesto share a commonloadWeeklySamplesForWeek()implementationBug 3 — Codex provider crashes with exit status 2 in automatic fallback path
Root cause:
newCodexAgentFromConfig()always passedWithDangerouslyBypassApprovalsAndSandbox(cfg.Providers.Codex.DangerouslyBypassApprovalsAndSandbox). Since Go's bool zero value isfalse, an unconfigured Codex provider gotbypassPerm=false, stripping--dangerously-bypass-approvals-and-sandboxfrom thecodex execinvocation. Codex requires this flag for non-interactive (headless) execution and exits 2 without it.Fix:
true) when the config explicitly enables the flagbypassPerm: true; no-op if the user hasn't configured Codex explicitlyTests
TestCalibrateWeekBoundaryFallsBackToPreviousWeek— calibrator uses prior-week data at week boundaryTestScheduleMaxProjectsFromConfig/TestScheduleMaxProjectsCLIOverridesConfig— config/CLI precedence for max_projectsTestCodexAgentDefaultsBypassFlag/TestCodexAgentExplicitFalseBypassDisablesFlag— bypass flag behaviourAll existing tests pass (
go test ./...).