Skip to content

The agent that grows with you

fix(telemetry): install receipts age on the store's clock, not wall time

Teknium10a877bc9e5f
diff --git a/hermes_cli/observability/shared_metrics_install_run.py b/hermes_cli/observability/shared_metrics_install_run.py
index 05fb79839fb..9ac904f9f32 100644
--- a/hermes_cli/observability/shared_metrics_install_run.py
+++ b/hermes_cli/observability/shared_metrics_install_run.py
@@ -22,7 +22,6 @@ import os
import re
import shutil
import sqlite3
-import time
from datetime import datetime, timezone, UTC
from pathlib import Path
from typing import Any
@@ -147,7 +146,11 @@ def _claim_receipt(path: Path) -> Path | None:
def _stale(receipt: dict) -> bool:
- return time.time() - receipt["finished_at"] > MAX_RECEIPT_AGE_SECONDS
+ # The store's clock, the same one that picks the consented day: a second clock let a receipt
+ # the day logic still considered fresh expire on wall time.
+ from .shared_metrics import _utc_now
+
+ return _utc_now().timestamp() - receipt["finished_at"] > MAX_RECEIPT_AGE_SECONDS
def report_pending_installs(home: Path) -> None: