You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[frontend] Budget & limits settings surface — show 24h consumption vs each ceiling + distance-to-limit, and edit the limits (console owner + admin) #475
The account circuit breaker (250M tokens / $50 charged per 24h) is invisible until it fires — the number only appears in the refusal message after work is already blocked. The console Usage page shows consumption from the ai_usage ledger but never the ceiling or how close you are. There is no field anywhere to change the limit.
Scope
Usage/Budget panel (console, account owner): for each ceiling show current rolling-24h consumption, the ceiling, and distance-to-limit (a gauge), plus per-tree defaults and Loop iteration cap. Editable where policy allows (clamped to the max from the backend).
Admin portal: platform-default ceilings + per-account overrides (the operator view), living beside the existing /admin/settings surface.
Wire both to the new get/set endpoints from the backend + MCP tickets. No new source of truth in the client.
Notes
Folds in the earlier “breaker is invisible” gap. Admin portal is at /admin (host worker), role-gated; see #108 re: the Cloudflare Access perimeter.
Parked under #485 — AI budget enforcement is demoted to observe-only (BUDGET_ENFORCE default off) until paid launch, so there is nothing to configure/edit yet. Resume when enforcement returns.
When #475 is resumed specifically: ship the limits UI disabled with a visible "enforcement off" note (mirrors the note now on the console Usage page).
GET /v1/budget/limits — returns effective ceilings (4-tier resolution: per-account D1 → platform D1 → env → hard constant), current 24h rolling consumption, distance-to-limit for each ceiling, and which tier each was resolved from.
PUT /v1/budget/limits — upserts the caller's row in account_budget_limits (tokens and/or charged micros); null / absent = clear override (inherit). Values clamped to MAX_OVERRIDE_* constants. Returns re-resolved effective values.
Tests (budget.test.ts) — 16 tests: GET defaults, tier resolution (account/platform/default), consumption/remaining, owner scoping; PUT upsert, clamp to MAX, null-on-both deletes row, null-on-one stores NULL, negative/non-numeric rejection, auth.
OpenAPI — GET + PUT /v1/budget/limits documented under the Usage tag; docs:drift at 100%.
Note: per #485, budget enforcement is observe-only (BUDGET_ENFORCE off by default) — the UI and API are live but runs are never blocked by the ceiling until that flag is enabled at paid launch.
The Budget UI (BudgetPanel in store/console/src/pages/Usage.tsx) must display an observe-only notice when enforced === false from the /v1/budget/limits response. This is now implemented in the API (GET/PUT /v1/budget/limits both include enforced: boolean) — the console BudgetData interface already has enforced: boolean typed and the BudgetPanel already renders the notice. Shipped in #486.
Activity
serge-ivo commentedon Aug 10, 2026
Part of epic #478.
serge-ivo commentedon Aug 10, 2026
Parked under #485 — AI budget enforcement is demoted to observe-only (
BUDGET_ENFORCEdefault off) until paid launch, so there is nothing to configure/edit yet. Resume when enforcement returns.When #475 is resumed specifically: ship the limits UI disabled with a visible "enforcement off" note (mirrors the note now on the console Usage page).
feat(budget): demote AI circuit breakers to observe-only (BUDGET_ENFO…
serge-ivo commentedon Aug 10, 2026
Implemented in commit 2d8f9d5.
What shipped:
API route (
workers/api/src/routes/budget.ts)GET /v1/budget/limits— returns effective ceilings (4-tier resolution: per-account D1 → platform D1 → env → hard constant), current 24h rolling consumption, distance-to-limit for each ceiling, and which tier each was resolved from.PUT /v1/budget/limits— upserts the caller's row inaccount_budget_limits(tokens and/or charged micros);null/ absent = clear override (inherit). Values clamped to MAX_OVERRIDE_* constants. Returns re-resolved effective values.Console UI (
store/console/src/pages/Usage.tsx)BudgetPanelcomponent already committed in d951b5f (the [decision] Demote AI budget circuit breakers to observe-only (BUDGET_ENFORCE, default off) — keep structural caps + meter; re-enable at paid launch #485 observe-only commit) — two ceiling gauges (charged spend / tokens), tier label, remaining headroom, and an edit form. Wired to the new route.Tests (
budget.test.ts) — 16 tests: GET defaults, tier resolution (account/platform/default), consumption/remaining, owner scoping; PUT upsert, clamp to MAX, null-on-both deletes row, null-on-one stores NULL, negative/non-numeric rejection, auth.OpenAPI —
GET+PUT /v1/budget/limitsdocumented under the Usage tag; docs:drift at 100%.Note: per #485, budget enforcement is observe-only (
BUDGET_ENFORCEoff by default) — the UI and API are live but runs are never blocked by the ceiling until that flag is enabled at paid launch.fix(console): budget panel uses declared bg-panel token, not bg-canvas (
serge-ivo commentedon Aug 10, 2026
The Budget UI (
BudgetPanelinstore/console/src/pages/Usage.tsx) must display an observe-only notice whenenforced === falsefrom the/v1/budget/limitsresponse. This is now implemented in the API (GET/PUT /v1/budget/limitsboth includeenforced: boolean) — the consoleBudgetDatainterface already hasenforced: booleantyped and theBudgetPanelalready renders the notice. Shipped in #486.