fix(cli): remove keep=1 from pre-update snapshot to preserve prior snapshots - #58678
Open
liuhao1024 wants to merge 1 commit into
Open
liuhao1024 wants to merge 1 commit into
liuhao1024 wants to merge 1 commit into
Conversation
…apshots The pre-update safety snapshot in hermes_cli/main.py passed keep=1 to create_quick_snapshot(), which caused _prune_quick_snapshots() to delete ALL previously retained quick snapshots on every hermes update. The default keep=20 (defined in _QUICK_DEFAULT_KEEP) is the correct limit for all callers. Add a regression test verifying that a pre-update snapshot coexists with prior snapshots instead of pruning them. Fixes NousResearch#58672
Collaborator
|
Thanks for identifying the destructive pruning behavior. The defect remains on current main: Problems
Suggested changes
Automated hermes-sweeper review. |
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?
Remove the explicit
keep=1argument from the pre-update safety snapshot call inhermes_cli/main.py. This one-liner was causinghermes updateto delete ALL previously retained quick snapshots (state.db, config.yaml, pairing JSONs, etc.) on every update, defeating the purpose of the snapshot retention policy.The default
keep=20(via_QUICK_DEFAULT_KEEP) is the correct limit for all callers — the comment on line 882-884 ofbackup.pydocuments that callers with "known high-churn safety snapshots" can pass a smaller value, butkeep=1was an over-aggressive choice that wiped the entire snapshot history.Related Issue
Fixes #58672
Type of Change
Changes Made
hermes_cli/main.py:9710— Removekeep=1fromcreate_quick_snapshot(label="pre-update")so it uses the default_QUICK_DEFAULT_KEEP = 20.tests/hermes_cli/test_backup.py— Addtest_pre_update_snapshot_preserves_prior_snapshotsregression test verifying that a pre-update snapshot coexists with 5 prior snapshots instead of pruning them.How to Test
hermes snapshot create --label test-{1..5}hermes update(which triggers a pre-update snapshot)hermes snapshot list— should show 6 snapshots (5 manual + 1 pre-update), not just 1pytest tests/hermes_cli/test_backup.py::TestQuickSnapshot -xvs— all 20 tests should passChecklist
Code
fix(scope):,feat(scope):, etc.)pytest tests/hermes_cli/test_backup.py -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/A