[Bugfix][Mamba] Keep the prompt-end prefill checkpoint under sparse retention (#59146)

Signed-off-by: Jared Wen <jaredwen@inferact.ai>
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-authored-by: Jiangyun Zhu <riverclouds.zhu@qq.com>
This commit is contained in:
Jared Wen
2026-09-29 21:00:16 +00:00
committed by GitHub
co-authored by Claude Opus 5.5 Jiangyun Zhu
parent 1d331f8341
commit d882bddbea
2 changed files with 46 additions and 0 deletions
@@ -2042,9 +2042,21 @@ class MambaManager(SingleTypeKVCacheManager):
blocks = self.req_to_blocks[request.request_id]
assert 0 <= checkpoint_idx < len(blocks)
checkpoint_block = blocks[checkpoint_idx]
# The prompt's final chunk caches only up to its last full block,
# so ``num_tokens < num_prompt_tokens`` holds there too; its
# checkpoint is the prompt's reusable boundary, not a transient one.
is_prompt_checkpoint = (
checkpoint_position
== get_mamba_prefill_checkpoint_position(
request.num_prompt_tokens,
hash_block_size,
self.drop_eagle_checkpoint_block,
)
)
if (
retention_interval == 0
and num_tokens < request.num_prompt_tokens
and not is_prompt_checkpoint
and checkpoint_position != request.shared_prefix_boundary
):
# retention_interval == 0 keeps this transient checkpoint