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
{{ message }}
Repository navigation
Measure what an agent step costs, so cache and compaction changes can be judged by their effect #56422
The harness has no way to answer "is this change cheaper?" Today the cache policy is checked by asserting that a cache_control marker lands where a test expected one, which proves the marker exists but not that it saves anything.
That gap is measurable rather than theoretical. Against a provider stand-in that counts the tokens of the request it receives and reports a cache read only for a prefix an earlier request already wrote:
The shipped default policy (tools + system + one tail breakpoint) reaches ~91% reuse over a 20-step conversation, with uncached input staying roughly flat while the conversation grows tenfold.
Marking more of the tail does not help (tail: 2 measures equal), and tail: 3 is measurably worse, because each step's newest turn is new regardless and the provider only allows four breakpoints.
Dropping the tail breakpoint is the expensive mistake: +66% on the same conversation.
Two related open questions would benefit from the same measurement, and I would rather add numbers than guesses:
Compaction is itself a request: the older half of the conversation is re-sent to produce the summary. What is the net effect on a long run, after the summary request and the steps that follow it?
The proposal is a test fixture, not a production change: a provider stand-in in test/fixture/ that meters requests the runner already made, plus cases that assert the reuse it measures. Happy to split it smaller if that is easier to review, or to keep it purely as a fixture and let follow-up PRs add the measurements.
Thanks for the detailed write-up and the numbers. To restate the request: you'd like a metering provider stand-in in test/fixture/ so that cache and compaction changes can be judged by how much prompt cache is actually reused, not just by where cache_control markers land. Maintainers will look at it alongside your PR.
Related items that could use this kind of measurement:
Activity
opencode-agent commentedon Oct 17, 2026
Thanks for the detailed write-up and the numbers. To restate the request: you'd like a metering provider stand-in in
test/fixture/so that cache and compaction changes can be judged by how much prompt cache is actually reused, not just by wherecache_controlmarkers land. Maintainers will look at it alongside your PR.Related items that could use this kind of measurement:
prompt_cache_keyrecent, which can make the context bigger than before compaction #51818: compaction keeping reasoning text inrecent, which can make the context bigger than before compaction