Repository navigation
fix(minicpmo45): deadline-align native duplex silence continuation #7059
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
linyueqian
merged 4 commits into
vllm-project:main
from
Tiagosf00:fix/minicpmo-duplex-silence-deadline
Sep 17, 2026
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
c5a97a5
fix(minicpmo45): deadline-align duplex silence continuation on unifie…
Tiagosf00 5d7803c
style: fix SPDX copyright header on deadline pacing test
Tiagosf00 1a72a1d
fix(minicpmo45): skip stale silence continuations and clamp late dead…
Tiagosf00 67101c9
test(minicpmo45): harden deadline scheduler tests and numeric anchor …
Tiagosf00 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,88 @@ | ||
| # SPDX-License-Identifier: Apache-2.0 | ||
| # SPDX-FileCopyrightText: Copyright contributors to the vLLM-Omni project | ||
|
|
||
| """Deterministic unit tests for deadline-aligned silence continuation. | ||
|
|
||
| The engine-resident duplex scheduler in | ||
| ``vllm_omni/engine/duplex/session/runner.py`` aligns each silence | ||
| continuation to ``submission_time_N + chunk_period`` and sleeps only the | ||
| remaining budget. These tests cover the pure deadline arithmetic and the | ||
| per-session reset semantics of the shared ``DuplexModelSessionState`` | ||
| contract. | ||
| """ | ||
|
|
||
| from __future__ import annotations | ||
|
|
||
| import pytest | ||
|
|
||
| from vllm_omni.engine.duplex.session.runner import ( | ||
| compute_silence_continuation_deadline, | ||
| ) | ||
| from vllm_omni.model_executor.models.minicpmo_4_5.duplex.session import ( | ||
| MiniCPMO45ServingSessionState, | ||
| ) | ||
|
|
||
| pytestmark = [pytest.mark.core_model, pytest.mark.cpu] | ||
|
|
||
|
|
||
| @pytest.mark.parametrize( | ||
| ("chunk_period_s", "now", "last_submit", "current_deadline", "delay_s", "next_silence_deadline"), | ||
| [ | ||
| # First continuation anchors to the last real submission: unit N was | ||
| # submitted at t=1.0, audio N produced at 1.4 -> 0.6 s of sleep left. | ||
| (1.0, 1.4, 1.0, None, 0.6, 3.0), | ||
| # Only the remaining budget is slept (audio produced at 1.7). | ||
| (1.0, 1.7, 1.0, None, 0.3, 3.0), | ||
| # Overdue deadline: no sleep; the chain still advances by the period. | ||
| (1.0, 2.5, 1.0, None, 0.0, 3.0), | ||
| # No submission yet (None): the first continuation anchors to now. | ||
| (1.0, 0.4, None, None, 1.0, 2.4), | ||
| # Deadlines advance from the current deadline, not from now, so pipeline | ||
| # processing time does not accumulate as timer drift. | ||
| (1.0, 4.2, 3.0, 5.0, 0.8, 6.0), | ||
| # Two consecutive units that overrun their deadline by 0.2 s keep the | ||
| # 1 s cadence: no sleep, and the chain advances one period each. | ||
| (1.0, 2.2, 1.0, None, 0.0, 3.0), | ||
| (1.0, 3.2, 2.0, 3.0, 0.0, 4.0), | ||
| # A short overshoot (within one period of the current deadline) still | ||
| # chases the stale deadline: immediate submit, chain advances. | ||
| (1.0, 2.5, 1.0, 2.0, 0.0, 3.0), | ||
| # A long stall (more than one period past the current deadline) submits | ||
| # one continuation immediately and restarts from that submission. | ||
| (1.0, 5.0, 1.0, 2.0, 0.0, 6.0), | ||
| # The same recovery applies to the first continuation after a stall. | ||
| (1.0, 5.0, 1.0, None, 0.0, 6.0), | ||
| # Zero chunk period (guarded upstream): total, no sleep. | ||
| (0.0, 10.0, None, None, 0.0, 10.0), | ||
| ], | ||
| ) | ||
| def test_compute_silence_continuation_deadline( | ||
| chunk_period_s: float, | ||
| now: float, | ||
| last_submit: float | None, | ||
| current_deadline: float | None, | ||
| delay_s: float, | ||
| next_silence_deadline: float, | ||
| ) -> None: | ||
| delay, next_dl = compute_silence_continuation_deadline( | ||
| chunk_period_s=chunk_period_s, | ||
| now=now, | ||
| last_submit=last_submit, | ||
| current_deadline=current_deadline, | ||
| ) | ||
| assert delay == pytest.approx(delay_s) | ||
| assert next_dl == pytest.approx(next_silence_deadline) | ||
|
|
||
|
|
||
| class TestSilenceDeadlineSessionState: | ||
| def test_clear_continuation_resets_the_deadline_chain(self) -> None: | ||
| # The native-duplex session state feeds the shared runner, so it must | ||
| # start with an unset chain and drop it at turn boundaries. | ||
| state = MiniCPMO45ServingSessionState() | ||
| assert state.last_native_submit_monotonic is None | ||
| assert state.silence_deadline_monotonic is None | ||
| state.last_native_submit_monotonic = 5.0 | ||
| state.silence_deadline_monotonic = 6.0 | ||
| state.clear_continuation() | ||
| assert state.last_native_submit_monotonic is None | ||
| assert state.silence_deadline_monotonic is None | ||
Oops, something went wrong.
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[suggestion] These cases pin the arithmetic well, but nothing here runs
_schedule_silence_continuationitself: with a fake monotonic clock and a patchedasyncio.sleep, a test that drives two continuations then a real append and asserts the recorded sleeps and the re-anchored deadline would catch both interleavings above and would fail if the scheduler ever went back to a flatsleep(chunk_period). Right now that revert passes this file, and removing_reanchor_chainfails nothing.