From efe805387e5ad57215ece5e59d5e7342361eed23 Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Tue, 11 Aug 2026 12:43:03 +0200 Subject: [PATCH] Title a model-scoped limit the way the flat ones title themselves A scoped window read as "Fable weekly" beside "Session" and "Weekly", so the one row that names a model was also the one row in lowercase. Co-Authored-By: Claude Opus 5 --- bin/omarchy-agent-usage-claude | 9 +++++---- test/shell.d/agent-usage-claude-limits-test.sh | 8 ++++---- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/bin/omarchy-agent-usage-claude b/bin/omarchy-agent-usage-claude index 167e0223..49a6561a 100755 --- a/bin/omarchy-agent-usage-claude +++ b/bin/omarchy-agent-usage-claude @@ -653,15 +653,16 @@ def usage_bucket(payload: dict[str, Any], key: str) -> dict[str, Any] | None: # ("weekly_scoped", "five_hour_scoped"). The panel reads a window out of free # text, which cannot survive a model name like "Opus 5 (1M context)" — the # "1M" reads as a one-minute window — so the window is settled here instead -# and travels as an explicit title. +# and travels as an explicit title. It is capitalized the way the flat windows +# title themselves, so "Fable Weekly" sits beside "Weekly" rather than under it. def scoped_window(kind: str) -> str: text = kind.lower() if "month" in text: - return "monthly" + return "Monthly" if "week" in text or "day" in text: - return "weekly" + return "Weekly" if "hour" in text or "session" in text: - return "session" + return "Session" return "" diff --git a/test/shell.d/agent-usage-claude-limits-test.sh b/test/shell.d/agent-usage-claude-limits-test.sh index 61f4e014..fa21eef0 100644 --- a/test/shell.d/agent-usage-claude-limits-test.sh +++ b/test/shell.d/agent-usage-claude-limits-test.sh @@ -44,7 +44,7 @@ limits=$(read_limits '{ ] }') -expected='[{"label":"Session (5-hour)","percent":0.78,"resetsAt":""},{"label":"Weekly (7-day)","percent":0.12,"resetsAt":""},{"label":"Fable weekly","title":"Fable weekly","percent":0.17,"resetsAt":"2026-08-15T03:00:00+00:00"},{"label":"Fable session","title":"Fable session","percent":0.95,"resetsAt":""},{"label":"claude-opus-5 weekly","title":"claude-opus-5 weekly","percent":0.42,"resetsAt":""}]' +expected='[{"label":"Session (5-hour)","percent":0.78,"resetsAt":""},{"label":"Weekly (7-day)","percent":0.12,"resetsAt":""},{"label":"Fable Weekly","title":"Fable Weekly","percent":0.17,"resetsAt":"2026-08-15T03:00:00+00:00"},{"label":"Fable Session","title":"Fable Session","percent":0.95,"resetsAt":""},{"label":"claude-opus-5 Weekly","title":"claude-opus-5 Weekly","percent":0.42,"resetsAt":""}]' [[ $(jq -c '.limits' <<<"$limits") == "$expected" ]] || fail "Claude collector reads every model-scoped window once and drops unusable entries" "$limits" pass "Claude collector reads every model-scoped window once and drops unusable entries" @@ -67,7 +67,7 @@ pass "Claude collector reads scoped percentages on the payload's own scale" # the array, both keep the session and weekly windows they always had. for payload in '{"five_hour":{"utilization":78.0},"limits":[{"kind":"session","percent":78,"scope":null}]}' \ '{"five_hour":{"utilization":78.0},"seven_day":{"utilization":12.0}}'; do - [[ $(jq -c '[.limits[].label]' <<<"$(read_limits "$payload")") != *" weekly"* ]] || + [[ $(jq -c '[.limits[].label]' <<<"$(read_limits "$payload")") != *" Weekly"* ]] || fail "Claude collector adds no limit when the payload scopes none" "$payload" done pass "Claude collector adds no limit when the payload scopes none" @@ -86,11 +86,11 @@ eval(source.slice(start, end)) assertDeepEqual( limitWindows({ limits: [ { label: 'Session (5-hour)', percent: 0.78, resetsAt: '' }, - { label: 'Opus 5 (1M context) weekly', title: 'Opus 5 (1M context) weekly', percent: 0.42, resetsAt: '' } + { label: 'Opus 5 (1M context) Weekly', title: 'Opus 5 (1M context) Weekly', percent: 0.42, resetsAt: '' } ] }), [ { title: 'Session', percent: 0.78, resetAt: '' }, - { title: 'Opus 5 (1M context) weekly', percent: 0.42, resetAt: '' } + { title: 'Opus 5 (1M context) Weekly', percent: 0.42, resetAt: '' } ], 'agents panel titles a limit off the collector when it states one' )