The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(cache): signatures stored and compared later always hash
Tekniumf09d03dfe2c2
diff --git a/agent/prompt_builder.py b/agent/prompt_builder.pyindex 517b07132b8..eb8de4439c2 100644--- a/agent/prompt_builder.py+++ b/agent/prompt_builder.py@@ -1110,7 +1110,7 @@ def _build_skills_manifest(skills_dir: Path) -> dict[str, list[int]]:try:if filename in files:st = os.stat(path)- manifest[path[prefix_len:]] = list(file_cache_version(path, st))+ manifest[path[prefix_len:]] = list(file_cache_version(path, st, always_digest=True))except OSError:passreturn manifestdiff --git a/gateway/run_profile_reconcile.py b/gateway/run_profile_reconcile.pyindex ccb37e9c62f..59dd4cf7af5 100644--- a/gateway/run_profile_reconcile.py+++ b/gateway/run_profile_reconcile.py@@ -41,7 +41,7 @@ _OWN_GATEWAY_PROBE_TIMEOUT_SECS = 5.0def _stat_signature(path: Path) -> Optional[tuple]:try:- return file_cache_version(path)+ return file_cache_version(path, always_digest=True) # stored, compared on a later tickexcept OSError:return Nonediff --git a/hermes_cli/free_tier_bootstrap.py b/hermes_cli/free_tier_bootstrap.pyindex 539ff70e511..92ab64e4ce2 100644--- a/hermes_cli/free_tier_bootstrap.py+++ b/hermes_cli/free_tier_bootstrap.py@@ -135,7 +135,7 @@ def _config_stamp() -> tuple:stamp = []for name in _INVENTORY_FILES:try:- stamp.append(file_cache_version(home / name))+ stamp.append(file_cache_version(home / name, always_digest=True))except OSError:stamp.append(None)return tuple(stamp)diff --git a/tui_gateway/methods_onboarding.py b/tui_gateway/methods_onboarding.pyindex f3333120e98..83b27ed27fe 100644--- a/tui_gateway/methods_onboarding.py+++ b/tui_gateway/methods_onboarding.py@@ -79,7 +79,7 @@ def _shared_nous_store() -> tuple[Path, ...]:def _version(path):from utils import file_cache_versiontry:- return file_cache_version(path)+ return file_cache_version(path, always_digest=True) # stamp stored, compared laterexcept OSError:return Nonediff --git a/website/docs/developer-guide/config-backend.md b/website/docs/developer-guide/config-backend.mdindex a3c692f8ec9..158fd4fa42c 100644--- a/website/docs/developer-guide/config-backend.md+++ b/website/docs/developer-guide/config-backend.md@@ -20,7 +20,7 @@ already reaches it.| `read_config_doc(path)` | Parsed user layer (raises like `open` + `fast_safe_load`) || `read_config_doc_readonly(path)` | Signature-cached read; never mutate the result || `config_version(path)` | Change signature (the file's stat tuple) |-| `config_cache_version(path)` (`config_cache_version_or_none`) | Signature for a cache of the parse: the stat tuple plus a content digest while the mtime is younger than `utils.RACY_MTIME_WINDOW_NS` (`utils.file_cache_version` on the file backend) |+| `config_cache_version(path)` (`config_cache_version_or_none`) | Signature for a cache of the parse: the stat tuple plus a content digest while the later of mtime and ctime is younger than `utils.RACY_MTIME_WINDOW_NS` (`utils.file_cache_version` on the file backend) || `config_exists(path)` | Whether the layer exists || `probe_config_readable(path)` | Raise `OSError` while the layer cannot be read (no parse) || `write_config_document(path, doc)` / `write_config_key(path, key, value)` | Writes; callers normally use `atomic_config_write` / `atomic_config_replace` |@@ -33,7 +33,11 @@ pins the older parse for the life of the process (a rotated `api_key` is the usuAny other file a cache derives from (`auth.json`, pairing lists, `.env`, token files, the managedoverlay) keys on `utils.file_cache_version(path)`; a signature stored and compared much later (achange detector whose false positive reconnects something, a parse-failure record) passes-`always_digest=True`, because the racy digest turns empty once the file settles. The managed scope (`/etc/hermes`) stays an overlay on top+`always_digest=True`, because the racy digest turns empty once the file settles (the skills+manifest, hook-consent, free-tier and onboarding stamps do). "Recent" is judged on ctime as well as+mtime, because `cp -p` or `rsync --inplace -t` restore an older mtime after writing. A worker bound to+a frozen config snapshot never hashes a `config.yaml`: its key stays stat-only there, so the content+check never makes such a worker open the profile file. The managed scope (`/etc/hermes`) stays an overlay on topof whatever user layer the backend returns.## Lints