app: show the reset history of each long limit window (#16)

The developer asked for a detailed breakdown of every reset (feedback of
2026-10-18). Limits do not only reset at the end of their week: most Codex
weeks in the local history ended early.

- Core: a limit's samples form a window series (provider, limit name and
  length), so the history follows Codex's week across slots (D7). Instance
  spans are built once. One backward walk gives each instance, real or
  inferred, the start of the instance after it. The hour that holds a
  boundary goes to the instance that starts in it, or else to the one that
  ends in it (#9). A stale sample that would put its instance after a later
  one is ignored. The reset history lists the real instances with their
  figures, totals and early-reset hours (D12). API value uses a dated list
  price table; unknown models stay unpriced (D13).
- App: a Resets section per long window with totals, a timeline of
  burn-ups side by side with skipped time in lanes below, early resets by
  hour and weekday, and a sortable table (D8). The reset tooltip lists
  every model with its tokens and API value. Tall tooltips open beside the
  pointer, and Fluent's 320 px tooltip cap no longer wraps data values.
- Docs: D12 and D13 are new; D7 and D8 cover window series, boundary
  hours and the Resets section.

Closes #14
Closes #9
This commit was merged in pull request #16.
This commit is contained in:
2026-10-18 11:12:38 +02:00
parent 0a08b508a2
commit 82fece85f5
29 changed files with 1570 additions and 137 deletions
+68 -4
View File
@@ -188,12 +188,20 @@ probe.
is reached stops use, so an estimate that would pass it shows "limit reached (estimated)" at
the time it crosses. No tokens in the instance means no estimate. Instance boundaries come from
resets: an instance starts at its reset minus its length, and ends at its reset or at the next
instance's start, whichever comes first (Codex can start a new window early). Spans between
instances (a session window opens only with the next message) belong to none. A past instance
instance's start, whichever comes first (Codex can start a new window early). Tokens are
hourly (D5): an hour that holds a boundary goes to the instance that starts in it, or, when
none does, to the instance that ends in it. Other spans between instances (a session window
opens only with the next message) belong to none. A sample that would place its instance
after an instance sampled later is stale and is ignored. A past instance
with samples is always the real one; an instance is only inferred where no samples exist, by
stepping back one window length, and never overlaps a real one. Windows of a day or shorter are
never inferred, since a session starts with whatever message comes next. Past instances are
labelled with their real start and end.
- **Window series.** The samples of one limit share the provider, the limit name and the
length. The limit name is the window id without a Codex slot suffix (`:primary`,
`:secondary`): Codex moves a limit between its slots when another limit appears or goes, as
its week did on 2026-09-13 when its 5 h limit went away. Every analysis of a window reads its
series, never a window of another length under the same id.
A window without a known length or reset has no pace; FinalToken never guesses one; an estimate
is a marked calculation from measured tokens, not a guess.
@@ -246,8 +254,9 @@ better, and overstates `u₀` by the use in that sample's hour before the sample
windows, with each day's even pace and budget for its share and the instance start and reset
marked on the first and last day; token totals for today, the current session and the week of
[D9](#d9--the-snapshot-file-is-the-apps-only-output-to-other-processes), each saying since
when; charts, one window chart per limit
window, and the top entries by model and by project, with the rest folded into an expandable
when; charts, one window chart per limit window; the reset history of each long window
([D12](#d12--reset-history)); and the top entries by model and by project, with the rest folded
into an expandable
"Other". A window chart is a burn-up of one instance from its start to its reset: the used
percent as a line (measured, or estimated before the first sample), the even-pace diagonal
from 0 % to 100 %, the forecast to the reset and the previous instance faintly behind, with no
@@ -323,3 +332,58 @@ setting says so and nothing happens.
**Why.** R7.
**Gives up.** Elgato's double-click `.streamDeckPlugin` installer, which always asks.
## D12 — Reset history
**Decision.** For each limit window longer than a day, the panel lists the instances of its
window series ([D7](#d7--pace)) that have samples and overlap the panel's range, newest first,
with totals over them. Inferred instances are left out, because their resets were not observed.
- **End.** An instance ends at its reset or at the next instance's start (D7). One that ends
more than 15 minutes before its reset **reset early**, and the time from its end to its reset
is **skipped**. The running instance is marked as running and has no end figures yet.
- **Figures.** Start, end, duration and reset; peak and final use (the last point of its D7
burn-up, marked when estimated); when it reached 100 % and how long it stayed there; tokens by
kind and by model in its hours (the window's model family only, boundary hours as in D7); and
their API value ([D13](#d13--api-value-at-list-prices)).
- **Unused.** A finished instance leaves `100 − final use` percent of its limit unused.
- **Gift.** An early reset hands out a fresh limit ahead of schedule: its gift is
`100 · skipped / W` percent of a limit. Over many windows, that is how many extra limits the
provider gave.
- **Value of a percent.** Unused and gift percent become tokens and money at the instance's own
tokens and API value per percent point when its final use is at least 5 %; otherwise at the
median of the series' instances that qualify. Without one, only the percent is shown.
- **Totals** over the listed instances: their number, early resets, tokens, API value, unused
and gift (in limits and value), and how often and how long 100 % was reached.
- **Timeline.** Each series shows its instances on one time axis without joining their lines,
marks each reset and the skipped time of early resets, and counts its early resets by local
hour and weekday.
**Why.** R4. The developer asked for figures per reset, including wastage, API value and what
early resets give (developer feedback, 2026-10-18). Codex resets early often: 11 of its 12 week
instances from 2026-09-21 to 2026-10-17 ended early, some after 10 hours.
**Gives up.** Resets FinalToken never saw: before its first sample, and instances without any
sample. Token figures at a boundary are only as fine as an hour. The gift assumes the provider
would have kept its schedule. Unused and gift values assume the instance's model mix. A drop in
use without a new reset is not a reset.
## D13 — API value at list prices
**Decision.** FinalToken estimates what tokens would cost at the providers' public API list
prices. A table compiled into Core gives, per model, US dollars per million tokens for input,
output, cache write and cache read (Claude) or input, cached input and output (Codex), with the
day it was checked and its source pages. A model id matches its entry exactly or with a
trailing date suffix (`claude-haiku-4-5-20251001`). A model without an entry has no value; its
tokens are counted and shown as unpriced. Claude cache writes use the 5-minute price. Reasoning
is part of output and Codex cached input part of input, as in [D7](#d7--pace). Values are
shown with "≈" as "at API list prices".
**Why.** The developer asked what each window would cost at API prices (developer feedback,
2026-10-18). [D2](#d2--the-clis-are-the-only-interface-to-a-provider) rules out asking a
provider; a dated table can be checked by hand and is updated with a release.
**Gives up.** Price changes after the check until a release updates the table. Long-context
prices (OpenAI above 272K input tokens, Claude Haiku 5.5 above 100K), because hourly buckets do
not keep request sizes. The 1-hour cache write price, fast and batch prices, and models not in
the table.