Repository navigation
Reset local prefix cache on sleep - #5035
Merged
Merged
Conversation
RunningLeon
requested review from
caikun-pjlab
and
a balanced review from Copilot
October 16, 2026 09:08
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
No unresolved issues were identified in ownership cleanup, drain ordering, or regression coverage.
0 open findings
What changed in this PR
Prevents stale local KV-cache and state-checkpoint reuse after sleep while preserving remote Store objects for normal reloads.
Changes:
- Reset local prefix-cache metadata after workers and transfers drain.
- Guard cache cleanup against live references and pinned checkpoints.
- Add ownership and sleep/wakeup regression coverage.
| File | Description |
|---|---|
| tests/pytorch/paging/test_scheduler_kv_transfer.py | Tests transfer draining and cache reset guards. |
| tests/pytorch/paging/test_block_trie/test_clear.py | Tests ownership release, idempotence, and pin protection. |
| tests/pytorch/engine/test_engine_sleep.py | Tests cache invalidation and sleep/wakeup ordering. |
| lmdeploy/pytorch/paging/scheduler.py | Coordinates transfer completion and local cache reset. |
| lmdeploy/pytorch/paging/block_trie/trie.py | Adds guarded prefix-cache cleanup. |
| lmdeploy/pytorch/engine/engine.py | Invokes cache reset after worker sleep. |
🧠 Review effort: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
caikun-pjlab
approved these changes
Oct 21, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
Sleep discards worker cache storage but leaves local prefix-cache metadata intact, causing stale KV and state-checkpoint reuse after wakeup.
Modification
Validation: 394 unit tests passed. DP4/EP4 E2E passed for GLM-5.3 Flash with MTP3 and Qwen3 Mooncake Store with prefix caching on/off (96 requests). GLM-5.3 + Store is unsupported on the base branch.
Checklist