Repository navigation
Conversation
Per-request records report reused_input_tokens as the largest reuse across prefill admissions, which a readmission after preemption can raise with KV the request computed itself. The collector already tracks first-admission reuse for the summary ratio; expose it on PerRequestRecord as first_admission_reused_input_tokens, so paths without cache-tier attribution, including SGLang, report it as well. Re-pin the AgentX snapshot report digests, which hash per-request JSON. With the new field excluded from serialization, the previous digests still match. Signed-off-by: Rudy Pei <yanrpei@gmail.com> Co-authored-by: Isaac <no-reply@databricks.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📜 Recent review details
📝 Summary
Merge Risk: ⚪ Minimal · up to
|
|
Superseded by #583, which now contains this change together with the related SGLang cache lifecycle, eviction, reporting, and KV-event corrections. The consolidated branch has passed local core and public-API validation. |
Why and what changed
requests.jsonlreportsreused_input_tokensas the largest reuse across a request's prefill admissions. After a preemption, the readmission can reuse KV that the request itself computed, so that value can exceed what the cache actually provided when the request first arrived. The collector already tracks first-admission reuse and uses it for the summary'sfirst_admission_prefix_cache_reused_ratio, but per-request records only expose it through the tier-attributed G1/host fields, which SGLang and other paths without tier attribution leave empty.This adds
first_admission_reused_input_tokenstoPerRequestRecord: total prompt tokens reused from all tiers at the first admission, unchanged by later readmissions. Existing fields keep their meaning. The KV-cache docs table now lists both reuse fields and how they relate to the summary ratios.Review map
crates/core/src/replay/report.rs, then the new test incrates/core/src/replay/canonical.rs.PerRequestRecordgains a public field and per-request JSON gains a key;crates/tests/public-apiis updated for the new field.PerRequestRecordliterals must set the new field.Evidence
cargo test -p aisimulate-corepassed: 2,429 cases, zero failures, one ignored;cargo test --manifest-path crates/tests/public-api/Cargo.tomlpassed (external consumer compiled; zero runtime cases). The newcanonical_record_preserves_first_admission_reuse_after_readmissiontest admits a request twice (512 reused tokens, then 25,088 after readmission) and checks the per-request record, admission history and both summary ratios. An existing report test now also checks the new field on a single admission.Modeling or data provenance
N/A.
Tracking
None.
This pull request and its description were written by Isaac.