Skip to content

fix(segments): hide the cold-cache marker when writes are never metered - #55

Merged
lexfrei merged 3 commits into
masterfrom
feat/prompt-cache-unmetered-writes
Oct 4, 2026
Merged

lexfrei merged 3 commits into
masterfrom
feat/prompt-cache-unmetered-writes

Conversation

@lexfrei

@lexfrei lexfrei commented Oct 4, 2026

Copy link
Copy Markdown
Owner

The cold-cache marker warns about a recache cost: a cold prefix is re-processed on the next request. Providers with automatic server-side caching report cache reads but never meter a write, so that cost does not exist there — yet the marker still fires on every idle period, because the harness flips warm on its own TTL clock regardless.

The segment now stays hidden when the session reports cache_write_tokens as a pinned zero. An absent or null field (older harness) keeps the marker, so Anthropic behavior is unchanged.

Trade-off, stated openly: an Anthropic session that never wrote a single cache token (e.g. a resumed session whose only requests were full read hits) would also keep a zero count and lose a cold marker that is real. Every normal turn writes its new suffix, so this stays theoretical.

Also pinned: three new rate_limits.spend_limit fields (used_usd, limit_usd, period) from the 2.1.288 binary, so the schema-drift test passes on it. They are gateway-only and unparsed.

The statusline payload's rate_limits.spend_limit grew used_usd,
limit_usd and period, emitted behind gateways with a USD-denominated
overage limit. Pin the field names so the drift test passes on 2.1.288
and bump the pinned-version comment to match. Parsing is left out:
spend_limit only appears on gateway accounts, and the credits segment
covers spend only on the mac_insecure path, so gateway users get no
display either way until someone asks for it.

Assisted-by: LLM
Signed-off-by: Aleksei Sviridkin <f@lex.la>
Providers with automatic server-side caching (kimi) report cache reads
but never a write, so the harness's TTL clock is the only thing that
ever flips warm to false: the ice marker fires on plain idle time with
no recache cost existing to warn about. Suppress the segment when the
session reports cache_write_tokens as a pinned zero; an absent or null
field (older harness) keeps the marker.

Assisted-by: LLM
Signed-off-by: Aleksei Sviridkin <f@lex.la>
… writes

Assisted-by: LLM
Signed-off-by: Aleksei Sviridkin <f@lex.la>
@lexfrei
lexfrei merged commit 417140f into master Oct 4, 2026
7 checks passed
@lexfrei
lexfrei deleted the feat/prompt-cache-unmetered-writes branch October 4, 2026 03:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant