fix(cli): invalidate update-check cache when installed version changes - #34501
Closed
Bartok9 wants to merge 1 commit into
Closed
fix(cli): invalidate update-check cache when installed version changes#34501Bartok9 wants to merge 1 commit into
Bartok9 wants to merge 1 commit into
Conversation
For pip/uv installs HERMES_REVISION is unset, so embedded_rev is always None. The cache validity check compared cached rev to embedded_rev (None == None), which never invalidated the cache. After an upgrade the old cache's behind count persisted for the full 6h TTL, so hermes --version kept showing a stale "N commits behind". Add VERSION to the cache payload and require it to match on read. A version change now forces a fresh check. Closes NousResearch#34491
Contributor
Author
|
Closing as superseded by #34846 ( Both PRs fix the same issue #34491 the same way. Main's |
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.
Summary
VERSIONto the update-check cache payload and require it to match on read.Motivation
Closes #34491.
For pip/uv installs,
HERMES_REVISIONis unset, soembedded_revis alwaysNoneincheck_for_updates(). The cache-validity check only compared the cachedrevtoembedded_rev(None == None), which never invalidated the cache. After upgrading (e.g.0.14.0 → 0.15.1), the old cache'sbehindcount stayed valid until the 6h TTL expired, sohermes --versionkept reporting a stale "1 commit behind" even though the user was up to date.The fix adds
"version": VERSIONto the cache payload and requirescached.get("version") == VERSIONon read, so a version change forces a fresh check. The nix path (embedded_revset) is unaffected — it now simply has an additional, always-satisfied guard.Verification
python3 -m pytest tests/hermes_cli/test_update_check.py— 10 passedtest_check_for_updates_invalidates_on_version_changereproduces the bug: it fails on currentmain(returns the stale1) and passes with this fix (returns a fresh0).test_check_for_updates_writes_version_to_cacheasserts the version is persisted so future upgrades invalidate correctly.test_check_for_updates_uses_cacheto write the currentVERSION(a same-version cache is still honored — no extra git calls).Reproduce (from the issue)
0.14.0, runhermes --version(writes cache withbehind: 1)uv pip install --upgrade hermes-agentto0.15.1