hermes - ✅(Solved) Fix [Bug]: get_disabled_skills crashes on `skills: null` and splits scalar names into characters [2 pull requests]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…

Error Message

source venv/bin/activate && python - <<'PY' from hermes_cli.skills_config import get_disabled_skills print(sorted(get_disabled_skills({'skills': {'disabled': 'my-skill'}}))) try: print(get_disabled_skills({'skills': None})) except Exception as e: print(type(e).name, str(e)) PY

Fix Action

Fixed

PR fix notes

PR #13047: fix(cli): normalize disabled skills config parsing

Description (problem / solution / changelog)

Summary

  • 修复 get_disabled_skills() 对异常配置结构的健壮性:skills: null 不再崩溃。
  • 修复 skills.disabled 为字符串时被拆成字符集合的问题,统一按单个技能名处理。
  • 增加回归测试覆盖上述两种场景,避免后续回归。

Test plan

  • python -m pytest tests/hermes_cli/test_skills_config.py -q -n 4

Closes #13026

Changed files

  • hermes_cli/skills_config.py (modified, +16/-4)
  • tests/hermes_cli/test_skills_config.py (modified, +9/-0)

PR #13078: fix(skills_config): handle null/scalar values in get_disabled_skills

Description (problem / solution / changelog)

Fix #13026 — get_disabled_skills crash on null/scalar values

Problem

get_disabled_skills() in hermes_cli/skills_config.py crashes or produces incorrect results when the YAML config contains unexpected but plausible values:

  1. skills: nullAttributeError: 'NoneType' object has no attribute 'get'
  2. skills.disabled: my-skill (scalar string) → set("my-skill") splits into individual characters: {'m', 'y', '-', 's', 'k', 'i', 'l', 'l'}
  3. skills.platform_disabled.telegram: my-skill → same character-splitting bug

These edge cases arise from hand-edited YAML configs where a user might write:

skills:
  disabled: my-skill     # scalar instead of list

or where skills: is set to null by another tool.

Solution

  • Add _normalize_string_set() helper that safely coerces None, scalar strings, and lists into proper Set[str]. This mirrors the existing _normalize_string_set() in agent/skill_utils.py (L144-168) which already handles these cases for the runtime skill loader.
  • Guard skills_cfg against None and non-dict values (config.get("skills") or {})
  • Guard platform_disabled against None values (skills_cfg.get("platform_disabled") or {})

Changes

FileChange
hermes_cli/skills_config.pyAdd _normalize_string_set(), harden get_disabled_skills()
tests/test_skills_config.pyNew: 18 test cases covering all edge cases

Testing

19 passed, 0 failed ✅

All edge cases covered: null config, scalar strings, empty values, normal lists, platform fallbacks, and overrides.

Changed files

  • hermes_cli/skills_config.py (modified, +29/-4)
  • tests/test_skills_config.py (added, +139/-0)

Code Example

source venv/bin/activate && python - <<'PY'
from hermes_cli.skills_config import get_disabled_skills
print(sorted(get_disabled_skills({'skills': {'disabled': 'my-skill'}})))
try:
    print(get_disabled_skills({'skills': None}))
except Exception as e:
    print(type(e).__name__, str(e))
PY

---

['-', 'i', 'k', 'l', 'm', 's', 'y']
AttributeError: 'NoneType' object has no attribute 'get'
RAW_BUFFERClick to expand / collapse

Bug Description

hermes_cli.skills_config.get_disabled_skills() mishandles malformed-but-plausible config values:

  • skills.disabled: my-skill becomes a set of characters instead of {'my-skill'}
  • skills: null crashes with AttributeError

Affected code:

  • hermes_cli/skills_config.py:27-36
  • safe normalization already exists in agent/skill_utils.py:144-168

Minimal Reproduction

source venv/bin/activate && python - <<'PY'
from hermes_cli.skills_config import get_disabled_skills
print(sorted(get_disabled_skills({'skills': {'disabled': 'my-skill'}})))
try:
    print(get_disabled_skills({'skills': None}))
except Exception as e:
    print(type(e).__name__, str(e))
PY

Observed:

['-', 'i', 'k', 'l', 'm', 's', 'y']
AttributeError: 'NoneType' object has no attribute 'get'

Expected Behavior

CLI config helpers should tolerate scalar / null YAML shapes the same way runtime skill loading already does.

Actual Behavior

The helper either corrupts the disabled-skill set or crashes.

Suggested Investigation Direction

Reuse the same normalization strategy as agent.skill_utils._normalize_string_set() and guard skills with isinstance(skills_cfg, dict) before .get(...).

extent analysis

TL;DR

The hermes_cli.skills_config.get_disabled_skills() function can be fixed by reusing the normalization strategy from agent.skill_utils._normalize_string_set() and adding a type check for the skills configuration.

Guidance

  • Reuse the agent.skill_utils._normalize_string_set() function to handle malformed config values and ensure consistent normalization of disabled skills.
  • Add a type check isinstance(skills_cfg, dict) before attempting to access the disabled key to prevent the AttributeError when skills is None.
  • Verify the fix by running the provided Minimal Reproduction script and checking that it produces the expected output.
  • Consider adding additional tests to cover different edge cases and ensure the function behaves as expected.

Example

from agent.skill_utils import _normalize_string_set

def get_disabled_skills(config):
    skills_cfg = config.get('skills')
    if not isinstance(skills_cfg, dict):
        return set()
    disabled_skills = skills_cfg.get('disabled')
    return _normalize_string_set(disabled_skills)

Notes

The provided fix assumes that the agent.skill_utils._normalize_string_set() function is correctly implemented and handles different input types as expected. Additional testing and verification may be necessary to ensure the fix works correctly in all scenarios.

Recommendation

Apply the suggested workaround by reusing the agent.skill_utils._normalize_string_set() function and adding a type check for the skills configuration, as this approach is consistent with the existing normalization strategy and should provide a robust fix for the issue.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

hermes - ✅(Solved) Fix [Bug]: get_disabled_skills crashes on `skills: null` and splits scalar names into characters [2 pull requests]