Skip to content

fix(plugins): validate accepts the legacy hooks: manifest key the loader reads - #141340

Open
simin-yuan wants to merge 1 commit into
NousResearch:mainfrom
simin-yuan:fix/validate-legacy-hooks-key
Open

simin-yuan wants to merge 1 commit into
NousResearch:mainfrom
simin-yuan:fix/validate-legacy-hooks-key

Conversation

@simin-yuan

@simin-yuan simin-yuan commented Oct 19, 2026 •

Copy link
Copy Markdown

What does this PR do?

The loader reads declared hooks from provides_hooks and falls back to the legacy hooks: key (#108371). hermes plugins validate read only provides_hooks, so an external plugin using hooks: loaded fine but failed validation with "undeclared hooks registered (not in provides_hooks)".

This PR moves the resolution rule into hermes_cli.plugins_manifest.hooks_manifest_key(), and both the loader and the validator use it. Loader behaviour is unchanged. When only the legacy key is present, validation passes and adds a warning recommending provides_hooks. The provides_tools and provides_middleware checks and the bundled manifests are untouched. The second commit maps my contributor email, which the contributor check requires.

Related Issue

Fixes #141339

Type of Change

  • 🐛 Bug fix (non-breaking change that fixes an issue)
  • ✨ New feature (non-breaking change that adds functionality)
  • 🔒 Security fix
  • 📝 Documentation update
  • ✅ Tests (adding or improving test coverage)
  • ♻️ Refactor (no behavior change)
  • 🎯 New skill (bundled or hub)

Changes Made

  • hermes_cli/plugins_manifest.py — new hooks_manifest_key(data): provides_hooks, else the legacy hooks: list, else the default.
  • hermes_cli/plugin_validate.py — the "declared hooks" check resolves the key through that helper instead of reading provides_hooks directly; a legacy-only manifest passes and gets a warning.
  • tests/hermes_cli/test_plugin_validate.py — test_legacy_hooks_key_declares_hooks_like_the_loader covers the loader-equal path.
  • contributors/emails/[email protected] — contributor email mapping.

The loader path in hermes_cli/plugins_manifest.py now calls the same helper, so the two sides cannot drift again.

How to Test

  • scripts/run_tests.sh tests/hermes_cli/test_plugin_validate.py: the new test test_legacy_hooks_key_declares_hooks_like_the_loader fails on main and passes with this change.
  • Manually: run hermes plugins validate on a plugin whose plugin.yaml lists its hooks under hooks:. The "declared hooks" check passes and a warning recommends provides_hooks.
  • python scripts/check passes.

Platforms tested: Linux and Windows.

Note on the test file: tests/hermes_cli/test_plugin_validate.py also contains test_portable_validation_fails_orphan_and_reports_availability, which fails identically on unmodified main in my local environment (a missing optional dependency); it is unrelated to this change and was failing before it.

Checklist

Code

  • I've read the Contributing Guide
  • My commit messages follow Conventional Commits (fix(plugins):, chore:)
  • 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 — run for the touched file instead: 27 passed, plus the one pre-existing failure described above that also fails on main. I am not claiming a green full suite from this machine.
  • python scripts/check passes (the blocking lint and code-health checks CI runs) — python scripts/check --commit HEAD --base upstream/main: 12 checks, ok
  • I've added tests for my changes (required for bug fixes, strongly encouraged for features)
  • I've tested on my platform: Windows 11

Documentation & Housekeeping

  • I've updated relevant documentation (README, docs/, docstrings) — or N/A (the warning message itself tells the author to use provides_hooks)
  • 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 or workflows — or N/A
  • I've considered cross-platform impact (Windows, macOS) per the compatibility guide — or N/A (no platform-specific code)
  • I've updated tool descriptions/schemas if I changed tool behavior — or N/A

Screenshots / Logs

$ pytest tests/hermes_cli/test_plugin_validate.py -q
27 passed, 1 failed        # the failure is test_portable_validation_fails_orphan_and_reports_availability,
                            # which fails the same way on unmodified main here

$ python scripts/check --commit HEAD --base upstream/main
scripts/check: 12 checks, ok

@alt-glitch alt-glitch added comp/cli CLI entry point, hermes_cli/, setup wizard comp/plugins Plugin system and bundled plugins P2 Medium — degraded but workaround exists type/bug Something isn't working labels Oct 19, 2026
@simin-yuan
simin-yuan force-pushed the fix/validate-legacy-hooks-key branch from ce2172b to c5e6064 Compare October 19, 2026 08:43
…der reads

The loader resolves declared hooks from provides_hooks and falls back to
the legacy hooks: key (NousResearch#108371), but `hermes plugins validate` only read
provides_hooks. An external plugin declaring its hooks under hooks:
loaded fine yet failed admission with "undeclared hooks registered (not
in provides_hooks)".

Move the resolution into plugins_manifest.hooks_manifest_key() and use it
in both the loader and the validator. When only the legacy key is
present, validate passes with a warning recommending provides_hooks.
@simin-yuan
simin-yuan force-pushed the fix/validate-legacy-hooks-key branch from c5e6064 to 341b152 Compare October 21, 2026 05:11
@simin-yuan
simin-yuan force-pushed the fix/validate-legacy-hooks-key branch from 341b152 to 6f2f786 Compare November 6, 2026 21:17

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/cli CLI entry point, hermes_cli/, setup wizard comp/plugins Plugin system and bundled plugins P2 Medium — degraded but workaround exists type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

hermes plugins validate rejects the legacy hooks: manifest key that the loader accepts

2 participants