You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix(desktop,storage): keep the usage rings honest about what they sum
Second review round, all under the ring math rather than its shape.
The token split clamped cacheRead to input, but the ledger keeps the
provider's cached share unclamped when no prompt total was reported, so
`cacheRead > input` is a normal aggregate — 200k cached tokens with zero
prompt became a zero segment. The split now reads cacheRead as reported;
`uncachedInput` already floors the other way, and the total remains the
sum of the drawn segments.
The time split decided presence through `totalDurationMs ?? 0`, which
made a host that measured zero model time drop its row and its call
count while the tool row survived on count. `totalDurationMs` is now a
required summary key — the epoch bump already refuses peers that predate
it, so the optional decoder path and its test were unreachable — and the
split decides presence on the reported fields before filtering. The ring
label says "Recorded Time": the figures are sums of per-call durations,
not wall clock, and parallel or nested calls overlap.
`toolUsage` stays optional for a data reason instead of a version one:
tool rows predate connection attribution, so a `connectionSlug`-scoped
query cannot answer the tool ledger honestly. The Host omits the split
for that query rather than persist a slug that would only cover new rows
and let history silently vanish under the filter.
Every tool read now shares one row filter, so tool buckets honour the
same Session, provider, and model filters the summary applies — they
previously ignored Session identity. And the ts range moves into the
invocation query: the ledger has no retention, and the unbounded decode
ran on every summary refresh; the `(ts DESC, id)` index answers it.
Generated-by: ZCode
0 commit comments