Skip to content

Banner shows stale "commits behind" count after manual git pull in source installs #40944

Description

@Ruben0531

After updating a git-source install of Hermes Agent via git pull --ff-only
(the documented update path for source installs per the project docs), the
version banner continues to report a stale "N commits behind" count for up to
6 hours — the duration of the update-check cache TTL.

The issue does *not affect pip installs or installs updated via
hermes update, only git-source installs that the user updates manually with
git pull.

Environment

  • Hermes Agent version: v0.16.0 (upstream fd4c8b40)
  • Install method: git source (editable install via pip install -e .)
  • Update command used: git pull --ff-only in /.hermes/hermes-agent/,
    followed by pip install -e .
  • Python: 3.11.15
  • Profile: default (single profile, not multi-profile)

Steps to reproduce

  1. Install Hermes from git source: git clone … && pip install -e .
  2. Wait until the version banner reports a non-zero "commits behind" count
    (e.g. after a few days of upstream activity, or simulate with git reset --hard HEAD81 against a fresh origin).
  3. Run hermes --version to confirm the cache populates with the stale count
    in /.hermes/.update_check:
    {"ts": 1780798639.18, "behind": 81, "rev": null, "ver": "0.16.0"}
  4. Update the install manually:
    cd /.hermes/hermes-agent
    git pull --ff-only   # moves HEAD to origin/main
    pip install -e .
  5. Verify the update succeeded:
    git rev-list --left-right --count HEAD...origin/main
    # 0 0
  6. Run hermes --version again.

Actual behavior

The banner still reports Update available: 81 commits behind — run 'hermes update', even though the local repo is at the same commit as origin/main.
The same string is returned on every subsequent hermes --version call for
up to 6 hours.

Expected behavior

The banner reflects the current state: 0 commits behind immediately after
git pull succeeds.

Root cause

The update-check cache is stored at ~/.hermes/.update_check and
invalidated in hermes_cli/banner.py (lines 252-263, approximate) by a
three-part predicate:

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

For git-source installs:

  • embedded_rev is None (no HERMES_REVISION env var)
  • VERSION is read from hermes_cli/__init__.py

If the new VERSION matches the cached VERSION — which it does in the
common case of an update that does not bump __version__ (e.g. a
release that ships a backport, security fix, or non-versioned patch batch)
— the cache is considered valid and the stale behind count is returned
for the full 6-hour TTL.

The pre-existing helper _invalidate_update_cache() in main.py:8695
already exists for this purpose, but is only invoked by hermes update,
not by the manual git pull workflow that source installs are documented
to use.

Proposed fix

Two reasonable directions, in order of preference:

Option A — Track the "behind" count, not just the version.*

[6/6/2026 10:44 PM] @rubens_jarvis_bot: origin/main` has moved since the cache was
written, invalidate.

**Option B — Invalidate cache when the version string matches but a fresh
check would return 0.**

In the banner-check path, after computing the fresh `behind` count, if
`behind == 0` and the cache has any non-zero value, delete the cache and
write a fresh entry. This is a one-liner and handles the user's most
common case ("I just updated, why is it still telling me to update?").

**Option C — Document and provide a hook.**

Document that source-install users should run a one-liner after
`git pull`:

```bash
rm ~/.hermes/.update_check

…and optionally ship it as a post-merge git hook in the source repo.

My preference is A + a small UX touch: the cache should self-heal
when it can detect staleness, but the cost of an extra git fetch on
every hermes --version call (already happening in the current code) is
low, so Option A is safe.

Workaround (verified working)

rm ~/.hermes/.update_check

After deletion, the next hermes --version call performs a fresh
git fetch origin + git rev-list --count HEAD..origin/main and reports
the correct value.

Additional notes

  • This is purely a UX/display issue; the underlying update mechanism
    works correctly.
  • I have not tested on multi-profile installs but the bug should affect
    all profiles that share the same ~/.hermes/.update_check file
    (or per-profile equivalents).
  • Diagnostic data:
    • Cache file: ~/.hermes/.update_check (JSON, plain text)
    • Banner code: hermes_cli/banner.py
    • Invalidation helper: main.py::_invalidate_update_cache()

Tested version

  • Hermes: v0.16.0 (commit fd4c8b404bd0a8bc9938a4f4c259830cbf8a4433)
  • Date observed: 2026-06-06

Activity

  1. Ruben0531 commented on Jun 7, 2026

    @Ruben0531
    Author

    Additional finding: the invalidation helper _invalidate_update_cache() targets ~/.hermes/.update_cache but the banner reads/writes ~/.hermes/.update_check — different filenames. This looks like an incomplete refactor. The helper would never invalidate the cache the banner actually uses, which may explain why hermes update also exhibits this behavior."

  2. added
    type/bugSomething isn't working
    P3Low — cosmetic, nice to have
    comp/cliCLI entry point, hermes_cli/, setup wizard
    on Jun 7, 2026
  3. wdywot commented on Jul 26, 2026

    @wdywot

    Observed on a multi-profile source install as well.

    • Ran hermes --profile ops update --backup --yes.
    • The managed checkout advanced to HEAD == origin/main == 339d968689a3b91c5f537d7198ff28abde32ab3b (verified with git rev-parse).
    • Immediately afterward, hermes version and hermes update --check still reported “Update available: 1 commit behind”.
    • The active gateway runs --profile ops; no local tracked source modifications were present.

    So the stale cache is also observable after the built-in updater, not only after a manual pull.

  4. GottZ commented on Jul 28, 2026

    @GottZ

    This was generated by AI during triage.

    Summary

    38 PRs address or reference this issue complex. Most target the stale source-install cache by adding a local-HEAD fingerprint; the remaining PRs cover built-in/ZIP invalidation, failed-check and commit-list caching, long-lived in-memory state, detached release tags, version metadata, or unrelated aggregate changes.

    Related pull requests

    Duplicates

    Core local-HEAD cache duplicates: #5359, #9670, #9951, #11210, #11451, #18236, #18888, #20653, #20792 (on-disk portion), #21447, #21675, #22118, #25435, #26006, #26180, #27844, #38337, #40157, #40985, #40999, #41012, #41043, and #54874 (local-HEAD portion). Built-in updater duplicates: #1627/#1637. Version-metadata duplicates: #35524/#38103/#38619. Detached-tag competitors: #39776/#39875, with overlapping broader #43824. Pending-commit-list implementations: #23700/#63750/#68490. #11329, #23699, and the in-memory portion of #20792 are adjacent but materially distinct.

    Suggested consolidation

    Merge #41043 as the focused #40944 fix: it is the Verify-selected best fix, preserves the current cache/install-mode contract, and tests the precise manual-fast-forward transition. Close the remaining local-HEAD-only PRs as duplicates, leaving already closed or merged references closed; do not merge the aggregate #18873/#18888 branches. Keep #11329 separate and do not merge it over the contributor CHANGES_REQUESTED review until its template/conflicts are fixed; independently satisfy the keep_open review’s ZIP-success regression-test request. For #23681, retain #23700 as the recorded canonical best fix and revise it per its keep_open review, using bounded-range ideas from #68490 only as patch material rather than replacing #23700. Handle failed-result persistence from #23699, long-lived in-memory refresh from #20792, detached release tags via #39875, and upstream-HEAD/shallow-output ideas from #54874 as separate scoped follow-ups.

    Complex graph

    flowchart TD
        classDef open fill:#dbeafe,stroke:#1d4ed8,color:#1e3a8a
        classDef merged fill:#dcfce7,stroke:#15803d,color:#14532d
        classDef closed fill:#e5e7eb,stroke:#6b7280,color:#1f2937
        classDef unverified fill:#f3f4f6,stroke:#9ca3af,color:#374151
        classDef best stroke-width:3px,stroke:#b45309
        classDef target stroke-width:3px,stroke:#4338ca
        I1620(["issue #1620 (closed)"])
        I11007(["issue #11007 (closed)"])
        I11327(["issue #11327 (open)"])
        I27841(["issue #27841 (closed)"])
        I40944(["issue #40944 (open)"])
        P9951["PR #9951 (open)"]
        P11225["PR #11225 (closed)"]
        subgraph Dup1627 ["PRs duplicating each other"]
            P1627["PR #1627 (closed)"]
            P1637["PR #1637 (merged)"]
        end
        subgraph Dup5359 ["PRs duplicating each other"]
            P5359["PR #5359 (closed)"]
            P9670["PR #9670 (open)"]
            P11210["PR #11210 (open)"]
            P54874["PR #54874 (closed)"]
        end
        subgraph Dup40985 ["PRs duplicating each other"]
            P40985["PR #40985 (closed)"]
            P40999["PR #40999 (open)"]
            P41012["PR #41012 (open)"]
            P41043["PR #41043 (open)"]
        end
        More["+26 more PRs not shown"]
        MoreI(["+5 more issues not shown"])
        P1627 -.->|unverified| I40944
        P1637 -.->|unverified| I40944
        P5359 -.->|unverified| I40944
        P9670 -.->|unverified| I40944
        P9951 -.->|unverified| I40944
        P11210 -.->|unverified| I40944
        P11225 -.->|unverified| I40944
        P40985 -->|fixes| I40944
        P40999 -.->|partial| I40944
        P41012 -.->|partial| I40944
        P41043 -->|best fix| I40944
        P54874 -->|fixes| I40944
        P1627 -->|fixes| I1620
        P1637 -->|best fix| I1620
        P5359 -->|fixes| I11007
        P9670 -->|fixes| I11007
        P9951 -->|fixes| I11007
        P11210 -->|fixes| I11007
        P11225 -->|fixes| I11007
        P41043 -->|best fix| I11007
        P54874 -->|fixes| I11007
        P41043 -->|best fix| I11327
        P41043 -->|best fix| I27841
        class I1620 closed
        class I11007 closed
        class I11327 open
        class I27841 closed
        class I40944 open
        class I40944 target
        class P1627 closed
        class P1637 merged
        class P5359 closed
        class P9670 open
        class P9951 open
        class P11210 open
        class P11225 closed
        class P40985 closed
        class P40999 open
        class P41012 open
        class P41043 open
        class P54874 closed
        class P1637 best
        class P41043 best
        class P41043 best
        class P41043 best
        class P41043 best
        class More closed
        class MoreI closed
        click I1620 "https://github.com/NousResearch/hermes-agent/issues/1620"
        click I11007 "https://github.com/NousResearch/hermes-agent/issues/11007"
        click I11327 "https://github.com/NousResearch/hermes-agent/issues/11327"
        click I27841 "https://github.com/NousResearch/hermes-agent/issues/27841"
        click I40944 "https://github.com/NousResearch/hermes-agent/issues/40944"
        click P1627 "https://github.com/NousResearch/hermes-agent/pull/1627"
        click P1637 "https://github.com/NousResearch/hermes-agent/pull/1637"
        click P5359 "https://github.com/NousResearch/hermes-agent/pull/5359"
        click P9670 "https://github.com/NousResearch/hermes-agent/pull/9670"
        click P9951 "https://github.com/NousResearch/hermes-agent/pull/9951"
        click P11210 "https://github.com/NousResearch/hermes-agent/pull/11210"
        click P11225 "https://github.com/NousResearch/hermes-agent/pull/11225"
        click P40985 "https://github.com/NousResearch/hermes-agent/pull/40985"
        click P40999 "https://github.com/NousResearch/hermes-agent/pull/40999"
        click P41012 "https://github.com/NousResearch/hermes-agent/pull/41012"
        click P41043 "https://github.com/NousResearch/hermes-agent/pull/41043"
        click P54874 "https://github.com/NousResearch/hermes-agent/pull/54874"
    
    Loading

    Graph: solid arrow = fixes / best fix, dashed arrow = partial or unverified (see edge label); boxed group = PRs duplicating each other; amber border = best fix; indigo border = target; gray node = closed or no verify verdict yet (state tag in the node label).

    Cross-PR triage: Reviewed 38 pull requests and 10 issues in this complex. Each diff was read against this issue; Assessment working set: 1107 kB of PR diffs, 87 kB of issue/PR text, 63 kB of discussion (95 comments), 85 verify verdicts. verdicts reflect diff content, not PR titles. Part of an automated triage batch.

  5. added a commit that references this issue on Aug 6, 2026
    7ee7a6b
  6. teknium1 commented on Oct 7, 2026

    @teknium1
    Collaborator

    Checked against current main as part of the updater backlog sweep: this one is fixed.

    Fixed by: cfebdfd — Own passive source update checks in Python (on main since 2026-09-12).
    Where: hermes_cli/source_check.py::check_for_updates / _cached_status

    Why this resolves it: The stale count came from a TTL cache in ~/.hermes/.update_check that ignored local HEAD. cfebdfd replaced it with home/source-checks/<install_id>.json whose cache identity includes {'head': co.head, origin, branch,...}, and _cached_status only returns the cache when identity == current. A manual git pull changes HEAD, so the cache misses and the count is recomputed.

    If you still hit this on a build that includes that commit, please reopen with the output of hermes debug share and we'll pick it straight back up. Thanks for the report.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3Low — cosmetic, nice to havearea/install-updateInstaller, updater, packaging, wheels, doctorcomp/cliCLI entry point, hermes_cli/, setup wizardduplicateThis issue or pull request already existstype/bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions