Skip to content

usage: say what to do when budget spend is unavailable - #483

Open
andy-xu-db wants to merge 1 commit into
mainfrom
andy/usage-budget-policy-hint
Open

usage: say what to do when budget spend is unavailable#483
andy-xu-db wants to merge 1 commit into
mainfrom
andy/usage-budget-policy-hint

Conversation

@andy-xu-db

Copy link
Copy Markdown
Collaborator

What

ucode usage prints a single note when the gateway reports no coding-agent budget spend:

• Budget spend and threshold are unavailable.

That names what is missing but not the next step. It now reads:

• Budget spend and threshold are unavailable. Please configure a coding agent budget policy first.

Why

resolve_current_budget_spend returns nothing when recommendModel reports no effective_threshold — in practice, a workspace with no coding-agent budget policy attached (the endpoint also needs its per-org SAFE flag on). Configuring one, via ucode setup spend-tiers + ucode publish, is what makes the Usage Budget section appear, so the note now says so.

Note the same note is also reached when the recommendModel call itself fails, where the added sentence is advice rather than a diagnosis; the reason string is discarded at the call site today, so distinguishing the two cases is left out of this change.

Test

  • uv run pytest tests/test_usage.py — 90 passed; the assertion in TestUsageCommand that pins this note is updated.
  • uv run pytest — 2245 passed, 38 skipped. The two tests/test_e2e_user_agent.py failures are environmental (they launch the real agent CLIs against a capture server) and reproduce on unmodified main.
  • uv run ruff check . — clean.

This pull request and its description were written by Isaac.

`ucode usage` printed only "Budget spend and threshold are unavailable."
when the gateway reported no coding-agent budget spend, which names what
is missing but not the next step. Point the reader at configuring a
coding agent budget policy in the same note.

Co-authored-by: Isaac <no-reply@databricks.com>
@andy-xu-db
andy-xu-db requested a review from tt-le September 3, 2026 19:18
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