Skip to content

fix(skills): log warnings instead of silently swallowing exceptions in skill_commands.py#2868

Closed
sprmn24 wants to merge 1 commit into
NousResearch:mainfrom
sprmn24:fix/skill-commands-silent-exceptions
Closed

fix(skills): log warnings instead of silently swallowing exceptions in skill_commands.py#2868
sprmn24 wants to merge 1 commit into
NousResearch:mainfrom
sprmn24:fix/skill-commands-silent-exceptions

Conversation

@sprmn24

@sprmn24 sprmn24 commented Mar 24, 2026

Copy link
Copy Markdown
Contributor

What does this PR do?

Fixes five silent exception blocks in agent/skill_commands.py where bare except Exception: was discarding errors without any logging. Users had no way to diagnose why skills failed to load, scan, or resolve paths.

Type of Change

  • 🐛 Bug fix (non-breaking change that fixes an issue)

Changes Made

scan_skill_commands()

  • Inner loop (except Exception: continue): Now logs logger.debug() with the skill path and error before continuing — helps identify broken individual skill files without flooding logs.
  • Outer block (except Exception: pass): Now logs logger.warning() when the entire skill scanning system fails — critical for diagnosing import errors or missing SKILLS_DIR.

_load_skill_payload()

  • Path resolution (except Exception: normalized = raw_identifier): Now logs logger.debug() when path normalization fails.
  • Skill loading (except Exception: return None): Now logs logger.warning() when a skill fails to load — users can see which skill and why.
  • Directory resolution (except Exception: skill_dir = None): Now logs logger.debug() when skill directory path computation fails.

No new imports needed — logger = logging.getLogger(__name__) was already defined at the top of the file.

How to Test

  1. Introduce a syntax error in any ~/.hermes/skills/*/SKILL.md file
  2. Run hermes and invoke a skill slash command
  3. Check logs — you should now see warnings/debug messages identifying the failure
  4. Run tests: python3 -m pytest tests/ -q

Checklist

Code

  • I've read the Contributing Guide
  • My commit messages follow Conventional Commits
  • I searched for existing PRs to make sure this isn't a duplicate
  • My PR contains only changes related to this fix
  • I've tested on my platform: Ubuntu 22.04 (WSL2)

Documentation & Housekeeping

  • No documentation changes needed (logging-only change)
  • No config key changes
  • No architecture changes
  • Cross-platform safe (logging module is stdlib)

Screenshots / Logs

N/A — logging change, no UI impact.

@sprmn24 sprmn24 force-pushed the fix/skill-commands-silent-exceptions branch from f92f23d to 0d30b1a Compare March 24, 2026 22:29
…n skill_commands.py

All five bare 'except Exception' blocks in skill_commands.py were silently
discarding errors. This made debugging skill loading, path resolution, and
command scanning failures nearly impossible for users.

Changes:
- scan_skill_commands(): log warning on full scan failure, debug on per-skill skip
- _load_skill_payload(): log debug on path resolution, warning on skill load failure
- skill_dir resolution: log debug on directory path error

No new imports — logger was already defined at module level.
@sprmn24 sprmn24 force-pushed the fix/skill-commands-silent-exceptions branch from 0d30b1a to 5eb1fec Compare March 28, 2026 20:11
@sprmn24

sprmn24 commented Mar 28, 2026

Copy link
Copy Markdown
Contributor Author

The failing test test_text_suppressed_when_tool_calls_present is unrelated to this PR. The failure was introduced by #3566 which forwards suppressed content to stream_delta_callback for reasoning tag extraction. This affects all open PRs rebased onto current main.

@alt-glitch

Copy link
Copy Markdown
Collaborator

Related to #18659 (underlying bug with silent exceptions in scan_skill_commands). Also related to #18669, #18720 which fix the same silent-swallowing pattern.

1 similar comment
@alt-glitch

Copy link
Copy Markdown
Collaborator

Related to #18659 (underlying bug with silent exceptions in scan_skill_commands). Also related to #18669, #18720 which fix the same silent-swallowing pattern.

@sprmn24

sprmn24 commented May 3, 2026

Copy link
Copy Markdown
Contributor Author

Related to #18659 (underlying bug with silent exceptions in scan_skill_commands). Also related to #18669, #18720 which fix the same silent-swallowing pattern.

This PR focuses on the logging side of the issue. I'm aware of #18659 (the unconditional clear bug) and can extend this fix to include the atomic local-build-then-swap pattern if the maintainers prefer consolidating both fixes here. Happy to update.

@sprmn24

sprmn24 commented May 22, 2026

Copy link
Copy Markdown
Contributor Author

Closing — main has been significantly refactored since this PR was opened. The silent exception patterns this PR targeted have already been addressed differently in the current codebase.

@sprmn24 sprmn24 closed this May 22, 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.

2 participants