fix(plugins): warn on missing required env vars and zero-registration (salvage #2768) - #58692
Open
Bartok9 wants to merge 2 commits into
Open
fix(plugins): warn on missing required env vars and zero-registration (salvage #2768)#58692Bartok9 wants to merge 2 commits into
Bartok9 wants to merge 2 commits into
Conversation
teknium1
reviewed
Jul 15, 2026
teknium1
left a comment
Contributor
There was a problem hiding this comment.
Thanks for preserving the generic plugin-loader diagnostic work and updating the manifest parsing/tests.
Problems
- The stated Hindsight path is not reached:
hermes_cli/plugins.py:1605-1614classifies memory providers as exclusive, and:1397-1410skips them instead of calling_load_plugin(), where this PR adds both warnings. Hindsight also declaresrequires_env: []inplugins/memory/hindsight/plugin.yaml:6. - The new predicate at
hermes_cli/plugins.py:1822-1829ignores successful CLI-command registration.register_cli_command()stores entries in_cli_commands(:521-528), while the following DEBUG summary itself counts those commands (:1843-1846). A CLI-only plugin therefore gets a false zero-registration WARNING. - Successful
register_secret_source()calls are also not represented in_extra_registrations(hermes_cli/plugins.py:802-845), creating the same false warning for secret-source-only plugins.
Suggested changes
- Include CLI commands and secret sources in registration accounting, with regression tests for each.
- Move any Hindsight-specific diagnostic to memory-provider discovery, or narrow the PR’s motivation to general plugins. Current gateway startup already loads the Hermes dotenv (
gateway/run.py:1334-1339), and the linked systemd root cause was addressed by closed #18606.
Automated hermes-sweeper review.
| and not loaded.hooks_registered | ||
| and not loaded.middleware_registered | ||
| and not loaded.commands_registered | ||
| and not ctx._extra_registrations |
Contributor
There was a problem hiding this comment.
register_cli_command() writes a valid registration to _cli_commands, but this predicate does not inspect that collection; a CLI-only plugin will receive this zero-registration WARNING. Count CLI commands here and add a CLI-only regression test.
Bartok9
force-pushed
the
salvage-2768-plugin-env-warn
branch
from
July 15, 2026 18:49
d50f5ad to
86e62c9
Compare
Contributor
Author
|
Thanks for the review — addressed in the force-push:
|
… (salvage NousResearch#2768) Rebuilt on latest main (Bartok9 hygiene 2026-08-01). Original: NousResearch#58692
Contributor
Author
|
Rebuilt onto latest — Bartok9 public PR hygiene 2026-08-01 |
Bartok9
force-pushed
the
salvage-2768-plugin-env-warn
branch
from
August 1, 2026 17:37
86e62c9 to
ecce4b3
Compare
…tok9 Per-PR attribution so check-attribution passes on this branch (Teknium).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
requires_envbut those vars are absent — or when itsregister()completes without adding any tools/hooks/middleware/commands/CLI commands/other surfaces — the loader now emits aWARNING.Motivation
Closes #2765.
Some plugins return early from
register()when a required environment variable is unset (or otherwise complete without registering anything), emitting no log of their own. The user sees a plugin that "loaded" but registered zero surfaces, with no clue why. Two warnings cover both angles: declared-but-missing env vars, and completed-but-empty registration.This is a generic plugin-loader diagnostic, not a Hindsight/memory-provider-specific path. Memory providers are exclusive and skipped by
_load_plugin(); Hindsight currently declaresrequires_env: []. A Hindsight-specific diagnostic would belong in memory-provider discovery if still desired.Salvage of #2768 by @ygd58
Re-applied to current
main. Changes from the original:requires_envshapes — bare strings and dicts with anamekey — because current main allows the rich dict form ({name, description, url, secret}). The original only handled strings._extra_registrationssurfaces: providers, context engines, platforms, skills, etc.) and exempts deferred platform loaders, which legitimately register nothing at load time.main; tests updated to the currenttests/hermes_cli/test_plugins.pyharness (_make_plugin_dir,PluginManager.discover_and_load).Review follow-ups (#58692 hermes-sweeper / @teknium1)
Addressed:
register_cli_command()now counts toward registration; predicate also inspects_cli_commands. Regression:test_cli_only_plugin_no_zero_warning.register_secret_source()bumps_extra_registrations. Regression:test_secret_source_only_plugin_no_zero_warning._load_plugin(); gateway already loads Hermes dotenv; fix(gateway): load $HERMES_HOME/.env from systemd unit so plugins see env vars #18606 closed).Verification
test_missing_requires_env_logs_warning— string-formrequires_envtest_requires_env_dict_form_logs_warning— dict-formrequires_envtest_zero_registration_logs_warning— emptyregister()test_present_requires_env_no_warning/test_registering_plugin_no_zero_warning— negative controlstest_extra_registration_no_zero_warning— skill/provider-style surfacetest_cli_only_plugin_no_zero_warning— CLI command surfacetest_secret_source_only_plugin_no_zero_warning— secret source surface