Skip to content

[Bugfix][Mooncake] Offload producer partial tails on request finish - #52832

Merged
ywang96 merged 7 commits into
vllm-project:mainfrom
Dao007forever:dao/tail-offload
Sep 1, 2026
Merged

ywang96 merged 7 commits into
vllm-project:mainfrom
Dao007forever:dao/tail-offload

Conversation

@Dao007forever

@Dao007forever Dao007forever commented Aug 18, 2026

Copy link
Copy Markdown
Contributor

Summary

Offload a producer's final partial Mamba align tail when the request finishes before another allocation can trigger copy-on-write.

The core now finalizes the unchanged table source only when the request ends exactly at the registered boundary with no tokens in flight. The handoff is routed through KVConnectorBase_V1 and MultiConnector; Mooncake immediately pins the exact boundary-state block, queues metadata with its store-job ID, and releases the pin after every worker reports completion. The finished request itself does not remain retained.

Root cause

Partial-tail offloads were emitted only when a later allocation triggered CoW and moved the registered boundary state into a durable private block. A prefill-only producer that finished at that boundary never allocated again, so its final partial Mamba state was dropped and could not be persisted for later prefix hits.

Impact

Later requests can reuse a producer's final partial hybrid prefix from Mooncake Store even when the producer ends immediately after prefill. Safety checks consume the marker without emitting a handoff if tokens remain in flight or computation advanced past the registered boundary.

Duplicate-work check

This is not duplicate work:

No open PR was found for the head branch or for searches covering producer partial-tail finish-time offload.

Validation

Focused prefix-cache, Mooncake Store scheduler, and MultiConnector suites:

.venv/bin/python -m pytest \
  tests/v1/core/prefix_cache/test_partial_prefix_cache_hits.py \
  tests/v1/kv_connector/unit/test_mooncake_store_scheduler.py \
  tests/v1/kv_connector/unit/test_multi_connector.py \
  -q -k "not multi_example_connector_consistency"

Result: 103 passed, 1 skipped, 1 deselected. On macOS, only the repository global cleanup hook was disabled because the installed PyTorch build raises an unrelated MPS allocator assertion during teardown; all selected test bodies passed.

The four finish-time handoff tests also passed independently. Pre-commit passed on every changed file, including ruff, formatting, mypy, SPDX, and repository policy hooks.

The deselected MultiConnector test requires a runnable accelerator and model engine, which were unavailable in this environment.

Model evaluation

Not run. This conflict resolution was validated at the focused unit-test level; serving/model evaluation still requires a Mooncake deployment.

AI assistance

AI assistance was used to resolve conflicts, adapt the change to the current per-store-job pinning design, run validation, and prepare this PR. The human submitter must review every changed line and be able to understand and defend the change end-to-end.

A producer request that ends on a partial Mamba align block previously dropped that final tail. The boundary was only handed to a connector when a later allocation triggered CoW, which never happens on a prefill-only producer.

Finalize the unchanged table source when the request completes exactly at the registered boundary with no tokens in flight. Fan the finish-time handoff through KVConnectorBase and MultiConnector. Mooncake retains the source until the next connector step assigns a store job, then holds a per-job pin until every worker reports completion.

Tests: 62 passed across the prefix-cache, Mooncake Store, and focused MultiConnector suites. Pre-commit passed on every changed file.

Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>

Signed-off-by: Dao Le <daole@inferact.ai>

Signed-off-by: Dao Le <Dao007forever@gmail.com>
@mergify mergify Bot added bug Something isn't working kv-connector labels Aug 18, 2026
@Dao007forever
Dao007forever marked this pull request as ready for review August 18, 2026 22:20

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Claude Code Review

This pull request is from a fork — automated review is disabled. A repository maintainer can comment @claude review to run a one-time review.

@ywang96 ywang96 added the ready ONLY add when PR is ready to merge/full CI is needed label Aug 18, 2026
@ywang96

ywang96 commented Aug 18, 2026

Copy link
Copy Markdown
Member

/ci run

@github-actions

Copy link
Copy Markdown

✅ Triggered Buildkite CI #84497 for commit c5eb44e4a3da.

@ZJY0516

ZJY0516 commented Aug 21, 2026

Copy link
Copy Markdown
Member

/ci run

@github-actions

Copy link
Copy Markdown

✅ Triggered Buildkite CI #84953 for commit 1ac894ea9d2b.

@mergify

mergify Bot commented Aug 29, 2026

Copy link
Copy Markdown
Contributor

This pull request has merge conflicts that must be resolved before it can be
merged. Please rebase the PR, @Dao007forever.

https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/working-with-forks/syncing-a-fork

@mergify mergify Bot added the needs-rebase label Aug 29, 2026
Resolve the vllm-project#51358 overlap by porting finish-time Mamba tail handoffs to exact boundary-state store jobs.

Co-authored-by: OpenAI Codex <noreply@openai.com>
Signed-off-by: Dao Le <Dao007forever@gmail.com>
@mergify mergify Bot removed the needs-rebase label Aug 31, 2026
@zhewenl

zhewenl commented Sep 1, 2026

Copy link
Copy Markdown
Collaborator

/ci run

@github-actions

github-actions Bot commented Sep 1, 2026

Copy link
Copy Markdown

✅ Triggered Buildkite CI #86522 for commit ee994c2671c2.

@khluu

khluu commented Sep 1, 2026

Copy link
Copy Markdown
Member

/ci run

@github-actions

github-actions Bot commented Sep 1, 2026

Copy link
Copy Markdown

✅ Triggered Buildkite CI #86674 for commit ca92162b1e9f.

@ywang96
ywang96 merged commit 7cb9a88 into vllm-project:main Sep 1, 2026
90 of 92 checks passed
mylibrar pushed a commit to tanyuqian/vllm that referenced this pull request Sep 3, 2026
…llm-project#52832)

Signed-off-by: Dao Le <Dao007forever@gmail.com>
Co-authored-by: Roger Wang <hey@rogerw.io>
Co-authored-by: OpenAI Codex <noreply@openai.com>
sheralskumar pushed a commit to sheralskumar/vllm that referenced this pull request Sep 8, 2026
…llm-project#52832)

Signed-off-by: Dao Le <Dao007forever@gmail.com>
Co-authored-by: Roger Wang <hey@rogerw.io>
Co-authored-by: OpenAI Codex <noreply@openai.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working kv-cache-manager kv-connector ready ONLY add when PR is ready to merge/full CI is needed scheduler

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants