The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(skills): partial preload warning keeps the Ambiguous wording
kshitijk4poorfb6b900bc015
diff --git a/agent/skill_commands.py b/agent/skill_commands.pyindex 244576d4c85..2e5b40b95b2 100644--- a/agent/skill_commands.py+++ b/agent/skill_commands.py@@ -249,7 +249,8 @@ def ambiguous_skill_label(identifier: str, payload: dict) -> Optional[str]:"""``Ambiguous skill name X: use one of <paths>`` when a failed skill_view *payload* is a same-tiername collision, else None — so preload/cron say why instead of "Unknown"/"not found"."""load_names = payload.get("load_names") if isinstance(payload, dict) else None- return f"Ambiguous skill name {identifier}: use one of {', '.join(load_names)}" if load_names else None+ from agent.skill_utils import AMBIGUOUS_SKILL_PREFIX+ return f"{AMBIGUOUS_SKILL_PREFIX}{identifier}: use one of {', '.join(load_names)}" if load_names else Nonedef _missing_skill_label(identifier: str) -> str:@@ -266,7 +267,8 @@ def _missing_skill_label(identifier: str) -> str:def format_missing_skills(missing: list[str]) -> str:"""One error line for unresolved preload identifiers: ambiguous ones keep their own wording,the rest are reported as ``Unknown skill(s): ...``."""- ambiguous = [m for m in missing if m.startswith("Ambiguous skill name ")]+ from agent.skill_utils import AMBIGUOUS_SKILL_PREFIX+ ambiguous = [m for m in missing if m.startswith(AMBIGUOUS_SKILL_PREFIX)]unknown = [m for m in missing if m not in ambiguous]return "; ".join(ambiguous + ([f"Unknown skill(s): {', '.join(unknown)}"] if unknown else []))diff --git a/agent/skill_utils.py b/agent/skill_utils.pyindex 298c2424e4f..69d06b08e5f 100644--- a/agent/skill_utils.py+++ b/agent/skill_utils.py@@ -420,6 +420,8 @@ def display_skill_create_dir() -> str:# skills.external_dirs. Inside ONE tier two different skills sharing a name stay ambiguous — refused,# never guessed (59da8ec4e) — while identical copies under one root resolve to the shallowest.TIER_PROJECT, TIER_LOCAL, TIER_CREATE_DIR, TIER_EXTERNAL = range(4)+# Leading words of every same-tier refusal (skill_view error, preload/cron label) — one spelling.+AMBIGUOUS_SKILL_PREFIX = "Ambiguous skill name "_WARNED_SHADOWS: Set[str] = set()diff --git a/cli.py b/cli.pyindex 6c27c901250..095fc99296d 100644--- a/cli.py+++ b/cli.py@@ -1044,19 +1044,12 @@ class HermesCLI(CLIInitMixin, CLITuiRuntimeMixin, CLIProcessNotificationsMixin,returnskills_prompt, loaded_skills, missing_skills = resultif missing_skills:- missing_display = ", ".join(missing_skills)+ from agent.skill_commands import format_missing_skills# A typo'd name must not crash a kanban worker; only a fully-missing set fails loudly.- if loaded_skills:- logger.warning(- "Unknown skill(s) requested, skipping: %s. "- "Continuing with: %s. "- "List available skills with `hermes skills list`.",- missing_display,- ", ".join(loaded_skills),- )- else:- from agent.skill_commands import format_missing_skills+ if not loaded_skills:raise ValueError(format_missing_skills(missing_skills))+ logger.warning("Skipping %s. Continuing with: %s. List available skills with `hermes skills list`.",+ format_missing_skills(missing_skills), ", ".join(loaded_skills))if skills_prompt:self.system_prompt = "\n\n".join(p for p in (self.system_prompt, skills_prompt) if p).strip()self.preloaded_skills += [name for name in loaded_skills if name not in self.preloaded_skills]diff --git a/hermes_cli/oneshot.py b/hermes_cli/oneshot.pyindex d18ade56798..2457694bee7 100644--- a/hermes_cli/oneshot.py+++ b/hermes_cli/oneshot.py@@ -131,13 +131,11 @@ def _build_preloaded_skills_prompt(skills: object = None) -> str | None:skills_prompt, loaded_skills, missing_skills = build_preloaded_skills_prompt(parsed_skills)if missing_skills:- missing_display = ", ".join(missing_skills)if not loaded_skills:raise ValueError(format_missing_skills(missing_skills))logging.warning(- "Unknown skill(s) requested, skipping: %s. Continuing with: %s. "- "List available skills with `hermes skills list`.",- missing_display,+ "Skipping %s. Continuing with: %s. List available skills with `hermes skills list`.",+ format_missing_skills(missing_skills),", ".join(loaded_skills),)return skills_prompt or Nonediff --git a/tests/agent/test_skill_commands.py b/tests/agent/test_skill_commands.pyindex 1203ecdf9a2..cf17816f6e6 100644--- a/tests/agent/test_skill_commands.py+++ b/tests/agent/test_skill_commands.py@@ -549,7 +549,7 @@ class TestBuildPreloadedSkillsPrompt:class TestDuplicateNamesAgreeAcrossSurfaces:- def test_every_surface_resolves_duplicates_like_skill_view(self, tmp_path, monkeypatch):+ def test_every_surface_resolves_duplicates_like_skill_view(self, tmp_path, monkeypatch, caplog):"""#64392: list, prompt index, slash commands, skill_view, -s preload and cron agree. A same-tierduplicate is advertised only by its exact path and every loader names those paths; a cross-tierduplicate (same relative path, local + external) loads the local copy everywhere."""@@ -584,6 +584,10 @@ class TestDuplicateNamesAgreeAcrossSurfaces:assert "LOCAL XDUP" in json.loads(skill_view(ident))["content"]_, loaded, missing = build_preloaded_skills_prompt(["dup-demo", "xdup", "a/one"])assert (loaded, missing) == (["xdup", "dup-demo"], [ambiguous])+ from hermes_cli.oneshot import _build_preloaded_skills_prompt+ with caplog.at_level("WARNING"): # partial preload: the skip warning keeps the Ambiguous wording+ assert _build_preloaded_skills_prompt(["dup-demo", "xdup"])+ assert f"Skipping {ambiguous}. Continuing with: xdup" in caplog.text and "Unknown" not in caplog.textparts = _load_cron_skill_parts({"id": "j"}, ["dup-demo", "xdup"])assert ambiguous in parts[0] and "LOCAL XDUP" in "\n".join(parts)diff --git a/tools/skills_tool.py b/tools/skills_tool.pyindex ea963b65ee3..bce35724689 100644--- a/tools/skills_tool.py+++ b/tools/skills_tool.py@@ -500,7 +500,7 @@ def _locate_skill(name: str, local_category_name: Optional[str], roots):(project > local > create_dir > external, shadowed copies logged), same-tier collision refusal,same-root identical-copy ranking, quarantine gate, not-found listing. ``(error_json, skill_dir,skill_md)``; skill_md set iff no error."""- from agent.skill_utils import TIER_PROJECT, pick_skill_candidate+ from agent.skill_utils import AMBIGUOUS_SKILL_PREFIX, TIER_PROJECT, pick_skill_candidateall_dirs = [d for _t, d in roots]if not all_dirs:return _fail(@@ -525,7 +525,7 @@ def _locate_skill(name: str, local_category_name: Optional[str], roots):load_names = sorted({_owned_relative(sd, smd, all_dirs) for sd, smd in candidates} - {name})logger.warning("Skill name collision for '%s': %d candidates — %s", name, len(candidates), "; ".join(paths))return _fail(- f"Ambiguous skill name '{name}': "+ f"{AMBIGUOUS_SKILL_PREFIX}'{name}': "+ (f"use one of {', '.join(load_names)}. " if load_names else "")+ f"{len(candidates)} different skills share this name in the same skills directory tier; ""refusing to guess.",diff --git a/tui_gateway/server.py b/tui_gateway/server.pyindex 1fdfec497dd..301e7d5f4d4 100644--- a/tui_gateway/server.py+++ b/tui_gateway/server.py@@ -2604,11 +2604,10 @@ def _startup_system_prompt(cfg: dict, task_id: str) -> str:from agent.skill_commands import build_preloaded_skills_prompt, format_missing_skillsskills_prompt, loaded_skills, missing_skills = build_preloaded_skills_prompt(startup_skills, task_id=task_id)if missing_skills:- missing_display = ", ".join(missing_skills)if not loaded_skills:raise ValueError(format_missing_skills(missing_skills))- logger.warning("Unknown skill(s) requested, skipping: %s. Continuing with: %s. "- "List available skills with `hermes skills list`.", missing_display, ", ".join(loaded_skills))+ logger.warning("Skipping %s. Continuing with: %s. List available skills with `hermes skills list`.",+ format_missing_skills(missing_skills), ", ".join(loaded_skills))if skills_prompt:system_prompt = "\n\n".join(part for part in (system_prompt, skills_prompt) if part).strip()return system_prompt