test(headless_verification): wrap mock return in Result(data=...)
The test_headless_verification_full_run test in test_headless_verification.py
mocked src.multi_agent_conductor.ai_client.send_result with a return_value
of a raw string. The production code does 'if not result.ok:' which
fails on raw strings with AttributeError.
In xdist mode this caused a worker crash (gw0/gw11: 'node down: Not
properly terminated') that hung the entire tier-1-unit-headless batch
in the batched test runner (~50s+ per batch). The crash was the
worker dying while pytest-master waited for it; the master never
got a clean exit and the run was orphaned until the user's manual
cancel.
The test was missed in the original Phase 2 list (it was an xdist
crash rather than a test logic failure) and in the 4 Phase 2
follow-up commits (which targeted the 4 specific test files the
user reported during the run).
Change: mock_send.return_value = 'Task completed successfully.' ->
mock_send.return_value = Result(data='Task completed successfully.')
Plus add the Result import.
2/2 tests in test_headless_verification.py now pass under xdist
(was 1/2 + worker crash in xdist). Full headless batch (14 tests)
completes in 18.7s.
This commit is contained in:
@@ -5,6 +5,7 @@ from src.models import Ticket, Track
|
||||
from src import multi_agent_conductor
|
||||
from src.multi_agent_conductor import ConductorEngine
|
||||
from src import ai_client
|
||||
from src.result_types import Result
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_headless_verification_full_run(vlogger) -> None:
|
||||
@@ -31,7 +32,7 @@ async def test_headless_verification_full_run(vlogger) -> None:
|
||||
patch("src.multi_agent_conductor.ai_client.reset_session") as mock_reset, \
|
||||
patch("src.multi_agent_conductor.confirm_spawn", return_value=(True, "mock_prompt", "mock_ctx")):
|
||||
# We need mock_send to return something that doesn't contain "BLOCKED"
|
||||
mock_send.return_value = "Task completed successfully."
|
||||
mock_send.return_value = Result(data="Task completed successfully.")
|
||||
engine.run()
|
||||
|
||||
vlogger.log_state("T1 Status Final", "todo", t1.status)
|
||||
|
||||
Reference in New Issue
Block a user