Skip to content

Self-hosted AI workspace.

Python

fix(skills): require manage_skills action (#5856)

adabarbulescu20e7fc016428
diff --git a/src/tools/system.py b/src/tools/system.py
index 813d57df2..c2eb9ceab 100644
--- a/src/tools/system.py
+++ b/src/tools/system.py
@@ -46,7 +46,9 @@ async def do_manage_skills(content: str, owner: Optional[str] = None) -> Dict:
except ValueError:
return {"error": "Invalid JSON arguments", "exit_code": 1}
- action = (args.get("action") or "").lower()
+ action = (args.get("action") or "").strip().lower()
+ if not action:
+ return {"error": "action is required (list|view|view_ref|add|edit|patch|publish|delete|search)", "exit_code": 1}
from services.memory.skills import SkillsManager
from services.memory.skill_format import Skill, slugify
from src.constants import DATA_DIR
@@ -55,7 +57,7 @@ async def do_manage_skills(content: str, owner: Optional[str] = None) -> Dict:
# Accept legacy `skill_id` as an alias for `name`.
name = (args.get("name") or args.get("skill_id") or "").strip()
- if action in ("list", "index", ""):
+ if action in ("list", "index"):
all_skills = sm.load(owner=owner)
if not all_skills:
return {"results": "No skills yet. Create one with action='add'."}
diff --git a/tests/test_manage_skills_action_required.py b/tests/test_manage_skills_action_required.py
new file mode 100644
index 000000000..4efae8026
--- /dev/null
+++ b/tests/test_manage_skills_action_required.py
@@ -0,0 +1,24 @@
+import json
+
+import pytest
+
+from src.tools.system import do_manage_skills
+
+
+ "payload",
+ [
+ {},
+ {"action": ""},
+ {"action": " "},
+ {"name": "demo", "description": "x", "procedure": ["step"]},
+ ],
+)
+async def test_manage_skills_requires_action(payload):
+ result = await do_manage_skills(json.dumps(payload), owner="test")
+
+ assert result == {
+ "error": "action is required (list|view|view_ref|add|edit|patch|publish|delete|search)",
+ "exit_code": 1,
+ }