Spaces:
Running on CPU Upgrade
Running on CPU Upgrade
Aksel Joonas Reedi
Fix CLI rendering corruption and split CLI/frontend model defaults (#121)
3eec386 unverified | """Regression tests for interactive CLI rendering and research model routing.""" | |
| from io import StringIO | |
| from types import SimpleNamespace | |
| from agent.tools.research_tool import _get_research_model | |
| from agent.utils import terminal_display | |
| def test_direct_anthropic_research_model_stays_off_bedrock(): | |
| assert _get_research_model("anthropic/claude-opus-4-6") == "anthropic/claude-sonnet-4-6" | |
| def test_bedrock_anthropic_research_model_stays_on_bedrock(): | |
| assert ( | |
| _get_research_model("bedrock/us.anthropic.claude-opus-4-6-v1") | |
| == "bedrock/us.anthropic.claude-sonnet-4-6" | |
| ) | |
| def test_non_anthropic_research_model_is_unchanged(): | |
| assert _get_research_model("openai/gpt-5.4") == "openai/gpt-5.4" | |
| def test_subagent_display_does_not_spawn_background_redraw(monkeypatch): | |
| calls: list[object] = [] | |
| def _unexpected_future(*args, **kwargs): | |
| calls.append((args, kwargs)) | |
| raise AssertionError("background redraw task should not be created") | |
| monkeypatch.setattr("asyncio.ensure_future", _unexpected_future) | |
| monkeypatch.setattr( | |
| terminal_display, | |
| "_console", | |
| SimpleNamespace(file=StringIO(), width=100), | |
| ) | |
| mgr = terminal_display.SubAgentDisplayManager() | |
| mgr.start("agent-1", "research") | |
| mgr.add_call("agent-1", "▸ hf_papers {\"operation\": \"search\"}") | |
| mgr.clear("agent-1") | |
| assert calls == [] | |