Skip to content

fix: add monthly budget support to dashboard#364

Open
LegionInterns wants to merge 1 commit intomainfrom
fix/dashboard-monthly-budget
Open

fix: add monthly budget support to dashboard#364
LegionInterns wants to merge 1 commit intomainfrom
fix/dashboard-monthly-budget

Conversation

@LegionInterns
Copy link
Collaborator

Problem

The dashboard budget endpoints only handled daily_usd, silently resetting monthly_usd to the $200 default on every update. This meant any custom monthly budget was lost whenever the daily budget was changed.

Root Cause

CostTracker.set_budget() takes both daily_usd and monthly_usd with defaults, but both dashboard endpoints only passed daily_usd, so monthly_usd always reset to 200.0.

Fix

  • PUT /api/agents/{id}/budget: Accept optional monthly_usd, read current budget before updating so the other limit is preserved
  • PUT /api/agents/{id} (general edit): Same treatment for the budget field
  • Dashboard JS: Add budget_monthly to edit form, send both values to API
  • Dashboard HTML: Add monthly budget input field next to the daily one

Testing

  • Verified bug: set_budget(agent, daily_usd=100) resets monthly to $200
  • Verified fix: both endpoints now preserve the untouched limit
  • Cost tracker tests pass (20/20)

The dashboard budget endpoints only handled daily_usd, silently resetting
monthly_usd to the $200 default on every update. This meant any custom
monthly budget was lost whenever the daily budget was changed.

Fix:
- api_update_budget: accept optional monthly_usd, preserve current value
  when not provided
- agent edit endpoint: same treatment for the budget field
- Dashboard JS: add budget_monthly to edit form, send both values
- Dashboard HTML: add monthly budget input field

Both endpoints now read the current budget before calling set_budget()
so updating one limit doesn't reset the other.
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