Skip to content

fix(serving): the prompt-cache derivation probe says when a measured state sized it (card 37eb1925) - #5071

Merged
joelteply merged 1 commit into
canaryfrom
506a409e/serving-prompt-cache-derived-says-when-a
Oct 21, 2026
Merged

joelteply merged 1 commit into
canaryfrom
506a409e/serving-prompt-cache-derived-says-when-a

Conversation

@joelteply

Copy link
Copy Markdown
Contributor

serving.prompt_cache.derived hard-coded serialized_state_bytes = "unobserved"
and kept reason = resident_demand_kv_estimate even when with_measured_state
had raised a demand to the measured saved state. One reason with two
meanings: on Kimi's node, 8eaed76's first post-boot sizing was measured
(one_conversation 4,816 MiB from a 5,050,734,260-byte page; estimated_kv_bytes
10,101,522,432 = 2 x the page rounded up to 32,768-byte tokens, exactly), yet
the probe read as the very defect #5060 fixed. Proving the fix took a
hand-built arithmetic receipt (helper, 9173c5a9).

  • serialized_state_bytes now carries the measured state the sizing read
    (None when nothing was measured).
  • sized_by(): a KV-estimate sizing whose demands a measured state raised
    reports reason resident_demand_measured_state. Priors are never relabeled.

The sizing itself is unchanged. The test pins all three cases with the
node's page size.

Co-Authored-By: Claude Opus 5.5 (1M context) [email protected]
Claude-Session: https://claude.ai/code/session_01FRQWzgSfo79JtnwZywHKrE

@joelteply

Copy link
Copy Markdown
Contributor Author

Source review at 48ae5d4: no blocking correctness finding in this narrow observability change. The measured-state read feeds both the existing sizing transform and the receipt; only a changed demand under the estimate reason is relabeled. Sizing policy itself is unchanged. Existing tests exercise raised, unchanged, and prior cases.

Two scope notes: the preexisting with_measured_state documentation now attaches to sized_by; move that block back to its function. Receipt deduplication remains decision-based, so a measured byte count changing without changing the decision will not emit a new receipt; this is not a continuous measurement stream.

This is source review only, not runtime adoption or performance proof. The October 15 checks do not validate integration with today's canary; refresh against repaired canary and require current checks before merging.

@joelteply
joelteply force-pushed the 506a409e/serving-prompt-cache-derived-says-when-a branch from 7755df4 to 1f4bab9 Compare October 20, 2026 02:02
…state sized it (card 37eb1925)

Re-applied onto canary 445ae4b after #5245 split serving_daemon.rs: the derivation,
with_measured_state and the decision type all live in serving_daemon/prompt_cache.rs,
which now owns sized_by and its test too.

A sizing raised by a measured saved state reported the KV estimate's reason, so the
receipt read the same before and after card 37eb1925's fix, and a fresh core's first
sizing could not be told from the defect (Kimi's node, 8eaed76: one_conversation
4,816 MiB from a 5,050,734,260-byte page, under resident_demand_kv_estimate).
derived_prompt_cache_mib keeps the estimate beside the raised demands, and sized_by
relabels the decision resident_demand_measured_state only when a measured state raised
a demand; a prior is never relabeled. The receipt's serialized_state_bytes reports the
measured bytes instead of 'unobserved'.

Test: a_measured_state_sizing_says_so_and_a_prior_is_never_relabeled.
source-hygiene 43/43 on IntelMac. Core compile is CI's.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01FRQWzgSfo79JtnwZywHKrE
@joelteply
joelteply force-pushed the 506a409e/serving-prompt-cache-derived-says-when-a branch from 1f4bab9 to 03bc2fc Compare October 21, 2026 17:04
@joelteply

Copy link
Copy Markdown
Contributor Author

Codex SOURCE PASS for the rebased patch at 03bc2fc. Re-read the entire current diff in serving_daemon/prompt_cache.rs: it preserves the measured-state sizing calculation and relabels only resident_demand_kv_estimate when measured demands differ; prior/no-demand reasons remain intact. The helper and regression assertions are now colocated in the split module; measured-state bytes replace the misleading unobserved probe. No monolith edit remains. Require green CI at this head; no local compilation or live validation claimed.

@joelteply
joelteply merged commit f467d1a into canary Oct 21, 2026
9 checks passed
@joelteply
joelteply deleted the 506a409e/serving-prompt-cache-derived-says-when-a branch October 21, 2026 17:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant