Repository navigation
fix: uncap the Overview model table, billions token rung, unpriced calls dimming (#1318) - #1443
Conversation
Review follow-ups on the per-model token counts, addressed on the merged
head.
buildPeriodData walked every assistant call in every session twice: once
through sessionBillableOutputTokens for the headline and again through
sessionModelBillableOutputTokens for the per-model split. Both derive from
the same traversal and the same sawUsage fallback decision, so fold them
into one sessionBillableOutput(session) returning { total, byModel }; the
two existing exports become thin wrappers, keeping their semantics for
other callers. A call whose model resolves to no breakdown bucket still
counts toward the session total and still lands in no row, exactly as
before, so no total moves.
The macOS accessibility text grouped a signed string, counting the minus
as a leading digit and emitting it twice: a -1,234,567 count read as
"--1,234,567", a different number to a screen reader. Group the magnitude
and re-apply the sign; magnitude is unsigned, so Int.min no longer traps
on negation either. Negative counts are not expected from the CLI, but the
payload field is a plain Int and a corrupt or hand-edited snapshot carries
whatever it carries.
Two findings are disclosed rather than changed:
* buildTopModels' unknown-vs-zero guard cannot fire on the durable path.
ModelDayStats types the four counts as required numbers and daily-cache
sanitizeModels runs each through num(), so a missing value becomes a
known 0 and a carried day under-reports as exact instead of unknown.
Making it reachable means widening ModelDayStats to optional counts and
teaching every daily-cache arithmetic site (fold, subtract, reduce) plus
buildPeriodDataFromDays to propagate absence — a durable-cache contract
change, too broad to ride along here. The guard stays: PeriodData
already types these counts optional, so fresh-session and plugin-sourced
rows may legitimately omit them.
* The all-provider Overview models table now reads current.topModels and
so inherits the payload's 20-row TOP_MODELS_LIMIT, which its previous
uncapped daily-history union did not have. Kept, because that union was
itself a per-day top-five truncation whose tail rows were already
partial sums, but the PR body's "the cap is unchanged" claim was wrong
for this view and the trade-off is now recorded at the call site.
…imming unpriced calls (getagentseal#1318) The Overview model table reads current.topModels, which was capped at TOP_MODELS_LIMIT (20): on a machine with 47 models every local and free model fell out of the table. The list is now uncapped — every consumer that wants fewer rows already slices its own (desktop hero 8, MCP 5 or caller limit) and the macOS menubar reads a per-session list. compactTokenCount (menubar Models rows) gains the billions rung: period cache-read totals past a billion rendered as 12345.7M. The desktop Models tables stop dimming the calls column on unpriced rows — calls are observed usage like the token columns, not a pricing artifact; cost/saved keep their dashes and the alias affordance. Status snapshot revision 9 invalidates warm snapshots so a stale record cannot keep serving the truncated 20-row list.
|
Thanks for catching the lost #1315 commits, that one is on me. This changes three screens, so per the new rule it needs before and after screenshots in the PR before review: the desktop Overview model table with more than 20 models, the desktop Models table showing calls no longer dimmed on an unpriced row, and the menubar Models row with a value in the billions rung. Dark and light for the desktop ones. Once they are up I will verify against my own data and take it from there. |
…localization catalog The per-model token line arrived with the getagentseal#1315 re-land as a raw interpolated Text(…), so the localization coverage scanner fails: a zh-Hans user got an English fragment. The key joins both tables with positional specifiers per the getagentseal#1331 rule, Chinese rebinding the word order.
|
The first CI run's mac failure is fixed by dd0f9df: the model row's secondary token line (from the re-landed #1315) shipped as a raw interpolated |
|
Before/after screenshots as requested. Before = main (3684f1d); after = this branch (e1b736b, main merged in). Desktop shots come from the dev build ( How I set it up, so you can reproduce:
1. Desktop Overview: "Models this period" (Life, Claude)Before stops at 20 rows (GPT-4.1 is the last one). After shows all 31.
2. Desktop Models: unpriced rows (bottom of the table)Before: calls are dimmed and tokens show dashes on
3. Menubar Models rows: billions rungMain has no per-model token line (#1315 never landed there), so before here is this branch at b8bdbb8, the #1315 re-land without the #1318 fix. After is the head. Both render the real
|
iamtoruk
left a comment
There was a problem hiding this comment.
Checked the numbers against my own cache. Froze the window with --to 2026-09-16 so today's live churn cannot move it: report --format json is identical to the cent on three windows including full history, and the frozen menubar payload differs only by the four new token fields and topModels going 20 to 54. Per-model counts sum to the headline exactly. Good.
The uncap is real here: 54 models, and rows 21 to 54 are all the $0 ones, including coder-model at 518 calls and cursor-grok-4.6-high at 749. Billions rung works, Opus 5 reads 10.6B instead of 10576.7M. Swift suite 692 green, localization coverage green, en and zh key sets match. Desktop tsc clean, app tests 29 failures on both sides, same 29.
Two things before it lands.
One, add the B rung to formatTokens in src/format.ts. Right now codeburn models prints a totals row of 29870.8M on my data. That is the exact bug in the title, and the menubar is not the only place it shows.
Two, your getModels finding is right and bigger than you wrote. The default is minCost: 0.01 at src/main.ts:2574, and the filter is cost or savings >= 0.01, so every row your dimming change targets is dropped before it reaches the table. On my data that is 20 rows and 2,160 calls. So the Models.tsx half of this PR does nothing in the shipped app. Keep it, I am opening the issue, but say so in the changelog entry. Not a one-liner to smuggle in here; it changes the table for everyone and needs its own before and after.
Minor: the layout proof test asserts width 360 after setting width to 360. That is not a proof. Assert the token line renders and is not clipped, or rename it.
This lands before the provider-list branch; they collide on one import line only.
…ow filter, real token-line test - formatTokens gains the B rung, so the codeburn models totals row reads 29.9B instead of 29870.8M; compare's local M/K copy now uses it too. - The getagentseal#1318 changelog entry says the desktop Models dimming change has no effect in the shipped app until the models minCost 0.01 default stops dropping unpriced rows. - The layout proof test asserted width 360 after setting 360. It now asserts that rows with token counts render one line more than the same rows without, and is renamed to ModelsSectionTokenLineTests.
|
All three are addressed in 20712f3.
Full CLI suite: 4161 passed, |
Conflicts kept both sides: menubar buildTopModels merges on modelRowKey (getagentseal#1448) while staying uncapped and carrying per-model counts; Overview.tsx keeps main's chart bucketing next to the topModels-sourced model table; usage-aggregator takes both import sets; snapshot render version renumbered to 9 over main's v8 (streak/periodTotals), with the changelog revisions updated to match.
#1474) The CLI defaults minCost to $0.01 and the desktop bridge passed no override, so the Models table silently dropped every row under a cent. That also excluded every unpriced row, since a 0 >= 0.01 predicate can never hold, leaving #1443's dimming and add-alias affordances unreachable in the shipped app. codeburn:getModels now passes --min-cost 0, and the demo bridge mirrors it. --unpriced would have been wrong: it filters to only the unpriced rows rather than completing the set. On a frozen lifetime range the flag is exactly additive: 41 rows and 168,141 calls become 62 rows and 170,314 calls, +2,173 calls and +$0.007890, every original row unchanged. 20 of the 21 recovered rows are unpriced; one is a genuinely priced sub-cent row. The app agrees, 41 rows before and 62 after, with 20 dimmed rows and 20 add-alias buttons where there were none. Fixes #1465.










What this does
Fixes #1318, and re-lands the three #1315 commits it depends on.
Part 1 — re-land of #1315 (first three commits, authorship preserved)
As noted on the issue, #1315 merged into
fix/dock-pace-followupsminutes after #1314 had already merged that branch intomain, so455130f0,3d3088f0ande6cce142never reached main —git merge-base --is-ancestor ef97600d mainfails andtests/menubar-model-tokens.test.tsis not on main. #1318 is written against that code.This PR cherry-picks the three commits onto current main, preserving authors. Conflicts were small and resolved by keeping both sides:
src/menubar-json.ts— main'srawCategoryon categories + the incoming per-model token fieldsCHANGELOG.md— kept main's newer bullets plus the Show per-model cached tokens alongside cost in desktop and menubar #1265 bulletIf you would rather re-land #1315 your own way, dropping the last commit of this PR leaves you exactly with the re-land.
Part 2 — the #1318 fix (last commit)
buildTopModelsno longer slices atTOP_MODELS_LIMIT(20). On the 47-model machine from the issue, every local and free model (qwen, llama, deepseek, gemini, grok) fell out of the Overview table — exactly the rows whose $0 cost ranks them last, and exactly the rows Show per-model token counts alongside cost in desktop and menubar #1315 had just made visible in the Models tables. Every consumer wanting fewer rows already slices its own (desktop hero takes 8, MCP tables take 5 or the caller's limit); the macOS menubar reads a per-sessionmodelslist and never consumedcurrent.topModels. The Overview table already renders in a scroll container, so no UI change was needed.compactTokenCount. The menubar Models row formatter had K/M only, so a period cache-read total past a billion rendered as12345.7M; it now renders12.3B, matchingMenubarRowFormatter.compactTokensand the desktopformatCompact. Made internal so a test pins the rung.Snapshot semantics
Status snapshot revision 8 → 9: a v8 record holds only the 20 costliest rows, so without the bump a warm snapshot would keep serving the truncated list until the next recompute — the same staleness class v8 itself was bumped for.
Verification
npm test)tsc --noEmitclean, 1001 tests passedModelEntry token countssuite 9/9 (incl. the new billions-rung test); module builds viaswift testwith the CLT Swift Testing flagsmenubar-json.test.tsflipped to pin the uncapped behavior (30 models in → 30 rows out, synthetic still filtered)