From 782d743730e3df193c5969bc9897350fa14429cb Mon Sep 17 00:00:00 2001 From: 0xchainer <109617724+0xchainer@users.noreply.github.com> Date: Sun, 17 May 2026 01:57:34 +0300 Subject: [PATCH] test(skills): add regression test for skill load failure returning None Add test_returns_none_when_skill_load_fails to verify that build_skill_invocation_message() returns None when a registered skill exists in the command cache but _load_skill_payload() fails. This guards against regression of the fix in 877d01b. --- tests/agent/test_skill_commands.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tests/agent/test_skill_commands.py b/tests/agent/test_skill_commands.py index bbecd5c43f6..c11976ef978 100644 --- a/tests/agent/test_skill_commands.py +++ b/tests/agent/test_skill_commands.py @@ -466,6 +466,14 @@ Generate some audio. msg = build_skill_invocation_message("/nonexistent") assert msg is None + def test_returns_none_when_skill_load_fails(self, tmp_path): + with patch("tools.skills_tool.SKILLS_DIR", tmp_path): + _make_skill(tmp_path, "broken-skill") + scan_skill_commands() + with patch("agent.skill_commands._load_skill_payload", return_value=None): + msg = build_skill_invocation_message("/broken-skill", "do stuff") + assert msg is None + def test_uses_shared_skill_loader_for_secure_setup(self, tmp_path, monkeypatch): monkeypatch.delenv("TENOR_API_KEY", raising=False) calls = []