fix(cli): always write user config to ~/.hermes/config.yaml, never to repo cli-config.yaml (#14714)#15436
Open
Tranquil-Flow wants to merge 3 commits into
Conversation
Collaborator
16 tasks
… repo cli-config.yaml (NousResearch#14714) When ~/.hermes/config.yaml didn't exist yet (first run), save_config_value() fell back to writing into the repo's cli-config.yaml. The fallback logic should only apply to reads (load_cli_config already handles this). Writes now always target the user config path, creating ~/.hermes/ and config.yaml as needed.
b19e0e7 to
0ef33e7
Compare
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?
save_config_value()usesuser_config_path if user_config_path.exists() else project_config_pathto choose where to write. On first run, when~/.hermes/config.yamldoes not exist yet, this falls back to writing into the repo'scli-config.yaml. The comment at line 1751 says "Ensure parent directory exists (for ~/.hermes/config.yaml on first use)" but themkdirruns afterconfig_pathis already chosen as the project fallback.This PR makes
save_config_value()always targetuser_config_pathfor writes. The fallback to project config should only apply to reads (whichload_cli_config()already handles).Related Issue
Fixes #14714
Type of Change
Changes Made
cli.py: Changedsave_config_value()to always targetuser_config_pathfor writes. The existingmkdir(parents=True, exist_ok=True)handles creating~/.hermes/if needed, and the existing "Load existing config" block handles the case where the file does not yet exist.How to Test
Tests:
tests/cli/test_cli_save_config_value.py— 3 new tests inTestSaveConfigValueWriteTarget:~/.hermes/when it does not existcli-config.yamlis never modifiedTested on macOS (Python 3.11).
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/AScreenshots / Logs