Skip to content

fix(skills): validate frontmatter name matches directory name at write time - #21806

Open
liuhao1024 wants to merge 3 commits into
NousResearch:mainfrom
liuhao1024:fix/issue-21782-skill-frontmatter-name-validation
Open

fix(skills): validate frontmatter name matches directory name at write time#21806
liuhao1024 wants to merge 3 commits into
NousResearch:mainfrom
liuhao1024:fix/issue-21782-skill-frontmatter-name-validation

Conversation

@liuhao1024

@liuhao1024 liuhao1024 commented May 8, 2026

Copy link
Copy Markdown
Contributor

What does this PR do?

_create_skill() and _edit_skill() silently accept content whose frontmatter name differs from the name parameter (the directory name). This creates skills whose skills_list display name diverges from the directory name used by skill_view(), making them permanently undiscoverable.

Root Cause

Neither _create_skill() nor _edit_skill() validates that the YAML frontmatter name field matches the name parameter. The write path accepts any valid frontmatter, creating a directory named after the name parameter while storing a different name in the SKILL.md frontmatter.

  • skills_list() → returns frontmatter name (e.g., local-paper-summary)
  • skill_view("local-paper-summary") → resolves by directory name → not found

Related Issue

N/A

Type of Change

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

Changes Made

  • See commit messages for detailed changes

How to Test

  1. Run pytest tests/ -q — all tests should pass
  2. Verify the specific scenario described above is resolved

Checklist

Code

  • I've read the Contributing Guide
  • My commit messages follow Conventional Commits (fix(scope):, feat(scope):, etc.)
  • I searched for existing PRs to make sure this isn't a duplicate
  • My PR contains only changes related to this fix/feature (no unrelated commits)
  • I've run pytest tests/ -q and all tests pass
  • I've added tests for my changes (required for bug fixes, strongly encouraged for features)
  • I've tested on my platform: macOS 26.4.1

Documentation & Housekeeping

  • I've updated relevant documentation (README, docs/, docstrings) — or N/A
  • I've updated cli-config.yaml.example if I added/changed config keys — or N/A
  • I've updated CONTRIBUTING.md or AGENTS.md if I changed architecture and workflows — or N/A
  • I've considered cross-platform impact (Windows, macOS) per the compatibility guide — or N/A

liuhao1024 and others added 3 commits April 24, 2026 22:14
…INSTALL_TIMEOUT

Increase the default npm install timeout for WhatsApp bridge from 60s
to 300s (5 minutes) to accommodate slower systems like Unraid NAS.
Make it configurable via WHATSAPP_NPM_INSTALL_TIMEOUT environment variable
for users who need even longer timeouts.

Closes NousResearch#14980
- Add 'path', 'old_string', 'new_string', and 'patch' to required list
- Update description to clarify mode-specific parameter requirements
- This addresses issue where LLMs would omit these parameters because
  they were not marked as required in the schema, even though they
  are required depending on the mode

Fixes NousResearch#15524
…e time

Prevent skills whose skills_list display name diverges from the
directory name used by skill_view — a silent data-corruption bug
that makes skills undiscoverable.

Both _create_skill() and _edit_skill() now parse the YAML frontmatter
and reject content whose 'name' field does not match the directory
name parameter. This is a write-path complement to the read-path
fallback added in PR NousResearch#18901.

Fixes NousResearch#21782
@alt-glitch alt-glitch added type/bug Something isn't working P2 Medium — degraded but workaround exists tool/skills Skills system (list, view, manage) labels May 8, 2026
@teknium1

Copy link
Copy Markdown
Contributor

Thanks for identifying the write-time namespace invariant; it is still absent on current main. The original discoverability symptom is mitigated by the later frontmatter-name lookup in tools/skills_tool.py:1155-1170, but enforcing a single write-time identity remains useful.

Problems

  • The skill change covers create/edit only. _patch_skill() still accepts a changed name: after calling _validate_frontmatter(new_content) at tools/skill_manager_tool.py:997-1004, so it can recreate the divergent state.
  • The bundled PATCH_SCHEMA change is incompatible with its mode-specific handler: mode="patch" consumes only patch at tools/file_tools.py:1841-1844, while current tests deliberately keep JSON-schema required to ['mode'] at tests/tools/test_file_tools.py:594-613.
  • The WhatsApp environment-variable commit is unrelated to this skill fix and conflicts with the config.yaml convention in AGENTS.md:102-106.

Suggested changes

  • Salvage the skill-only change against the current _validate_frontmatter() implementation and apply it to create, edit, and SKILL.md patch writes.
  • Add the missing patch regression and retain the existing content on rejection.
  • Split out the unrelated commits.

This is an automated hermes-sweeper review.

@teknium1 teknium1 added sweeper:risk-compatibility Sweeper risk: may break existing users, config, migrations, defaults, or upgrades sweeper:blast-massive Sweeper blast radius: massive — everyone, every turn (invariant surface) labels Jul 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

P2 Medium — degraded but workaround exists sweeper:blast-massive Sweeper blast radius: massive — everyone, every turn (invariant surface) sweeper:risk-compatibility Sweeper risk: may break existing users, config, migrations, defaults, or upgrades 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