fix(banner): include local HEAD in update-check cache key - #40157
Closed
Kyzcreig wants to merge 1 commit into
Closed
fix(banner): include local HEAD in update-check cache key#40157Kyzcreig wants to merge 1 commit into
Kyzcreig wants to merge 1 commit into
Conversation
Kyzcreig
force-pushed
the
pr/update-cache-head-key
branch
from
July 12, 2026 09:28
bd54a39 to
058936b
Compare
An in-place `git pull`/rebase moves HEAD without changing VERSION or
HERMES_REVISION (both None for source installs tracking a fork). The
update-check cache key was {rev, ver} only, so a stale 'commits behind'
count survived the full 6h TTL after a manual update — e.g. `hermes
--version` kept printing '182 commits behind' immediately after a
successful rebase to up-to-date.
Add the active checkout's HEAD SHA to the cache key (computed after the
docker short-circuit so containers never shell out to git) so an
in-place update self-invalidates the cached count. `hermes update`'s
explicit _invalidate_update_cache() still works; this just covers manual
git updates too.
Tests updated for the extra cheap `git rev-parse HEAD` on the cache-hit
and expired-cache paths.
Kyzcreig
force-pushed
the
pr/update-cache-head-key
branch
from
July 12, 2026 09:51
058936b to
0a526ac
Compare
Contributor
|
Thanks for addressing a remaining source-install cache-staleness path. Current Problems
Suggested changes
Automated hermes-sweeper review. |
Contributor
Author
|
Closing as superseded by #72013, which carries this fix/feature forward (fresh port with maintainer engagement). Consolidating our open PRs after an audit — the newer PR is the one to review. Thanks! |
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.
The update-check cache key was
{ts, rev, ver}only. For source installs, an in-placegit pull/rebase moves HEAD without changingVERSIONorHERMES_REVISION(bothNoneoutside nix builds), so a stale "commits behind" count survives the full 6h TTL after a manual update.Symptom
After a successful manual
git pull/rebase to an up-to-date checkout,hermes --versionkeeps printing e.g.Update available: 182 commits behindeven thoughgit rev-list --count HEAD..origin/mainis0andhermes update --checkreports up to date. The stale value is read straight from~/.hermes/.update_check.Cause
check_for_updates()only invalidates the cache whenrev(HERMES_REVISION, nix-only) orver(VERSION) changes. A manual git update changes neither, so the cachedbehindis reused until the 6h TTL expires.hermes updatecalls_invalidate_update_cache(), but a manualgit pulldoes not.Fix
Add the active checkout’s
HEADSHA to the cache key. Computed after the docker short-circuit so container images (no.git) never shell out to git. An in-place update now self-invalidates the cached count.hermes update’s explicit invalidation still works; this just additionally covers manual git updates.Tests
test_check_for_updates_uses_cache— cache hit now requires matchinghead; verifies only the cheapgit rev-parse HEADruns (no fetch/rev-list).test_check_for_updates_expired_cache— expects 3 git calls (rev-parse HEAD + fetch + rev-list).tests/hermes_cli/test_update_check.pypasses (11).