fix(hindsight): availability probe must cover the embedding stack for local modes

_check_local_runtime() only imported 'hindsight' and
'hindsight_embed.daemon_embed_manager', a strictly weaker import surface
than the embedded daemon actually needs: the daemon imports
sentence_transformers at startup (embeddings + reranker). When the
embedding stack is broken (e.g. a dependency conflict on a shared package
like huggingface-hub), the daemon can never start, yet is_available() and
'hermes memory status' still report Hindsight as available — every
retain/recall then fails silently.

Import sentence_transformers in the same probe so local/local_embedded
availability goes red with the real ImportError as the reason, letting
the agent degrade loudly instead of silently dropping memory. Local path
only; cloud mode is untouched and no network or model download is
triggered by the import.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MN8RMDLwxCfFxwtADoEJJf
This commit is contained in:
spiky02plateau 2026-07-20 13:10:59 +02:00 committed by Teknium
parent 623762f2f0
commit ab2c9289ca
1 changed files with 9 additions and 0 deletions

View File

@ -131,10 +131,19 @@ def _check_local_runtime() -> tuple[bool, str | None]:
error from NumPy before the daemon starts. Treat that as "unavailable"
so Hermes can degrade gracefully instead of repeatedly trying to start
a broken local memory backend.
The embedded daemon computes embeddings via ``sentence_transformers``
(transformers + huggingface-hub). Importing ``hindsight`` /
``hindsight_embed`` alone succeeds even when that stack is broken, so
without importing it here the probe would falsely report the backend
healthy and ``hermes memory status`` would stay green while the daemon
aborts at startup on every retain/recall. Import it too so the probe (and
status) reports the real ImportError.
"""
try:
importlib.import_module("hindsight")
importlib.import_module("hindsight_embed.daemon_embed_manager")
importlib.import_module("sentence_transformers")
return True, None
except Exception as exc:
return False, str(exc)