Skip to content

fix: add missing is_finished param to llm2code2wav_async_chunk (fixes #1569)#1638

Closed
dubin555 wants to merge 3 commits intovllm-project:mainfrom
dubin555:oss-scout/verify-fix-mimo-audio-is-finished-param
Closed

fix: add missing is_finished param to llm2code2wav_async_chunk (fixes #1569)#1638
dubin555 wants to merge 3 commits intovllm-project:mainfrom
dubin555:oss-scout/verify-fix-mimo-audio-is-finished-param

Conversation

@dubin555
Copy link
Copy Markdown
Contributor

@dubin555 dubin555 commented Mar 3, 2026

Purpose

Fixes #1569

llm2code2wav_async_chunk() in mimo_audio.py is missing the is_finished keyword argument that _send_single_request() in chunk_transfer_adapter.py:211 passes to it. This causes a TypeError crash when MiMo-Audio is used in async chunk mode:

(EngineCore_DP0 pid=51408) [Stage-0] ERROR 02-28 16:59:50 [chunk_transfer_adapter.py:213]
Failed to use custom_process_input_func for payload extraction:
llm2code2wav_async_chunk() got an unexpected keyword argument 'is_finished'

This PR:

  • Adds is_finished: bool = False to the llm2code2wav_async_chunk() signature, matching the pattern used by thinker2talker_async_chunk in qwen3_omni.py
  • Replaces all request.is_finished() calls inside the function with the is_finished parameter. This is the correct behavior because the caller (save_async) snapshots the finished state at task creation time, so the explicit parameter should be used rather than querying the request object which may have changed state by the time the background thread processes it.

Test Plan

Unit tests verifying the fix:

python3 -m pytest test_fix_mimo_audio_is_finished.py -v

Tests cover:

  • Function signature includes is_finished parameter (matching thinker2talker_async_chunk pattern)
  • Calling with is_finished kwarg no longer raises TypeError
  • is_finished=True correctly sets the finished flag in the output payload
  • is_finished=False correctly buffers until chunk is full
  • Empty codes with is_finished=True returns sentinel

Test Result

Before fix — all 5 tests fail with TypeError: llm2code2wav_async_chunk() got an unexpected keyword argument 'is_finished':

test_calling_with_is_finished_kwarg_raises_typeerror FAILED
test_empty_codes_with_is_finished_returns_sentinel FAILED
test_is_finished_false_buffers_until_chunk_full FAILED
test_is_finished_true_sets_finished_flag_in_payload FAILED
test_signature_matches_thinker2talker_pattern FAILED

5 failed in 1.77s

After fix — all 5 tests pass:

test_calling_with_is_finished_kwarg_raises_typeerror PASSED
test_empty_codes_with_is_finished_returns_sentinel PASSED
test_is_finished_false_buffers_until_chunk_full PASSED
test_is_finished_true_sets_finished_flag_in_payload PASSED
test_signature_matches_thinker2talker_pattern PASSED

5 passed in 1.81s

Essential Elements of an Effective PR Description Checklist
  • The purpose of the PR, such as "Fix some issue (link existing issues this PR will resolve)".
  • The test plan. Please provide the test scripts & test commands.
  • The test results. Please paste the results comparison before and after.
  • (Optional) The necessary documentation update.
  • (Optional) Release notes update.

…ixes vllm-project#1569)

The call site in chunk_transfer_adapter.py:211 passes is_finished=is_finished
to llm2code2wav_async_chunk(), but the function signature did not accept this
parameter, causing a TypeError crash in MiMo-Audio async chunk mode.

Add is_finished: bool = False to the function signature (matching
thinker2talker_async_chunk in qwen3_omni.py) and replace all
request.is_finished() calls with the is_finished parameter, which correctly
uses the state snapshot captured at task creation time.
@dubin555 dubin555 requested a review from hsliuustc0106 as a code owner March 3, 2026 11:50
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 45b375e3b8

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

if "vllm.inputs" not in sys.modules:
stub = types.ModuleType("vllm.inputs")
stub.TextPrompt = type("TextPrompt", (), {})
sys.modules["vllm"] = types.ModuleType("vllm")
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Keep test from poisoning global import state

Importing this test module mutates sys.modules at module scope by assigning stub packages (including vllm and later vllm_omni) without restoring them, so a normal pytest run that imports this file early can cause unrelated tests to fail with errors like 'vllm_omni' is not a package when they import real modules afterward. This makes suite behavior order-dependent and can break full-repo test execution.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Good catch — the module-scope sys.modules mutation is indeed problematic for full-suite runs. I've moved the stub injection and module loading into setUpModule() with a sys.modules snapshot, and added tearDownModule() to restore the original state. This way the stubs are scoped to this test module only and won't affect other tests.

dubin555 added 2 commits March 3, 2026 12:03
Move stub injection and module loading into setUpModule() with a
sys.modules snapshot, and restore the original state in
tearDownModule(). This prevents the test from poisoning the global
import state for other tests in the suite.
Move test_fix_mimo_audio_is_finished.py from repo root into tests/
to follow project conventions. Update path computation accordingly.
@amy-why-3459
Copy link
Copy Markdown
Contributor

Are the changes in this PR the same as in 1570? #1570

@dubin555 dubin555 closed this Mar 3, 2026
@hsliuustc0106
Copy link
Copy Markdown
Collaborator

Duplicate of Already-Merged PR #1570

This PR fixes the same bug as PR #1570, which was already merged on 2026-03-02.

Field PR #1570 (MERGED) This PR
Author qibaoyuan (MiMo-Audio author) dubin555
Merged 2026-03-02 Open
Source fix ✅ Identical ✅ Identical
Tests ❌ None ✅ 5 tests

Both PRs make the exact same change:

  1. Add is_finished: bool = False parameter to llm2code2wav_async_chunk
  2. Replace all 9 request.is_finished() calls with the is_finished parameter

Recommendations

  1. Close this PR - the bug fix is already in main
  2. Extract the tests - if these tests are valuable, open a new PR with only tests/test_fix_mimo_audio_is_finished.py

Credit to @dubin555 for writing comprehensive tests independently! The test coverage is good and would be a welcome addition as a standalone PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: mimo-audio async error: llm2code2wav_async_chunk() got an unexpected keyword argument 'is_finished'

3 participants