fix(cli): persist JSON object/array values as structured YAML in config set - #40845
Closed
liuhao1024 wants to merge 1 commit into
Closed
fix(cli): persist JSON object/array values as structured YAML in config set#40845liuhao1024 wants to merge 1 commit into
liuhao1024 wants to merge 1 commit into
Conversation
…ig set
When a user passes a JSON object or array string to `hermes config set`
(e.g. `hermes config set providers.deepseek '{"base_url": "..."}'`),
the value was persisted as a quoted YAML string instead of a structured
mapping/list. This forced users to manually edit config.yaml for any
structured config value.
After the existing scalar coercion (bool/int/float), attempt json.loads()
on values that start with '{' or '['. If parsing succeeds and yields a
dict or list, use the parsed structure; otherwise keep the original string.
Fixes NousResearch#40545
Collaborator
Contributor
Author
|
Thanks for the flag @alt-glitch. Confirmed — #40546 by @izumi0uu covers the same issue with a more complete fix (+70/-9 including dedicated test file), while this PR is a minimal +9 approach without tests. Closing in favor of #40546. |
This was referenced Aug 3, 2026
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?
Fixes
hermes config setto persist JSON object and array values as structured YAML mappings/lists instead of quoted strings.Before:
After:
Related Issue
Fixes #40545
Type of Change
Changes Made
hermes_cli/config.py: After existing scalar coercion (bool/int/float), attemptjson.loads()on values starting with{or[. If parsing yields adictorlist, use the parsed structure; otherwise keep the original string.Testing
Verified with 5 test cases:
All 26 existing
config_settests pass (no regressions).