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 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5
parent
0ad64a59df
commit
efe805387e
@@ -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 ""
|
||||
|
||||
|
||||
|
||||
@@ -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'
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user