Repository navigation
Show per-model token counts alongside cost in desktop and menubar - #1315
Merged
Merged
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.
iamtoruk
added a commit
that referenced
this pull request
Sep 12, 2026
Rebase resolution for #1289 onto main (#1306, #1313, #1314, #1315, #1328, #1329). Conflicts kept both intents: main's second-row title composition, glance-window accessibility actions, cache-read line, host field and merged Notifications section keep their behaviour and now resolve through L(…). Adds 14 keys to both tables, drops 4 that no longer have a call site, and retranslates the two Copilot explanations main rewrote.
ozymandiashh
added a commit
to ozymandiashh/codeburn
that referenced
this pull request
Sep 15, 2026
…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.
iamtoruk
pushed a commit
that referenced
this pull request
Sep 17, 2026
…lls dimming (#1443) The period model list the Overview table reads is no longer cut at 20 rows, so every model with usage in the period shows up instead of only the costliest twenty - the rows that dropped out were exactly the $0 local and free models. formatTokens gains a billions rung, so a codeburn models totals row reads 29.9B instead of 29868.7M; the menubar row formatter gains the same rung, and compare now reuses formatTokens instead of its own K/M copy. The desktop Models tables stop dimming the calls column on unpriced rows. In the shipped app those rows do not reach the table yet - codeburn models defaults to minCost 0.01 and getModels passes no override - so the change takes effect once that filter is addressed, tracked separately. Also re-lands the three #1315 commits that never reached main: per-model token counts beside per-model cost in the Overview and the macOS menubar Models rows. Status snapshot revision goes to 9 so a warm snapshot cannot keep serving the truncated list. Fixes #1318.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Supersedes #1265. Same feature, rebased off #1314 so the diff is only this change. Original work by @ozymandiashh.
#1265 contained #1267 as a merge commit, so it could not be read or landed on its own. This is its two commits replayed onto
fix/dock-pace-followups, plus one test.What it does
Per-model input, output and cache-read counts next to cost: a secondary line under each macOS menubar Models row, a Cache read column in the desktop Overview. The desktop Models tables keep token counts visible for unpriced models, where usage used to render as dashes.
Verified against real data
Built this branch and
fix/dock-pace-followups, ranstatus --format menubar-jsonon both, structurally diffed the full payload.current.topModels[].*Tokensfields. Every cost, call and session figure is identical to the digit, on both the durable-day and fresh-session paths.models --format jsonfor the same window: calls, all four token counts and cost agree exactly.Volatile fields were isolated first by bracketing with repeat baseline runs (
generated,liveSessions, and today's row).Grouping
buildTopModelsmerges token counts with the samegetShortModelNamecall that merges cost, in the same loop, so aliased ids land in one row for both. Breaking that key fails 8 tests across 3 files.Durable days already carried all four counts in
ModelDayStats, andaddSliceIntoDay/subtractModelStats/sanitizeModelshandle them alongside cost, so the reconcile swap moves tokens and cost together.Cache versions
STATUS_SNAPSHOT_RENDER_VERSION7 to 8 only. Justified: a warm v7 snapshot would hide the new fields. Costs one recompute per query, then reuses.DAILY_CACHE_VERSIONstays at 32 andPROVIDER_PARSE_VERSIONSis untouched, which is correct here: the counts were already persisted, so no finalized history is discarded.Added test
test: pin per-model output normalization in buildPeriodData. The per-model output path normalizes reasoning tokens the same way the headline does, but every fixture and my whole corpus report zero reasoning tokens, so replacing that expression with the raw counter passed all 3996 tests. Two assertions on the existing grok/codex fixture now pin it.One thing to confirm before merging
The all-provider Overview models table now reads
current.topModelsinstead of a union over each day's top-five history. That is more accurate but applies the payload's 20-row cap to that view for the first time. On my data the table goes from 47 rows to 20, dropping every local and free model.The old rows were not trustworthy:
Cursor (auto)showed 1691 calls and $3.31 against a true 25 calls and $0.01, andGPT-5.6 Lunashowed 139 calls against a true 501. So this trades a long wrong tail for a short correct list, which I think is right, but it is a product call. RaisingTOP_MODELS_LIMITfor the desktop payload would get both.Tests
tsc --noEmitclean, 3996 passed, 5 skippedtypecheckclean, 894 passed (27 failures in usePolled/overviewSnapshot are pre-existing, identical on the baseline)swift buildclean, 541 tests passed,swift build -c releasecleanThe Swift layout proof renders the real popover root at its actual 360pt width and asserts
fittingSize.width == 360, including a 12.3 billion cache-read row, so the new line cannot widen the popover. Rendered it and checked both schemes: absent counts show a dash, a known zero shows0, and a legacy row with no counts shows no second line.Known nit, pre-existing:
compactTokenCounthas no billions rung, so 12.3 billion renders as12345.7M. It is the same helper the Tokens line already used, so I left it alone.