hermes - 💡(How to fix) Fix check_for_updates() cache not invalidated after pip upgrade, showing stale "1 commit behind" [2 pull requests]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…

Root Cause

Root Cause

Fix Action

Fixed

Code Example

if (
    now - cached.get("ts", 0) < _UPDATE_CHECK_CACHE_SECONDS
    and cached.get("rev") == embedded_rev
):
    return cached.get("behind")

---

try:
      if cache_file.exists():
          cached = json.loads(cache_file.read_text())
          if (
              now - cached.get("ts", 0) < _UPDATE_CHECK_CACHE_SECONDS
              and cached.get("rev") == embedded_rev
+             and cached.get("version") == VERSION
          ):
              return cached.get("behind")
  ...
  cache_file.write_text(json.dumps({
      "ts": now, "behind": behind, "rev": embedded_rev,
+     "version": VERSION
  }))
RAW_BUFFERClick to expand / collapse

Description

After upgrading hermes-agent from 0.14.0 to 0.15.1 via uv pip install --upgrade, hermes --version still shows "1 commit behind" for up to 6 hours.

Root Cause

check_for_updates() in hermes_cli/banner.py caches the result in ~/.hermes/.update_check. The cache invalidation logic has two conditions:

if (
    now - cached.get("ts", 0) < _UPDATE_CHECK_CACHE_SECONDS
    and cached.get("rev") == embedded_rev
):
    return cached.get("behind")

For pip-installed Hermes (non-Nix), embedded_rev is always None. After an upgrade, both the old and new cache's rev are None → cache is considered valid → stale "1 commit behind" persists until the 6-hour TTL expires.

Steps to Reproduce

  1. Install hermes-agent==0.14.0, run hermes --version (writes cache with behind: 1)
  2. uv pip install --upgrade hermes-agent to 0.15.1
  3. Run hermes --version → still shows "1 commit behind"
  4. rm ~/.hermes/.update_check, run again → correctly shows "Up to date"

Expected Behavior

Cache should be invalidated when the installed version changes. The simplest fix: add "version": VERSION to the cache payload and compare it on read.

  try:
      if cache_file.exists():
          cached = json.loads(cache_file.read_text())
          if (
              now - cached.get("ts", 0) < _UPDATE_CHECK_CACHE_SECONDS
              and cached.get("rev") == embedded_rev
+             and cached.get("version") == VERSION
          ):
              return cached.get("behind")
  ...
  cache_file.write_text(json.dumps({
      "ts": now, "behind": behind, "rev": embedded_rev,
+     "version": VERSION
  }))

Environment

  • Hermes Agent v0.15.1 (pip install, no local git checkout)
  • Python 3.11.15, Ubuntu

Reported by @Jasper-1222


Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

hermes - 💡(How to fix) Fix check_for_updates() cache not invalidated after pip upgrade, showing stale "1 commit behind" [2 pull requests]