Repository navigation
Description
Description
The AG-UI test test_mixed_batch_preserves_effective_middleware_order_session_and_invocation_kwargs passes alone but fails after another test constructs MiddlewareBundle in the same Python process.
AGENT_HOOKS experimental warnings are deduplicated through the process-wide _WARNED_FEATURES set. Once an earlier test has populated the key, this test's pytest.warns(ExperimentalWarning, match="AGENT_HOOKS") sees no warning. Suppressing warnings in the earlier test does not prevent the feature key from being recorded.
Expected: the test's first-use warning assertion is independent of earlier tests, while production warning deduplication remains unchanged.
Actual: the mixed middleware test fails with DID NOT WARN when preceded by the core categorization test below.
Code Sample
Run from python/, in a single process:
uv run pytest -n 0 --import-mode=importlib \
packages/core/tests/core/test_middleware.py::TestCategorizeMiddleware::test_categorize_middleware_supported_categories_raises_for_bundle_members \
packages/ag-ui/tests/ag_ui/test_a2ui.py::test_mixed_batch_preserves_effective_middleware_order_session_and_invocation_kwargsThe first test passes and the second fails. Running the second test alone passes.
Error Messages / Stack Traces
Failed: DID NOT WARN. No warnings of type ExperimentalWarning were emitted.
1 failed, 1 passed
Package Versions
Source checkout e9857bd75a21843803431a2e7dfa41ee9b017ac7: agent-framework-core 1.20.0, agent-framework-ag-ui 1.5.0.
Python Version
Python 3.12.12.
Additional Context
The affected test was added in #8279. I will submit a test-only fix that temporarily replaces the warning cache for this first-use assertion and restores the original cache through pytest's monkeypatch fixture.
Metadata
Metadata
Labels
Type
Projects
- StatusShow more project fieldsDone
Activity
github-actions commentedon Oct 3, 2026
🤖 Automated triage reproduction notes (agent-authored — trust but verify)
Agent analysis
Repro:
python/packages/ag-ui/tests/ag_ui/test_a2ui.py::test_mixed_batch_preserves_effective_middleware_order_session_and_invocation_kwargsfails at line 102 when an earlier same-process test constructsMiddlewareBundle, which records theAGENT_HOOKSkey in_WARNED_FEATURES. Run the core categorization test named in issue #900 immediately before the AG-UI test withpytest -n 0 --import-mode=importlib; the first passes and the second reportsDID NOT WARN.python/packages/ag-ui/tests/ag_ui/test_a2ui.py::test_mixed_batch_preserves_effective_middleware_order_session_and_invocation_kwargsagent-framework-core 1.20.0; agent-framework-ag-ui 1.5.0agent-framework-core 1.20.0; agent-framework-ag-ui 1.5.0