fix(cli): resolve config set provider/base_url shortcuts to canonical dotted paths - #41956
Open
liuhao1024 wants to merge 1 commit into
Open
fix(cli): resolve config set provider/base_url shortcuts to canonical dotted paths#41956liuhao1024 wants to merge 1 commit into
liuhao1024 wants to merge 1 commit into
Conversation
… dotted paths `hermes config set provider X` wrote to a dead top-level `provider:` key instead of the runtime key `model.provider`, creating a false sense of configuration success. The same issue affected `base_url`. Add a _KEY_SHORTCUTS mapping that resolves these shortcut keys to their canonical dotted paths before calling _set_nested, so the value lands in the key the runtime actually reads. Fixes NousResearch#41943
13 tasks
teknium1
reviewed
Jul 14, 2026
teknium1
left a comment
Contributor
There was a problem hiding this comment.
Thanks for isolating the bare-key configuration path. The issue remains reproducible on current main: set_config_value() still writes the caller-supplied bare key at hermes_cli/config.py:8167, while root-key normalization only promotes it when the canonical model.* key is empty (hermes_cli/config.py:6552-6554).
Problems
- The shortcut is resolved after the managed-scope guard. Current main rejects managed keys at
hermes_cli/config.py:8112, but the PR resolvesprovidertomodel.providerathermes_cli/config.py:6040. Thus a managedmodel.providercan be reached through the bare shortcut and written despite the guard. tests/cli/test_config_set_shortcut.pycovers only unmanaged writes; add managed-scope coverage for both aliases.
Suggested changes
- Resolve the shortcut before the managed-key check, then use the resolved dotted key for the guard and all later operations.
- Add tests proving
providerandbase_urlshortcuts cannot persist values when their canonical keys are managed.
This is an automated hermes-sweeper review.
| "provider": "model.provider", | ||
| "base_url": "model.base_url", | ||
| } | ||
| resolved_key = _KEY_SHORTCUTS.get(key, key) |
Contributor
There was a problem hiding this comment.
Resolve this alias before the earlier managed_scope.is_key_managed(key) guard. As written, a managed model.provider or model.base_url can be modified through the bare shortcut because the guard only sees provider or base_url.
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 does this PR do?
Resolves shortcut keys
providerandbase_urlinhermes config setto their canonical dotted paths (model.provider,model.base_url) so the value lands in the key the runtime actually reads instead of a dead top-level key.Related Issue
Fixes #41943
Type of Change
Changes Made
hermes_cli/config.py: Added_KEY_SHORTCUTSmapping that resolvesprovider→model.providerandbase_url→model.base_urlbefore calling_set_nested. Updated the_config_to_env_synclookup and the success message to use the resolved key.tests/cli/test_config_set_shortcut.py: 5 regression tests covering shortcut resolution, dotted-key passthrough, non-shortcut keys, and preservation of sibling model keys.How to Test
hermes config set provider opencode-goand verify it writes tomodel.providerinconfig.yaml(not a top-levelprovider:key)hermes config showand confirm the provider reflects the new valuepytest tests/cli/test_config_set_shortcut.py -v— all 5 tests passhermes config set model.provider anthropicstill works (explicit dotted path unaffected)Checklist
Code
fix(scope):,feat(scope):, etc.)pytest tests/ -qand all tests passDocumentation & Housekeeping
docs/, docstrings) — or N/Acli-config.yaml.exampleif I added/changed config keys — or N/ACONTRIBUTING.mdorAGENTS.mdif I changed architecture or workflows — or N/ACode Intelligence
hermes_cli/config.py::set_config_value()(callers: CLIconfig setcommand, setup wizard)hermes config setfor the two shortcut keys; all dotted-path usage unchanged_config_to_env_syncalready maps dotted config keys to env vars; this adds a parallel shortcut resolution layer