1+ import { normalizeGoalBudgetCents } from "@/common/utils/goals/budgetPricing" ;
12import type { APIClient } from "@/browser/contexts/API" ;
23import { DEFAULT_GOAL_DEFAULTS , normalizeGoalDefaults , type GoalDefaults } from "@/constants/goals" ;
34
@@ -7,8 +8,8 @@ import { DEFAULT_GOAL_DEFAULTS, normalizeGoalDefaults, type GoalDefaults } from
78 *
89 * - `budgetCents` is a discriminated tri-state:
910 * - `undefined` → "user did not specify; apply default"
10- * - `null` → "user explicitly cleared the budget"
11- * - `number` → explicit cents value
11+ * - `null` or `0` → "no budget" (explicit clear)
12+ * - positive `number` → explicit cents value
1213 */
1314export interface GoalSetIntentInput {
1415 objective : string ;
@@ -29,7 +30,7 @@ export interface GoalSetIntent {
2930 * - If the caller omitted `budgetCents`:
3031 * - `alwaysRequireExplicitBudget` → fall back to `defaultBudgetCents`.
3132 * - Otherwise → `null` (no budget).
32- * - `null` is preserved (explicit "no budget" clear).
33+ * - `null` and `0` both become no budget (explicit "no budget" clear).
3334 * - If the caller omitted `turnCap`, fall back to `defaultTurnCap`.
3435 *
3536 * Coder-agents-review P3 DEREM-27: the slash command path (`/goal`) used to
@@ -44,9 +45,9 @@ export function resolveGoalSetIntent(
4445) : GoalSetIntent {
4546 let budgetCents : number | null ;
4647 if ( input . budgetCents !== undefined ) {
47- budgetCents = input . budgetCents ;
48+ budgetCents = normalizeGoalBudgetCents ( input . budgetCents ) ;
4849 } else if ( defaults . alwaysRequireExplicitBudget ) {
49- budgetCents = defaults . defaultBudgetCents ;
50+ budgetCents = normalizeGoalBudgetCents ( defaults . defaultBudgetCents ) ;
5051 } else {
5152 budgetCents = null ;
5253 }
0 commit comments