Skip to content

The agent that grows with you

fix: skip lock entries replaced by non-directory files

Teknium2079e4f08d37
diff --git a/tests/tools/test_skills_hub.py b/tests/tools/test_skills_hub.py
index bad2048fa9e..310005d1e6a 100644
--- a/tests/tools/test_skills_hub.py
+++ b/tests/tools/test_skills_hub.py
@@ -553,12 +553,15 @@ class TestCheckForSkillUpdates:
assert results[0]["name"] == "demo-skill"
assert results[0]["status"] == "update_available"
- def test_orphaned_entry_reported_without_remote_fetch(self, tmp_path, monkeypatch):
+ @pytest.mark.parametrize("regular_file", [False, True])
+ def test_orphaned_entry_reported_without_remote_fetch(self, tmp_path, monkeypatch, regular_file):
"""A lock-file entry whose install directory no longer exists is
reported ``orphaned`` without paying the remote fetch cost (#104291)."""
import tools.skills_hub as hub
skills_dir = tmp_path / "skills"
skills_dir.mkdir()
+ if regular_file:
+ (skills_dir / "demo-skill").write_text("not an installed directory")
monkeypatch.setattr(hub, "SKILLS_DIR", skills_dir)
lock = MagicMock()
diff --git a/tools/skills_hub_install.py b/tools/skills_hub_install.py
index 5e6efcccd0a..b87282a4760 100644
--- a/tools/skills_hub_install.py
+++ b/tools/skills_hub_install.py
@@ -306,7 +306,7 @@ def check_for_skill_updates(
try:
install_dir = _resolve_lock_install_path(
entry.get("install_path", ""), entry.get("name", "skill"))
- orphaned = not install_dir.exists()
+ orphaned = not install_dir.is_dir()
except ValueError:
orphaned = False # unresolvable entries keep the pre-existing fetch behavior
if orphaned: