Skip to content

[epic] AI budget & circuit-breaker limits are user-configurable via UI + MCP (today they are hardcoded constants) #478

Description

@serge-ivo

Goal

Every AI budget/limit a user can hit should be viewable and settable by the user via the UI and via MCP — not a hardcoded constant that requires a code edit + deploy to change.

Background (verified in code)

  • Account circuit breaker = two bare constants in workers/api/src/lib/delegation-budget-store.ts: DAILY_CEILING_MICROS ($50 charged/24h, line 95) and DAILY_TOKEN_CEILING (250M tokens/24h, line 112). Enforced in reserve(); nothing reads an env var, per-account column, or admin setting.
  • The only existing platform-AI setting is a boolean kill switch (PUT /v1/admin/settings/platform-ai).
  • The breaker is invisible until it fires — the number only shows in the refusal message, and the agent-facing guidance even implies a nonexistent "contact support to raise it" lever.
  • Cloudflare Access on the /v1/admin perimeter is currently off (see Enable Cloudflare Access on the /v1/admin perimeter before paid launch #108); admin is role-gated only.

Surfaced while investigating why 4 Coder agents went idle overnight — all tripped the 250M token breaker, and there was no way to see or change it.

Children

Done when

A user can see their rolling-24h consumption against every ceiling and raise/lower each limit from both the console and MCP, with a clamped safe maximum — no code change required.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3: laterDesign, strategy, or deferred pending a decision or demandenhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions