The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(skills): keep the published skill map only when a skill root can't be stat'ed
Teknium356252872726
diff --git a/agent/skill_commands.py b/agent/skill_commands.pyindex 9cd9e449099..61ee7beac25 100644--- a/agent/skill_commands.py+++ b/agent/skill_commands.py@@ -592,12 +592,14 @@ def published_scopes_signature() -> tuple:def _skill_dirs_signature() -> Optional[tuple]:"""Stat-cheap change signature of every skill root (the catalog's own: the mtime and child names ofevery directory the catalog walks, depth-bounded, plus the disabled set and the platform). None when- it cannot be computed, which keeps the published map rather than rescanning on every lookup."""+ it cannot be computed (a root that cannot be stat'ed), which keeps the published map rather than+ rescanning on every lookup. Any other error raises: the catalog scan itself takes the same signature+ unguarded (``tools.skills_tool._skill_catalog``), and a swallowed bug would pin a stale map silently."""+ from tools.skills_tool import _get_disabled_skill_names, _skill_search_dirs, _skills_scan_signaturetry:- from tools.skills_tool import _get_disabled_skill_names, _skill_search_dirs, _skills_scan_signatureroots, _active = _skill_search_dirs()return _skills_scan_signature([d for _tier, d in roots], _get_disabled_skill_names())- except Exception:+ except OSError:logger.debug("Skill dir signature failed", exc_info=True)return Nonediff --git a/tests/agent/test_skill_commands_freshness.py b/tests/agent/test_skill_commands_freshness.pyindex 591b556a783..6a1918ea911 100644--- a/tests/agent/test_skill_commands_freshness.py+++ b/tests/agent/test_skill_commands_freshness.py@@ -68,3 +68,17 @@ def test_a_skill_installed_under_an_existing_category_subdir_is_served(tmp_path)after = sc_mod._skill_dirs_signature()assert [row for row in after[0] if "references" in row[0]] == []assert before != after # the skill dir itself gained a child name+++def test_only_an_unreadable_skill_root_keeps_the_published_map():+ """A stat failure (OSError) gives no signature and keeps the published map; a bug in the signature+ code raises instead of pinning a stale map for the life of the gateway without a trace."""+ import pytest++ import agent.skill_commands as sc_mod++ with patch("tools.skills_tool._skills_scan_signature", side_effect=PermissionError("denied")):+ assert sc_mod._skill_dirs_signature() is None+ with patch("tools.skills_tool._skills_scan_signature", side_effect=TypeError("bug")):+ with pytest.raises(TypeError):+ sc_mod._skill_dirs_signature()