test_core is red on main in three places; --maxfail=1 hides the later two
What happened
tests/test_core/test_voice/test_connectors/test_webrtc.py::test_agent_audio_and_text_arrive_as_events fails deterministically on main under Python 3.11, which is what test_core.yml runs. The audio event arrives; the transcript event never does:
E AssertionError: assert [] == ['Hello']
E Right contains one more item: 'Hello'The same test passes on Python 3.14 with the same tree and the same fake stack, so this is a version-dependent ordering problem, not a broken assertion.
Why it is invisible on main today
test_core.yml runs the suite with --maxfail=1, and on main at 385117c an unrelated failure stops the run long before this test:
FAILED tests/test_metrics/test_eval_mode_metrics.py::test_hybrid_jev_takes_the_decisions[sync-MultiTurnMCPUse]
E AttributeError: 'CallToolResult' object has no attribute 'structuredContent'
!!!! stopping after 1 failures !!!!!!!!!!!!!!!!!!!!!!!!!!That lands at 38%; this test sits at 94%. So main's own runs never reach it, and any PR that fixes the structuredContent failure hits this one next. There is a third one behind that as well: tests/test_core/test_sqlite_store.py::TestTestRunManagerIntegration::test_storage_failure_is_a_warning_not_an_error also fails on main on the runners' temp-path length — disk I/O error gets word-wrapped to disk\nI/O error because deepeval/test_run/test_run.py:10 shadows the builtin print with from rich import print (PR #3316 fixes that one).
Reproduction
It fails on its own, with no other test running first, on unmodified main:
$ git checkout 385117c # unmodified main
$ .venv/bin/python -m pytest tests/test_core/test_voice/test_connectors/test_webrtc.py \
-k test_agent_audio_and_text_arrive_as_events -q
1 failed, 15 deselected in 0.48sThe identical command on Python 3.14.5 passes (1 passed). The version, not the tree, decides the assertion.
Unmodified main, no local changes:
$ uv venv --python 3.11 .venv && uv pip install --python .venv \
pytest pytest-asyncio pytest-xdist pytest-repeat pytest-rerunfailures \
aiortc av aiohttp rich portalocker requests tqdm tabulate openai pydantic \
pydantic-settings httpx typer click nest-asyncio tenacity \
opentelemetry-api opentelemetry-sdk grpcio posthog pyfiglet python-dotenv \
jinja2 textual pyperclip questionary
$ .venv/bin/python -m pytest -q --maxfail=1 --capture=tee-sys tests/test_core/ \
--ignore=tests/test_core/test_synthesizer/ --ignore=tests/test_core/test_datasets/ \
--ignore=tests/test_core/test_tracing/test_dataset_iterator.py \
--ignore=tests/test_core/test_evaluation/test_end_to_end/test_configs.py \
--deselect tests/test_core/test_models/test_embedding_models/test_ollama_embedding_model.py
FAILED tests/test_core/test_voice/test_connectors/test_webrtc.py::test_agent_audio_and_text_arrive_as_events
1 failed, 1557 passed, 35 skipped, 3 deselected in 85.98s (0:01:25)Two notes on the setup, so the numbers are comparable: I installed the dependency list from [tool.poetry.dependencies] rather than resolving poetry.lock, and I deselected the ollama embedding test because it needs a local ollama server. Neither affects the voice tests. The same run on unmodified main and on a branch whose only change is two lines in deepeval/test_run/test_run.py gives the identical 1 failed, 1557 passed, 35 skipped, 3 deselected, which is how I ruled out my own diff.
_on_text (deepeval/voice/connectors/transports/webrtc.py:534) is synchronous and uses put_nowait, so once the data-channel message is handled the transcript is in _inbound immediately — and extract_text returns 'Hello' on both interpreters, so the early return is not the path being taken.
The consumer is iter_agent_events → iter_downlink (transports/base.py:61), an unbounded while True: await queue.get() that only ever stops because the test's loop breaks on event.turn_complete. _on_connection_state (:548) is what emits turn_complete, on failed/closed.
So the failing order is audio → turn_complete → break, with the transcript not yet in the queue at that point. Since the fake in the test drives those callbacks itself, the 3.11-vs-3.14 difference looks like scheduling: on 3.11 the loop is resumed for the track task and the state callback before the message callback's queue write is observed. I have not pinned down which callback wins, and I would not want to guess at the fix from the outside.
What would help
- Confirm on your side whether this reproduces on 3.11 for you — it should, from
385117c. - If it is a real ordering bug, a
put_nowaittranscript should not be able to lose a race against aturn_completefrom_on_connection_state; aturn_completeemitted before the transcript is in the queue looks like the thing to guard. - Running the voice tests as their own job in
test_core.ymlwould have surfaced this without--maxfail=1hiding it.
I am not opening a PR for this — I was triaging CI on an unrelated branch (#3316) and hit it. Happy to send one if you tell me which behaviour is intended.
Source: confident-ai/deepeval