fix(skills_config): handle null/scalar values in get_disabled_skills - #13078
zhanggttry wants to merge 2 commits into
Conversation
Fixes NousResearch#13026 - Add _normalize_string_set() helper to safely coerce scalar strings and None into proper string sets, mirroring agent.skill_utils - Guard skills_cfg against null and non-dict values - Guard platform_disabled against null values - Add comprehensive test suite for edge cases
Covers null skills config, scalar string disabled values, and other malformed-but-plausible YAML inputs.
|
Salvaged your fix onto current |
|
Closing — this fix landed on main via PR #61797. You were the earliest submitter of this fix (April 20, nearly three months before the others), and your implementation was essentially the shape that ended up merged: null → empty set, scalar → single skill name, mirroring |
Fix #13026 —
get_disabled_skillscrash on null/scalar valuesProblem
get_disabled_skills()inhermes_cli/skills_config.pycrashes or produces incorrect results when the YAML config contains unexpected but plausible values:skills: null→AttributeError: 'NoneType' object has no attribute 'get'skills.disabled: my-skill(scalar string) →set("my-skill")splits into individual characters:{'m', 'y', '-', 's', 'k', 'i', 'l', 'l'}skills.platform_disabled.telegram: my-skill→ same character-splitting bugThese edge cases arise from hand-edited YAML configs where a user might write:
or where
skills:is set tonullby another tool.Solution
_normalize_string_set()helper that safely coercesNone, scalar strings, and lists into properSet[str]. This mirrors the existing_normalize_string_set()inagent/skill_utils.py(L144-168) which already handles these cases for the runtime skill loader.skills_cfgagainstNoneand non-dict values (config.get("skills") or {})platform_disabledagainstNonevalues (skills_cfg.get("platform_disabled") or {})Changes
hermes_cli/skills_config.py_normalize_string_set(), hardenget_disabled_skills()tests/test_skills_config.pyTesting
All edge cases covered: null config, scalar strings, empty values, normal lists, platform fallbacks, and overrides.