diff --git a/src/usage-telemetry.ts b/src/usage-telemetry.ts index abf4c7a6..6e4ead75 100644 --- a/src/usage-telemetry.ts +++ b/src/usage-telemetry.ts @@ -76,7 +76,7 @@ export interface RawPromptCache { /** Null right after a compaction or tool-result clearing, until the next request records the rewritten size. */ recache_tokens_if_cold?: number | null; misses?: number | null; - /** Cache rebuilds that followed a compaction or a clearing of old tool results (the compaction signal). */ + /** Cache rebuilds that followed a compaction or a clearing of old tool results (counted at the request after one; not read for the compaction stamp). */ expected_rebuilds?: number | null; /** Cache read tokens as a fraction of all input tokens this session, 0-1; null while those counts are all zero. */ hit_ratio?: number | null; diff --git a/test/usage-telemetry.test.ts b/test/usage-telemetry.test.ts index 3d1ee7b8..9d9bb2cd 100644 --- a/test/usage-telemetry.test.ts +++ b/test/usage-telemetry.test.ts @@ -172,7 +172,7 @@ describe('parsePromptCache', () => { // Out-of-range or non-finite values are clamped or dropped, never stored as-is. expect(parsePromptCache({ prompt_cache: { warm: true, hit_ratio: 1.5 } })).toEqual({ warm: true, hitRatio: 1 }); expect(parsePromptCache({ prompt_cache: { warm: true, hit_ratio: -0.2 } })).toEqual({ warm: true, hitRatio: 0 }); - // expected_rebuilds is rounded and floored at 0 (it indexes the compaction rise). + // expected_rebuilds is rounded and floored at 0. expect(parsePromptCache({ prompt_cache: { warm: true, expected_rebuilds: 2.9 } })).toEqual({ warm: true, expectedRebuilds: 3,