The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(curator): check unpin result, guard status ghost rows, tighten test
bepleedd20c30dec51
diff --git a/hermes_cli/curator.py b/hermes_cli/curator.pyindex aacb89ac7eb..b65d9016d18 100644--- a/hermes_cli/curator.py+++ b/hermes_cli/curator.py@@ -299,7 +299,7 @@ def _cmd_pin(args) -> int:print(f"curator: could not pin '{args.skill}' — the skill is not ""curation-eligible (protected built-in or external). "- f"`hermes curator status` shows why a skill is unmanaged."+ "`hermes curator list-unmanaged` shows which skills the curator tracks.")return 1print(f"curator: pinned '{args.skill}' (will bypass auto-transitions)")@@ -314,7 +314,12 @@ def _cmd_unpin(args) -> int:"there's nothing to unpin (curator only tracks agent-created skills)")return 1- skill_usage.set_pinned(args.skill, False)+ if not skill_usage.set_pinned(args.skill, False):+ print(+ f"curator: could not unpin '{args.skill}' — the skill is not "+ "curation-eligible (protected built-in or external)."+ )+ return 1print(f"curator: unpinned '{args.skill}'")return 0diff --git a/tests/hermes_cli/test_curator_pin_visibility.py b/tests/hermes_cli/test_curator_pin_visibility.pyindex acacabaec00..7e62740adf6 100644--- a/tests/hermes_cli/test_curator_pin_visibility.py+++ b/tests/hermes_cli/test_curator_pin_visibility.py@@ -142,21 +142,23 @@ def test_pinned_eligible_unmanaged_skill_visible_in_status(pin_env):rc = cli._cmd_pin(_Args("legacy-skill"))out = buf.getvalue()- # The pin itself should succeed for an eligible skill...- if rc == 0:- rec = usage.get_record("legacy-skill")- assert rec.get("pinned") is True, "eligible skill pin wrote nothing despite rc=0"-- # ...and then status MUST show it. This is the visibility half.- buf2 = io.StringIO()- with redirect_stdout(buf2):- status_rc = cli._cmd_status(Namespace())- assert status_rc == 0- status = buf2.getvalue()- assert "legacy-skill" in status and "pinned" in status.lower(), (- "pin landed on disk but the skill is absent from `curator status` "- "— the invisible-pin defect."- )+ # The pin MUST succeed for an eligible skill — unconditional, so a+ # regression that flips pin to failure fails here instead of silently+ # skipping the visibility assertions below.+ assert rc == 0, f"eligible-skill pin must succeed (got rc={rc}): {out.strip()}"+ rec = usage.get_record("legacy-skill")+ assert rec.get("pinned") is True, "eligible skill pin wrote nothing despite rc=0"++ # ...and then status MUST show it. This is the visibility half.+ buf2 = io.StringIO()+ with redirect_stdout(buf2):+ status_rc = cli._cmd_status(Namespace())+ assert status_rc == 0+ status = buf2.getvalue()+ assert "legacy-skill" in status and "pinned" in status.lower(), (+ "pin landed on disk but the skill is absent from `curator status` "+ "— the invisible-pin defect."+ )# ---------------------------------------------------------------------------diff --git a/tools/skill_usage.py b/tools/skill_usage.pyindex cfae95c0462..5fd6425cc7f 100644--- a/tools/skill_usage.py+++ b/tools/skill_usage.py@@ -1303,9 +1303,16 @@ def curated_report() -> List[Dict[str, Any]]:names = set(list_agent_created_skill_names())# Issue #92993: a successfully pinned skill must be visible in the report# even when it lacks the created_by marker (eligible-but-unmanaged), or- # its pin silently vanishes from `curator status`.+ # its pin silently vanishes from `curator status`. The local-dir guard+ # keeps stale records for deleted skill dirs from rendering as ghost rows;+ # `curator unpin` is the cleanup path for those.for name, rec in data.items():- if isinstance(rec, dict) and rec.get("pinned") and is_curation_eligible(name):+ if (+ isinstance(rec, dict)+ and rec.get("pinned")+ and is_curation_eligible(name)+ and _find_skill_dir(name) is not None+ ):names.add(name)for name in sorted(names):raw = data.get(name)