Skip to content

fix: uncap the Overview model table, billions token rung, unpriced calls dimming (#1318) - #1443

Merged
iamtoruk merged 9 commits into
getagentseal:mainfrom
ozymandiashh:fix/1318-overview-uncapped
Sep 17, 2026
Merged

iamtoruk merged 9 commits into
getagentseal:mainfrom
ozymandiashh:fix/1318-overview-uncapped

Conversation

@ozymandiashh

@ozymandiashh ozymandiashh commented Sep 15, 2026 •

Copy link
Copy Markdown
Collaborator

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-followups minutes after #1314 had already merged that branch into main, so 455130f0, 3d3088f0 and e6cce142 never reached main — git merge-base --is-ancestor ef97600d main fails and tests/menubar-model-tokens.test.ts is 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:

If 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)

  1. Uncapped period model list. buildTopModels no longer slices at TOP_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-session models list and never consumed current.topModels. The Overview table already renders in a scroll container, so no UI change was needed.
  2. Billions rung for compactTokenCount. The menubar Models row formatter had K/M only, so a period cache-read total past a billion rendered as 12345.7M; it now renders 12.3B, matching MenubarRowFormatter.compactTokens and the desktop formatCompact. Made internal so a test pins the rung.
  3. Calls are no longer dimmed on unpriced rows. The desktop Models tables dim calls for unpriced models while the token columns (per Show per-model token counts alongside cost in desktop and menubar #1315's own comment) render at full weight — calls are observed usage too, not a pricing artifact. Cost/saved keep their dashes and the add-alias affordance.

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

  • CLI suite: 4119 passed (npm test)
  • Desktop: tsc --noEmit clean, 1001 tests passed
  • macOS: ModelEntry token counts suite 9/9 (incl. the new billions-rung test); module builds via swift test with the CLT Swift Testing flags
  • The cap test in menubar-json.test.ts flipped to pin the uncapped behavior (30 models in → 30 rows out, synthetic still filtered)

ozymandiashh and others added 4 commits September 15, 2026 22:39
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.
@iamtoruk

Copy link
Copy Markdown
Member

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.
@ozymandiashh

Copy link
Copy Markdown
Collaborator Author

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 Text(…), so the localization coverage scanner flagged it — it never reached the zh-Hans catalog. It now routes through L(…) with positional specifiers per the #1331 rule, and both tables carry the key with the Chinese one rebinding the word order. Localized full mac suite passes locally (the only other local failure, ContributionHeatmap's date assertion, is my machine's ro_RO locale — it passes on CI's runners).

@ozymandiashh

Copy link
Copy Markdown
Collaborator Author

Before/after screenshots as requested. Before = main (3684f1d); after = this branch (e1b736b, main merged in). Desktop shots come from the dev build (vite + electron .) against my own data, all time, provider filter Claude.

How I set it up, so you can reproduce:

  • >20 models. With "All providers", Overview builds this table from history.daily, so it's already uncapped on main. The 20-row cap only shows up with a provider filter, which reads current.topModels. None of my providers has 20 models, so I added one synthetic Claude transcript through CLAUDE_CONFIG_DIRS: 25 extra model ids, one call each, in a sandbox home. Everything else is my real data.
  • Unpriced rows. gemini-1.5-pro and grok-2 in that transcript have no pricing entry. One thing I found along the way: these rows never reach the desktop Models table on a default run. codeburn models drops rows under $0.01 unless --min-cost/--unpriced is passed, and codeburn:getModels passes neither, so the add-alias rows can't show up in practice. For these shots the CLI ran with that default at 0, same change on both builds. Separate issue, not this PR, but worth knowing.
  • Tall table. The Overview model table sits in a 244px scroll box. For the capture I expanded that box so every row is visible, same on both builds.

1. Desktop Overview: "Models this period" (Life, Claude)

Before stops at 20 rows (GPT-4.1 is the last one). After shows all 31.

light dark
before before-overview-light before-overview-dark
after after-overview-light after-overview-dark

2. Desktop Models: unpriced rows (bottom of the table)

Before: calls are dimmed and tokens show dashes on <synthetic>, gemini-1.5-pro and grok-2. After: calls and tokens are at full weight, and cost/saved keep the dash and "add alias".

light dark
before before-models-light before-models-dark
after after-models-light after-models-dark

3. Menubar Models rows: billions rung

Main 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 ModelsSection with ImageRenderer from my real status --format menubar-json --period all payload, top six rows, en_US locale.

10421.6M cache read → 10.4B cache read

before (b8bdbb8) after
before-menubar-models after-menubar-models

@iamtoruk iamtoruk left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.
@ozymandiashh

Copy link
Copy Markdown
Collaborator Author

All three are addressed in 20712f3.

  1. formatTokens B rung. Added in src/format.ts, so a totals row now reads 29.9B instead of 29870.8M. src/compare.tsx had its own M/K copy of that formatter, which would still have printed 1234.5M in codeburn compare. It now calls formatTokens too; token counts are integers, so output below a billion is unchanged. tests/format-tokens.test.ts pins the rungs, including 999_999_999 → 1000.0M so the boundary can't move silently, and it fails with the B line removed. I checked every other formatTokens caller: widths are measured from the formatted string, and sorting and JSON/CSV use raw numbers, so nothing depended on the M suffix.
  2. Changelog. The Overview all-provider model table is capped at 20 rows since it reads topModels #1318 entry now says so plainly: in the shipped app unpriced rows don't reach the Models table yet, because codeburn models defaults minCost to 0.01 and getModels passes no override. The dimming change only takes effect once that filter is dealt with. The filter itself is untouched here.
  3. Layout test. The width expectations are gone. The test now renders ModelsSection for two payloads that differ only in whether their rows carry token counts, and asserts the version with counts is taller by at least one text line per row. It fails if the legacy rows get the counts too. The test is renamed to ModelsSectionTokenLineTests, and the popover render test no longer claims anything it doesn't check.

Full CLI suite: 4161 passed, tsc clean. The Swift test ran locally against the real app module through a swift-testing stub; CI's swift test is the real gate.

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.
@iamtoruk
iamtoruk merged commit dd1f11f into getagentseal:main Sep 17, 2026
21 checks passed
iamtoruk pushed a commit that referenced this pull request Sep 18, 2026
#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.
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.

Overview all-provider model table is capped at 20 rows since it reads topModels

2 participants