fix(skills): log warnings instead of silently swallowing exceptions in skill_commands.py#2868
fix(skills): log warnings instead of silently swallowing exceptions in skill_commands.py#2868sprmn24 wants to merge 1 commit into
Conversation
f92f23d to
0d30b1a
Compare
…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.
0d30b1a to
5eb1fec
Compare
|
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. |
1 similar comment
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. |
|
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. |
What does this PR do?
Fixes five silent exception blocks in
agent/skill_commands.pywhere bareexcept 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
Changes Made
scan_skill_commands()except Exception: continue): Now logslogger.debug()with the skill path and error before continuing — helps identify broken individual skill files without flooding logs.except Exception: pass): Now logslogger.warning()when the entire skill scanning system fails — critical for diagnosing import errors or missing SKILLS_DIR._load_skill_payload()except Exception: normalized = raw_identifier): Now logslogger.debug()when path normalization fails.except Exception: return None): Now logslogger.warning()when a skill fails to load — users can see which skill and why.except Exception: skill_dir = None): Now logslogger.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
~/.hermes/skills/*/SKILL.mdfilehermesand invoke a skill slash commandpython3 -m pytest tests/ -qChecklist
Code
Documentation & Housekeeping
Screenshots / Logs
N/A — logging change, no UI impact.