Skip to content

[frontend] Budget & limits settings surface — show 24h consumption vs each ceiling + distance-to-limit, and edit the limits (console owner + admin) #475

Closed

Description

@serge-ivo

Depends on the config resolver (backend ticket).

Problem

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

  1. 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).
  2. Admin portal: platform-default ceilings + per-account overrides (the operator view), living beside the existing /admin/settings surface.
  3. 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.

Activity

  1. serge-ivo commented on Aug 10, 2026

    @serge-ivo
    ContributorAuthor

    Part of epic #478.

  2. serge-ivo commented on Aug 10, 2026

    @serge-ivo
    ContributorAuthor

    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).

  3. added
    deferred-by-#68Parked under the focus bet (#68) — picking this up is a deliberate override
    on Aug 10, 2026
  4. serge-ivo commented on Aug 10, 2026

    @serge-ivo
    ContributorAuthor

    Implemented in commit 2d8f9d5.

    What shipped:

    API route (workers/api/src/routes/budget.ts)

    Console UI (store/console/src/pages/Usage.tsx)

    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.

  5. serge-ivo commented on Aug 10, 2026

    @serge-ivo
    ContributorAuthor

    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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    deferred-by-#68Parked under the focus bet (#68) — picking this up is a deliberate overrideenhancementNew feature or requestfrontendFrontend / UI work

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions