Skip to content

test(mtp): drop monkeypatch of removed _get_generation_stream#1445

Merged
jundot merged 1 commit into
jundot:mainfrom
cfbraun:pr/fix-mtp-test-removed-helper
May 27, 2026
Merged

test(mtp): drop monkeypatch of removed _get_generation_stream#1445
jundot merged 1 commit into
jundot:mainfrom
cfbraun:pr/fix-mtp-test-removed-helper

Conversation

@cfbraun

@cfbraun cfbraun commented May 27, 2026

Copy link
Copy Markdown
Contributor

Summary

#1304 (fix(engine): per-engine threads to eliminate cross-engine stream contamination) refactored the patched BatchGenerator to inherit its execution stream from the enclosing engine context, and removed the module-level _get_generation_stream helper as part of that.

TestBatchGeneratorDispatch._make_reconcile_batch still tried to monkeypatch that name and failed at every test that used the fixture with:

AttributeError: module 'omlx.patches.mlx_lm_mtp.batch_generator' has no attribute '_get_generation_stream'

— taking down 4 reconcile-path tests on every CI run.

The override is no longer needed: the surrounding fixture replaces _rebuild_singleton_cache and _call_backbone with fakes that do their work via np.array / mx.array directly, so neither MLX dispatch nor stream selection is reached.

Test plan

  • pytest tests/test_mlx_lm_mtp_patch.py::TestBatchGeneratorDispatch — 11/11 pass (was 7/11 with these 4 failing on main):
    • test_reconcile_uses_queue_front_as_next_token
    • test_reconcile_empty_queue_samples_from_logits
    • test_reconcile_returns_false_on_empty_tokens
    • test_reconcile_fallback_on_rebuild_failure

jundot#1304 (``fix(engine): per-engine threads to eliminate cross-engine
stream contamination``) refactored the patched ``BatchGenerator`` to
inherit its execution stream from the enclosing engine context, and
removed the module-level ``_get_generation_stream`` helper as part of
that. ``TestBatchGeneratorDispatch._make_reconcile_batch`` still tried
to monkeypatch that name and failed at collection of every test that
depends on the fixture with ``AttributeError: module ... has no
attribute '_get_generation_stream'`` — taking down 4 reconcile-path
tests on every CI run.

The override is no longer needed: the surrounding fixture replaces
``_rebuild_singleton_cache`` and ``_call_backbone`` with fakes that
do all of their work via ``np.array`` / ``mx.array`` directly, so
neither MLX dispatch nor stream selection is reached.

Tests (tests/test_mlx_lm_mtp_patch.py::TestBatchGeneratorDispatch):
- test_reconcile_uses_queue_front_as_next_token
- test_reconcile_empty_queue_samples_from_logits
- test_reconcile_returns_false_on_empty_tokens
- test_reconcile_fallback_on_rebuild_failure

11/11 TestBatchGeneratorDispatch tests pass.
@jundot

jundot commented May 27, 2026

Copy link
Copy Markdown
Owner

Thanks for catching this — the _get_generation_stream removal in #1304 missed this fixture and I didn't notice because the four tests all fail at fixture setup rather than at the assertion. Patch is minimal and the reasoning in the comment is correct: with _rebuild_singleton_cache and _call_backbone both faked, nothing in _reconcile_mtp_to_standard actually dispatches through a stream context. Merging.

@jundot jundot merged commit e6d8a3f into jundot:main May 27, 2026
cfbraun added a commit to cfbraun/omlx that referenced this pull request May 27, 2026
@cfbraun cfbraun deleted the pr/fix-mtp-test-removed-helper branch May 27, 2026 07:28
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.

2 participants