From 0a4307f620b1d0bff95edb875a84fafcfeed6c36 Mon Sep 17 00:00:00 2001 From: andy-xu-db <310751426+andy-xu-db@users.noreply.github.com> Date: Thu, 3 Sep 2026 18:47:54 +0000 Subject: [PATCH] usage: say what to do when budget spend is unavailable `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 --- src/ucode/usage.py | 5 ++++- tests/test_usage.py | 3 ++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/ucode/usage.py b/src/ucode/usage.py index 5d8345b5..ef05bc54 100644 --- a/src/ucode/usage.py +++ b/src/ucode/usage.py @@ -797,7 +797,10 @@ def usage(warehouse_id: str | None = None) -> int: if budget_lines: console.print("\n".join([heading("Usage Budget"), "", *budget_lines])) else: - print_note("Budget spend and threshold are unavailable.") + print_note( + "Budget spend and threshold are unavailable. " + "Please configure a coding agent budget policy first." + ) if not prompt_yes_no_default( "Show token usage and estimated cost details? This queries a SQL warehouse.", diff --git a/tests/test_usage.py b/tests/test_usage.py index 777cd442..8d567b00 100644 --- a/tests/test_usage.py +++ b/tests/test_usage.py @@ -714,7 +714,8 @@ def fake_render_box_table(headers, table_rows, max_widths=None): assert "Claude Code ยท Last 7 Days" in headings assert all("Gemini" not in heading for heading in headings) assert notes == [ - "Budget spend and threshold are unavailable.", + "Budget spend and threshold are unavailable. " + "Please configure a coding agent budget policy first.", "Using SQL warehouse `wh` (RUNNING).", f"No usage for Claude Code in the last {USAGE_BREAKDOWN_DAYS} days.", ]