feat(cli): allow interactive scan budget increases - #724
Conversation
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
@codex review Please review commit |
|
Codex Review: Didn't find any major issues. Another round soon, please! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
|
@codex review Please review commit |
|
Codex Review: Didn't find any major issues. Hooray! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
Summary
Interactive scans currently stop when their estimated cost exceeds
--max-cost, even when the user would approve more spending. This change offers a higher total limit at 80% of the current budget, while the scan is still running. The original limit remains active until the increase is saved, and continuing preserves the scan ID, completed work, and accumulated cost.The change also fixes accounting needed for reliable budget decisions: a parent receipt can be lost when only worker logs are available, and a cost-limit error can omit usage recorded while the scan is stopping.
Changes
onBudgetApproaching({ maxCostUsd, cost, signal })callback and report the effective limit throughonCost(cost, maxCostUsd). Decisions do not block tracking; invalid, failed, or late increases leave the old limit enforced.Testing
--seed=12345).3825532106): 426 passed, 2 skipped. Typecheck, formatting, Ruff 0.16.1 lint and format checks, portable source checks, and package installation checks passed.git diff --check: passed.Terminal QA used synthetic model usage. No billable model calls were made; platform-specific and opt-in integration tests remain subject to their normal skip conditions.
Risk and rollout
The existing
--max-costoption now offers increases only in the interactive scan dashboard. SDK callers opt in through the new callback; callers without it retain automatic stopping. Only finite totals above the current limit and latest estimate are accepted, and cancellation takes precedence over a late answer.This does not pause model work or resume a scan after exhaustion. The old limit can still stop the scan while the user decides, and sampled estimates can overshoot the cap. Post-scan prompts remain outside scan cost tracking, as documented. Bulk and component budget interactions are unchanged. No database migration is needed.
Public disclosure review