From 4b96d10bc3560f504c5e94e98ba3c50ce15790db Mon Sep 17 00:00:00 2001 From: Teknium <127238744+teknium1@users.noreply.github.com> Date: Tue, 17 Mar 2026 01:38:11 -0700 Subject: [PATCH] fix(cli): invalidate update-check cache after hermes update Signed-off-by: nidhi-singh02 Co-authored-by: nidhi-singh02 --- hermes_cli/main.py | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/hermes_cli/main.py b/hermes_cli/main.py index 876bc38c8..690b652ec 100644 --- a/hermes_cli/main.py +++ b/hermes_cli/main.py @@ -2124,7 +2124,17 @@ def _restore_stashed_changes( print(" Review `git diff` / `git status` if Hermes behaves unexpectedly.") return True - +def _invalidate_update_cache(): + """Delete the update-check cache so ``hermes --version`` doesn't + report a stale "commits behind" count after a successful update.""" + try: + cache_file = Path(os.getenv( + "HERMES_HOME", Path.home() / ".hermes" + )) / ".update_check" + if cache_file.exists(): + cache_file.unlink() + except Exception: + pass def cmd_update(args): """Update Hermes Agent to the latest version.""" @@ -2197,6 +2207,7 @@ def cmd_update(args): commit_count = int(result.stdout.strip()) if commit_count == 0: + _invalidate_update_cache() print("✓ Already up to date!") return @@ -2217,6 +2228,8 @@ def cmd_update(args): prompt_user=prompt_for_restore, ) + _invalidate_update_cache() + # Reinstall Python dependencies (prefer uv for speed, fall back to pip) print("→ Updating Python dependencies...") uv_bin = shutil.which("uv")