Skip to content

fix(skills): return None on skill load failure instead of truthy stub (salvage #27147)#27290

Merged
teknium1 merged 2 commits into
mainfrom
hermes/hermes-a449f95f
May 17, 2026
Merged

fix(skills): return None on skill load failure instead of truthy stub (salvage #27147)#27290
teknium1 merged 2 commits into
mainfrom
hermes/hermes-a449f95f

Conversation

@teknium1

Copy link
Copy Markdown
Contributor

Summary

Salvage of #27147build_skill_invocation_message() returned a truthy stub string [Failed to load skill: NAME] when _load_skill_payload() failed, which bypassed every caller's if msg: failure branch and injected the stub into the conversation as the user message.

Root cause

All three call sites (cli.py, gateway/run.py, gateway/platforms/webhook.py) check if msg: to detect failure. The truthy stub passes that check, so the agent receives [Failed to load skill: foo] as the user's message instead of either (a) the CLI's red error print or (b) the gateway path falling through to normal message processing.

Changes

  • agent/skill_commands.py — return None on load failure (matches the existing "skill not in cache" branch directly above).
  • tests/agent/test_skill_commands.py — regression test mocking _load_skill_payloadNone.

Validation

  • scripts/run_tests.sh tests/agent/test_skill_commands.py -q → 40/40 pass.

Original PR: #27147 — credit preserved via rebase-merge.

0xchainer added 2 commits May 16, 2026 22:50
build_skill_invocation_message() returns a non-empty placeholder string
('[Failed to load skill: ...]') when the skill exists in the command cache
but loading the actual SKILL.md payload fails. CLI/gateway callers treat
any truthy return value as success, so the failure is silently routed into
the model as if it were a valid skill prompt.

Return None instead, matching the existing behavior for unknown commands,
so callers using 'if msg:' can properly detect the failure.
Add test_returns_none_when_skill_load_fails to verify that
build_skill_invocation_message() returns None when a registered
skill exists in the command cache but _load_skill_payload() fails.
This guards against regression of the fix in 877d01b.
@github-actions

Copy link
Copy Markdown
Contributor

🔎 Lint report: hermes/hermes-a449f95f vs origin/main

ruff

Total: 0 on HEAD, 0 on base (➖ 0)

🆕 New issues: none

✅ Fixed issues: none

Unchanged: 0 pre-existing issues carried over.

ty (type checker)

Total: 8349 on HEAD, 8349 on base (➖ 0)

🆕 New issues: none

✅ Fixed issues: none

Unchanged: 4366 pre-existing issues carried over.

Diagnostics are surfaced as warnings — this check never fails the build.

@teknium1 teknium1 merged commit 782d743 into main May 17, 2026
17 of 18 checks passed
@teknium1 teknium1 deleted the hermes/hermes-a449f95f branch May 17, 2026 05:52
@alt-glitch alt-glitch added type/bug Something isn't working P2 Medium — degraded but workaround exists comp/agent Core agent loop, run_agent.py, prompt builder tool/skills Skills system (list, view, manage) labels May 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/agent Core agent loop, run_agent.py, prompt builder P2 Medium — degraded but workaround exists tool/skills Skills system (list, view, manage) type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants