fix(config): preserve raw user config across updates#3596
Open
paraddox wants to merge 1 commit intoNousResearch:mainfrom
Open
fix(config): preserve raw user config across updates#3596paraddox wants to merge 1 commit intoNousResearch:mainfrom
paraddox wants to merge 1 commit intoNousResearch:mainfrom
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 does this PR do?
Fixes config persistence so Hermes stops silently rewriting user-authored
~/.hermes/config.yamlwhen setup or other config-changing flows run.Before this change, several commands loaded the effective runtime config, which already had defaults merged in and environment variables expanded, then saved that object back to disk. That could:
compression.threshold${GLM_API_KEY}with resolved secret valuesThis PR fixes that by separating the two config views clearly:
config.yamlnow patches and saves the raw user config insteadThat keeps the file minimal, preserves existing user overrides, and avoids writing expanded secrets back into
config.yaml.Related Issue
Fixes #3522
Type of Change
Changes Made
hermes_cli/config.pyand centralized config writing through a shared writer.hermes_cli/setup.pyandhermes_cli/claw.pyso they preserve existing user config instead of regenerating the whole file.hermes_cli/main.py,hermes_cli/auth.py,hermes_cli/mcp_config.py,hermes_cli/skills_config.py,hermes_cli/tools_config.py, andcli.pyto use the raw-preserving writer.tools/approval.pyto preserve raw placeholders and unrelated user config.gateway/run.pyandgateway/platforms/telegram.pyto use the same shared config writer.tests/hermes_cli/test_config.pytests/hermes_cli/test_setup.pytests/hermes_cli/test_setup_openclaw_migration.pytests/hermes_cli/test_claw.pytests/hermes_cli/test_tools_config.pytests/hermes_cli/test_mcp_config.pytests/hermes_cli/test_skills_config.pytests/test_model_provider_persistence.pytests/tools/test_approval.pytests/gateway/test_reasoning_command.pytests/gateway/test_verbose_command.pytests/gateway/test_dm_topics.pytests/gateway/test_config_persistence.pyHow to Test
Create a minimal
~/.hermes/config.yamlwith a custom override like:Run config-changing flows such as hermes setup, hermes model, hermes tools, hermes mcp, hermes skills, or the gateway config commands, then confirm:
Run:
source .venv/bin/activate
python -m pytest tests/hermes_cli/test_config.py tests/hermes_cli/test_setup.py tests/hermes_cli/test_tools_config.py tests/hermes_cli/test_mcp_config.py tests/hermes_cli/test_skills_config.py tests/test_model_provider_persistence.py tests/
tools/test_approval.py tests/gateway/test_reasoning_command.py tests/gateway/test_verbose_command.py tests/gateway/test_dm_topics.py tests/gateway/test_config_persistence.py -q
Expected result:
Checklist
Code
Documentation & Housekeeping
Screenshots / Logs
Focused verification:
$ source .venv/bin/activate
$ python -m pytest tests/hermes_cli/test_config.py tests/hermes_cli/test_setup.py tests/hermes_cli/test_tools_config.py tests/hermes_cli/test_mcp_config.py tests/hermes_cli/test_skills_config.py tests/test_model_provider_persistence.py tests/
tools/test_approval.py tests/gateway/test_reasoning_command.py tests/gateway/test_verbose_command.py tests/gateway/test_dm_topics.py tests/gateway/test_config_persistence.py -q
243 passed, 24 warnings in 8.14s
Full suite note: