teenux (Discord, #feedback) saw a cache hit rate on each request in the
Routing page's list but none on the Usage page's Requests tab. Each
Usage request now has a Cache hit rate column after Cache read, worked
out as Routing's request list does (promptOf in routing/client.js): the
tokens read from the cache over the whole prompt, uncached input plus
cache reads and writes, through app.js's cacheHitOf. It is said as
Routing says it, a whole percent ("90%"), with Routing's tooltip ("Cache
hit rate: The share of the prompt read from the cache"). A vendor that
counts no cache (cache_unknown, #3464) reads "—" with "The vendor
doesn't count the cache"; a request with no prompt counted reads "—"; a
miss reads 0%. The row's own fields only: nothing new is fetched.
Folding: at the page's 1200px cap the raw cache columns are usually out
already (tight), so the hit rate folds with the first token's column
(lc-opt2, tight2) rather than with them; while it is out the row's
details say it, and while it is in they don't say it twice. Every
string already had its zh, zh-TW, ja and de, so no i18n entries were
added.
Not the same: for a request with billable retries Routing sums every
try's usage, and a Usage row holds one usage record, so the two can
differ there.
Run on mote (macOS 27), Chromium and WebKit, five languages:
- new internal/gui/tests/ledger-cache-hit.test.cjs: 12/12 ok
- 65 GUI files the change reaches (this one included) (every test touching the ledger
table, its details or the Requests tab) plus i18n-keys and
i18n-en-no-cjk: 1147 of 1165 ok. Reds, all filed and not from this
change: i18n-keys "a plugin's words are its own" (#5327, #5332,
#5426, #5482), gateway-caller-keys en at 560px (#3797),
usage-ledger "newest live route needs no return-to-live button"
(#3104, #4078). Two more reds were this change's and are fixed here:
usage-ledger's header list and usage-ledger-detail's always-shown
labels (now leaving lc-opt2 out, as they left lc-opt out);
usage-ledger-ttft's lc-opt2 header locator now names its column.
Rerun of usage-ledger, usage-ledger-detail and ledger-cache-hit:
only the two filed return-to-live subtests red.
- go test -tags nogui ./internal/gui/ (TestCoreScriptBudget and the
other budgets): ok. No Go changed, so no gofmt/vet.
Broken by hand: origin/main's page.js -> ledger-cache-hit red ("a
Cache hit rate column"); the rate as cache_read / in (Routing's
denominator dropped) -> red on the values (deepEqual).
Not tried: the real app with real history; Windows and Linux GUIs.
Reported-by: teenux (Discord)