fix(config): distinguish disabled-plugin toolsets from typos in validation - #601
Open
hashbender wants to merge 1 commit into
Open
fix(config): distinguish disabled-plugin toolsets from typos in validation#601hashbender wants to merge 1 commit into
hashbender wants to merge 1 commit into
Conversation
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.
What changed
validate_platform_toolsets()(hermes_cli/toolset_validation.py, added for NousResearch#38798) now accepts an optional third argument,known_plugin_toolsets, and cross-references it against unknown toolset names to produce a more accurate warning when the real cause is a disabled/uninstalled plugin rather than a typo.Why
Hermes tracks toolset names across three separate places:
plugins.enabled— which plugins are turned onknown_plugin_toolsets— per-platform snapshot of plugin toolset keys seen the last timehermes toolssaved that platform (hermes_cli/tools_config.py::_save_platform_tools)platform_toolsets— the actual per-platform toolset selectionvalidate_platform_toolsetsalready does excellent work catching corrupted/renamed entries (the NousResearch#38798 incident:hermes-clisilently rewritten to the nonexistenthermes), including ahermes-<platform>"did you mean" guess. But that guess is actively misleading for a very common real-world case: aplatform_toolsetsentry that names a real plugin toolset whose plugin is now disabled (or its package uninstalled). Sinceis_valid_toolset(backed by the live toolset registry) only knows about currently-loaded plugins, a disabled plugin's toolset name looks identical to a typo to the existing check — same generic "unknown toolset ''" warning, with nohermes-<platform>hint either (since that guess doesn't happen to match), leaving the real cause unstated.known_plugin_toolsetsalready has exactly the information needed to tell these apart: if a name is inknown_plugin_toolsets[platform], it was a real, valid plugin toolset the last timehermes toolsran for that platform — so its current invalidity almost certainly means the plugin got disabled or uninstalled, not that the name was ever wrong.Approach
known_plugin_toolsetsparam, defaultNone(or any non-dict) → identical behavior to before this change, so existing callers/tests aren't broken.is_valid_toolsetAND is found inknown_plugin_toolsets[platform], emit a distinct, more actionable warning pointing atplugins.enabledand plugin installation, instead of the generic unknown-toolset message with its (here, irrelevant)hermes-<platform>guess.hermes_cli/config.py(read_raw_config().get("known_plugin_toolsets")), reusing the same try/except-wrapped, best-effort validation pass that already runs after every config migration.Test plan
tests/hermes_cli/test_toolset_validation.pywith:known_plugin_toolsets(None,[], a string,{}with a non-list value) all falling back to the pre-existing generic behaviorscripts/run_tests.sh tests/hermes_cli/test_toolset_validation.py tests/hermes_cli/test_config.py— 153 tests, all passing, no regressions in the config-migration suite that exercises this call site.Mirror-of: NousResearch#56731
NousResearch#56731