fix(billing): hide budget-complete prompt for free zero-budget plans#2300
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughThis PR refines the budget completed message logic in ChangesBudget Completed Message Behavior
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Possibly related PRs
Suggested labels
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 ESLint
ESLint skipped: no ESLint configuration detected in root package.json. To enable, add Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
graycyrus
left a comment
There was a problem hiding this comment.
Looks good, nice work!
Summary
useUsageStateregression test for the FREE zero-budget case reported in Always asking for payment (FREE PLAN) #2129.Problem
FREE plan users with
cycleBudgetUsd=0andremainingUsd=0were treated as if they should see the completed-budget/payment prompt. That made a zero-recurring-budget FREE state look like an exhausted paid or included budget cycle, which matches the user-visible complaint in #2129.Solution
useUsageState()now derivesshouldShowBudgetCompletedMessagefrom the existing recurring-budget exhaustion check only. This keeps paid/included-budget exhaustion behavior unchanged while preventing FREE zero-budget users from seeing the budget-complete prompt.Submission Checklist
diff-cover) meet the gate enforced by.github/workflows/coverage.yml. Runpnpm test:coverageandpnpm test:rustlocally; PRs below 80% on changed lines will not merge.docs/TEST-COVERAGE-MATRIX.md## Related— no matrix feature row appliesdocs/RELEASE-MANUAL-SMOKE.md) — hook-only billing banner state changeCloses #NNNin the## RelatedsectionImpact
Runtime impact is limited to frontend billing/banner state. FREE users with no recurring budget no longer see the budget-complete prompt solely because both budget fields are zero. Users with a positive recurring budget still see the existing completed-budget warning after exhaustion.
Related
AI Authored PR Metadata (required for Codex/Linear PRs)
Linear Issue
Commit & Branch
codex/GH-2129-free-plan-budget-banner178f217d7461838b284a44f089694c9033b0ba20Validation Run
pnpm --filter openhuman-app format:check— attempted; Prettier passed, Rust fmt blocked by missingcargo(see Validation Blocked)pnpm typecheckpnpm --dir app exec vitest run src/hooks/useUsageState.test.ts --config test/vitest.config.tspnpm --dir app exec vitest run src/hooks/useUsageState.test.ts src/pages/__tests__/Conversations.render.test.tsx --config test/vitest.config.tsAdditional validation:
pnpm --dir app exec vitest run src/hooks/useUsageState.test.ts --config test/vitest.config.tsfailed before the production change withexpected true to be falseforshouldShowBudgetCompletedMessage.pnpm --dir app exec prettier --check src/hooks/useUsageState.ts src/hooks/useUsageState.test.tspnpm lint(passed with existing repo-wide warnings)pnpm test:coverage(297 test files passed, 2873 tests passed)node scripts/codex-pr-preflight.mjs --strict-path --lightweight(blocked on expected Codex path; see Validation Blocked)Validation Blocked
command:node scripts/codex-pr-preflight.mjs --strict-path --lightweighterror:[FAIL] expected repo path :: expected /workspace/openhuman, got /Users/sungjh/.config/superpowers/worktrees/openhuman/fix-free-plan-budget-bannerimpact:Local desktop worktree path differs from the Codex web path expected by the strict preflight. Required files, branch naming, remote, and changed-file readability checks passed.command:pnpm --filter openhuman-app format:checkerror:sh: cargo: command not foundimpact:Prettier completed successfully before the Rust fmt substep. This PR changes only TypeScript files;pnpm --dir app exec prettier --check src/hooks/useUsageState.ts src/hooks/useUsageState.test.tspassed.Behavior Changes
Parity Contract
isBudgetExhaustedandshouldShowBudgetCompletedMessage; routed-away chat workload suppression remains unchanged.Duplicate / Superseded PR Handling
#2129,FREE PLAN,asking for payment,completed budget, orbudgetComplete.Summary by CodeRabbit