Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions astrbot/core/skills/skill_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -681,6 +681,8 @@ def list_skills(
return [skills_by_name[name] for name in sorted(skills_by_name)]

def is_sandbox_only_skill(self, name: str) -> bool:
if self._get_plugin_skill_dir(name) is not None:
return False
skill_dir = Path(self.skills_root) / name
skill_md_exists = _normalize_skill_markdown_path(skill_dir) is not None
if skill_md_exists:
Expand Down
39 changes: 39 additions & 0 deletions tests/test_skill_manager_sandbox_cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,3 +170,42 @@ def test_sandbox_and_local_path_resolution_with_show_sandbox_path_false(
assert local_skill_path.is_relative_to(skills_root)
assert local_skill_path == skills_root / "custom-local" / "SKILL.md"
assert by_name["python-sandbox"].path == "/app/skills/python-sandbox/SKILL.md"


def test_plugin_skill_with_stale_sandbox_cache_is_not_sandbox_only(
monkeypatch,
tmp_path: Path,
):
data_dir = tmp_path / "data"
temp_dir = tmp_path / "temp"
skills_root = tmp_path / "skills"
data_dir.mkdir(parents=True, exist_ok=True)
temp_dir.mkdir(parents=True, exist_ok=True)
skills_root.mkdir(parents=True, exist_ok=True)

monkeypatch.setattr(
"astrbot.core.skills.skill_manager.get_astrbot_data_path",
lambda: str(data_dir),
)
monkeypatch.setattr(
"astrbot.core.skills.skill_manager.get_astrbot_temp_path",
lambda: str(temp_dir),
)

from astrbot.core.skills import skill_manager as skill_manager_module

plugin_skills_root = Path(skill_manager_module.get_astrbot_plugin_path())
_write_skill(plugin_skills_root / "astrbot" / "skills", "pdf", "builtin pdf")

mgr = SkillManager(skills_root=str(skills_root))
mgr.set_sandbox_skills_cache(
[
{
"name": "pdf",
"description": "stale sandbox cache entry",
"path": "/app/skills/pdf/SKILL.md",
}
]
)

assert mgr.is_sandbox_only_skill("pdf") is False
Loading