fix: require matrix agent registry in real mode

This commit is contained in:
Mikhail Putilovskij 2026-04-24 13:24:56 +03:00
parent 242f4aadd3
commit 9ccba161a2
2 changed files with 43 additions and 21 deletions

View file

@ -214,6 +214,28 @@ async def test_build_runtime_real_backend_uses_routed_platform_with_registry(
assert runtime.platform._delegates["agent-2"].agent_id == "agent-2"
def test_build_runtime_real_backend_requires_registry_path(monkeypatch: pytest.MonkeyPatch):
monkeypatch.setenv("MATRIX_PLATFORM_BACKEND", "real")
monkeypatch.delenv("MATRIX_AGENT_REGISTRY_PATH", raising=False)
monkeypatch.setenv("AGENT_BASE_URL", "http://agent.example")
with pytest.raises(RuntimeError, match="MATRIX_AGENT_REGISTRY_PATH"):
build_runtime()
def test_build_runtime_real_backend_fails_explicitly_on_invalid_registry(
monkeypatch: pytest.MonkeyPatch,
tmp_path: Path,
):
registry_path = tmp_path / "missing.yaml"
monkeypatch.setenv("MATRIX_PLATFORM_BACKEND", "real")
monkeypatch.setenv("MATRIX_AGENT_REGISTRY_PATH", str(registry_path))
monkeypatch.setenv("AGENT_BASE_URL", "http://agent.example")
with pytest.raises(RuntimeError, match="failed to load matrix agent registry"):
build_runtime()
@pytest.mark.asyncio
async def test_bot_keeps_local_chat_id_for_plain_message_dispatch():
runtime = build_runtime(platform=MockPlatformClient())