#3464 (zeewell on X): Kiro caches on its side, but its replies give only
credits and a context share, never cache tokens. Every hit rate outside
the Routing page read those calls' CacheRead of 0 as a miss. A Kiro-heavy
day showed "hit rate 6%" when the counted calls hit 90%.
The plugin already says so (opencode-kiro-auth 0.1.16 sends
usage.magpie_cache_unknown), and the gateway already kept it as
RouteUsage.CacheUnknown for Routing. This carries it the rest of the way:
- gateway: Usage.cacheNotCounted() (the vendor said so and no try
reported a cache token) goes into usage.Record.CacheUnknown on every
path that records a call: the gateway's own record, the OTel attempt
path in observe.go, and trace's routeUsage.
- usage: Record.CacheUnknown is kept as ledger row flag 8192
(rowCacheUnknown; grepped, no other flag uses that bit). Totals sums
such calls' prompt into cache_unknown and counts them in
cache_unknown_calls. Totals.HitRate leaves that prompt out of its
denominator, and gives no rate when nothing is left.
- Old records: calls kept before the plugin said so carry no flag. A
Kiro call (provider kiro or kiro-plugin) with no cache counted is read
as uncounted (usage.CountsNoCache): in the ledger's row read, in
Totals, and for Routing's history in internal/gui/trace.go
(cacheCounted). The rule is scoped to Kiro's two ids, so another
vendor's 0 stays a miss (tested).
- GUI: cacheHitOf in app.js drives the tray panel's card, the Usage
page's agent rows and cache tile, the requests' Cache hit rate card and
each ranking row. When only uncounted calls are left it shows "—" or
nothing instead of 0%. Otherwise it says "{n} requests left out: their
vendor doesn't count the cache". A request row's cache cells show "—",
and its details say the vendor doesn't count the cache. The Context
page (context.go, context.js) shows no cache for such a call and doesn't
score it as a miss.
- No budget raised. This adds 625 bytes to app.js (1,320,224 to
1,320,849, under its 1,321,336); d08b6118b had already moved the
masking page's maskWho, maskProv and stillMotion out to
plugins/redact, which an earlier version of this change did too.
- Strings in zh, zh-TW, ja and de. docs/subsystems/provider-plugins.md
now describes the ledger side and what is not covered.
Not covered, filed: hit rates read from the agents' own session files
(the TUI and CLI session lists, the Sessions tab's totals) still count
Kiro's 0 as a miss (#3470). Found on the way: System One's calls are
recorded without their cache tokens (#3471).
Run at this tree (on origin/main e57e78563, fetched just before; the
54-file GUI run was at a84d2ec80, and the 14 files that main's
redact page change since could reach were run again here):
- gofmt -l . prints nothing. go build ./... ok. go vet ./... ok,
GOOS=linux go vet -tags nogui ./... ok, GOOS=windows go vet ./... ok.
- go test -count=1 -timeout 45m ./internal/usage ./internal/gui
./internal/gateway: all ok (gateway 388s), TestCoreScriptBudget
included.
- GUI, 54 files (ledger-*, panel-*, i18n-*, context-*, request*,
usage-card*, usage-ledger and the masking/redact files),
concurrency 2: WebKit 439/452, Chromium 444/457. The new
ledger-cache-unknown test passed in both. Again here (ledger-*,
masking-*, redact-*, mask-*, usage-ledger): WebKit 104/117,
Chromium 109/122, the same reds. The reds, both already
red alone on main before this change:
- redact-words-any-case, 10/10 in each engine (#3500)
- usage-ledger "newest live route needs no return-to-live button",
en and zh in each engine (#3104)
- At earlier bases, with the same change: usage-agents-hide (#3414),
usage-checkin's WebKit Qoder tab (#3091), usage-fold (#3415),
usage-focus-steady (#3501) were red, each red alone on main too;
usage-card-refresh read a row before it was laid out, under load
(#3509); context-picks (#3483) and
context-map's tile overlap (#3488) in Chromium. Filed while doing
this: TestUsageReadAfterAppendHashesNothingOnAFineClock goes red
about 1 in 20 on main aa3112f4e (#3511); it passed in this run.
- Red on the old code: the new Go tests in usage, gateway and gui, and
ledger-cache-unknown.test.cjs (the old page shows "hit rate 6%"
where this shows 90%). Each changed piece was broken by hand and
turned a test red. The exception is the OTel attempt path in
observe.go, which no test reaches.
Not tried: a real Kiro account through the GUI.