"""The default SDK path must return the answer already prepared for review.""" import json from types import SimpleNamespace from unittest.mock import AsyncMock import pytest from artemis.config import OutputConfig from artemis.graph.state import State from artemis.sdk.agent import Agent @pytest.mark.asyncio @pytest.mark.parametrize("outputter_enabled", [True, False]) async def test_default_output_reuses_executor_report_without_another_model( tmp_path, monkeypatch, outputter_enabled ): synthesize = AsyncMock() monkeypatch.setattr("artemis.sdk.agent.outputter", synthesize) ctx = SimpleNamespace( execution_setup=SimpleNamespace( outputter=SimpleNamespace(enabled=outputter_enabled, force_synthesis=False), disable_outputter=not outputter_enabled, ) ) result_path = tmp_path / "result.json" body = "# 调查结果\n双端检查已完成;未测功能不能记为通过。" result = await Agent._extract_output( object.__new__(Agent), task_name="exploration", ctx=ctx, request=SimpleNamespace(llm_output_path=result_path), output_config=OutputConfig(structured_output=None, output_description=None), state=State(initial_goal="调查", execution_report=body), ) assert result == body assert json.loads(result_path.read_text(encoding="utf-8")) == {"result": body} synthesize.assert_not_called()