diff --git a/tests/test_agent_v021_transport_normalize.py b/tests/test_agent_v021_transport_normalize.py index 33454838..752a82dd 100644 --- a/tests/test_agent_v021_transport_normalize.py +++ b/tests/test_agent_v021_transport_normalize.py @@ -68,12 +68,15 @@ def test_anthropic_title_uses_transport_normalize_response(monkeypatch): """ from api.streaming import generate_title_raw_via_agent - import agent.anthropic_adapter - - # Mirror v0.21: the module-level normalizer is gone (no-op on v0.21 trees). - monkeypatch.delattr( - agent.anthropic_adapter, 'normalize_anthropic_response', raising=False - ) + # Simulate the v0.21 adapter module in-process (works in agent-less CI too): + # it still exports build_anthropic_kwargs but deliberately does NOT define + # normalize_anthropic_response — exactly the environment this port targets. + fake_adapter = types.ModuleType('agent.anthropic_adapter') + fake_adapter.build_anthropic_kwargs = lambda **kwargs: {} + fake_agent_pkg = sys.modules.get('agent') or types.ModuleType('agent') + fake_agent_pkg.anthropic_adapter = fake_adapter + monkeypatch.setitem(sys.modules, 'agent', fake_agent_pkg) + monkeypatch.setitem(sys.modules, 'agent.anthropic_adapter', fake_adapter) transport = _FakeTransport(TITLE_TEXT) agent = _make_anthropic_fake_agent(transport) diff --git a/tests/test_issue1013_handoff_dock.py b/tests/test_issue1013_handoff_dock.py index 59ed12ca..b8691a70 100644 --- a/tests/test_issue1013_handoff_dock.py +++ b/tests/test_issue1013_handoff_dock.py @@ -669,12 +669,21 @@ def test_handoff_summary_codex_output_cap_matches_provider_compatibility( request_kwargs.append(kwargs) return object() - def _normalize_codex_response(self, response): - return types.SimpleNamespace(content="- You should complete the remaining review."), "stop" + def _get_transport(self, mode=None): + # hermes-agent v0.21 contract: normalization goes through the + # provider transport (CodexTransport.normalize_response returns + # NormalizedResponse with .content); the old + # AIAgent._normalize_codex_response method no longer exists. + assert mode == "codex_responses" + return _CodexTransport() def release_clients(self): return None + class _CodexTransport: + def normalize_response(self, response, **kwargs): + return types.SimpleNamespace(content="- You should complete the remaining review.") + fake_run_agent = types.ModuleType("run_agent") fake_run_agent.AIAgent = _CodexAgent monkeypatch.setitem(sys.modules, "run_agent", fake_run_agent)