fix(critique): validate tokenBudget and costBudgetUsd in TokenBudgetBreaker (#3666) - #3682
fix(critique): validate tokenBudget and costBudgetUsd in TokenBudgetBreaker (#3666)#3682djm204 wants to merge 3 commits into
Conversation
Records the verified current state (ContainerBeastExecutor already implemented per ADR-036) and the final 7-issue backlog, plus a lesson on verifying "doesn't exist" claims via direct file reads before filing issues. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
|
@codex review |
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
|
Closing as superseded. Main already has this PR's |
Fixes #3666.
Description
TokenBudgetBreaker compared spend.totalTokens against config.tokenBudget without validating numeric sanity. If tokenBudget was undefined, NaN, or non-positive, comparisons failed or evaluated unpredictably.
Changes
TokenBudgetBreaker.check()validatesconfig.tokenBudgetand throws aConfigurationErrorif!Number.isFinite(tokenBudget)ortokenBudget <= 0.config.costBudgetUsd(if specified) to ensure it is a non-negative number (>= 0).token-budget.test.ts.