Skip to content

fix(tauri,ui): switch budget to daily mode and increase default#6

Merged
Ghvstcode merged 1 commit intomainfrom
fix-budget-daily-mode
Mar 23, 2026
Merged

fix(tauri,ui): switch budget to daily mode and increase default#6
Ghvstcode merged 1 commit intomainfrom
fix-budget-daily-mode

Conversation

@Ghvstcode
Copy link
Copy Markdown
Owner

Summary

  • Budget was falsely reporting 0 tokens remaining because the default weekly budget (700K) was too low for normal usage and the calculation compared all weekly tokens against it
  • Switched to daily mode: divides weekly budget into daily slices, compares only today's usage against the daily budget — each day starts fresh
  • Increased default weekly_token_budget from 700K to 5M (~714K/day) to match actual subscription capacity
  • Updated sidebar status card and budget settings UI to reflect daily mode

Test plan

  • Launch the app and check the sidebar budget bar shows a reasonable "Xk remaining" (not 0)
  • Verify the budget settings page shows "Use up to X% of daily budget"
  • Use Claude Code manually for a while, then check the budget bar updates (refreshes every 60s)
  • Confirm that when budget is exhausted, status card shows "Resets tomorrow"
  • Check that existing DB installations get migrated (700K → 5M) on first launch

…efault

The budget system was falsely reporting 0 tokens remaining because:

1. The default weekly_token_budget (700K) was far too low — normal
   manual Claude Code usage (200-300K tokens/day) would exhaust it
   in 2-3 days.

2. The calculation compared ALL weekly token usage against the weekly
   budget, so heavy usage early in the week would incorrectly exhaust
   the budget for remaining days.

Switch to daily mode: divide the weekly budget into daily slices and
compare only today's usage against the daily budget. Each day starts
fresh, so heavy usage on one day no longer poisons the rest of the
week. This better reflects how subscription rate limits actually work
(rolling windows, not rigid weekly lump sums).

- Increase default weekly_token_budget from 700K to 5M (~714K/day),
  matching typical subscription capacity for dailyModelTokens metric
- Change calculate_budget_status to use daily budget (weekly / 7)
  and compare against tokens_used_today instead of tokens_used_week
- Add migration 15 to update existing DB rows from 700K to 5M
- Update TS fallback default to match
- Update sidebar status card and budget settings UI for daily mode
@vercel
Copy link
Copy Markdown

vercel bot commented Mar 23, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
sustn Ready Ready Preview, Comment Mar 23, 2026 7:44am

@Ghvstcode Ghvstcode merged commit d575923 into main Mar 23, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant