fix(config): drop stale placeholder secrets from .env writes#6183
Open
Kolektori wants to merge 1 commit intoNousResearch:mainfrom
Open
fix(config): drop stale placeholder secrets from .env writes#6183Kolektori wants to merge 1 commit intoNousResearch:mainfrom
Kolektori wants to merge 1 commit intoNousResearch:mainfrom
Conversation
19 tasks
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
.envpersistence so stale placeholder secrets likeKEY=***do not survive later writes and override real values.Today
save_env_value()sanitizes the file before writing, but_sanitize_env_lines()only repairs concatenatedKEY=VALUElines. It does not remove placeholder-only secret entries or collapse duplicate keys. That leaves cases like:In that state,
load_env()still resolves the stale trailing value because it keeps the last matching entry.This change makes
_sanitize_env_lines()drop placeholder-only secret lines and keep a single canonical entry per key before writes are persisted.Related Issue
N/A
Type of Change
Changes Made
hermes_cli/config.pyso_sanitize_env_lines()removesKEY=***placeholder secret entriesKEY=entries during sanitization so stale trailing values cannot shadow the current valuetests/hermes_cli/test_config.pythat reproduces the bug throughsave_env_value()andload_env()How to Test
uv run pytest -q -n 0 tests/hermes_cli/test_config.pytest_save_env_value_removes_stale_placeholder_duplicatespassesChecklist
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
Focused verification: