Skip to content

fix(memory): add hindsight_client import check for local_external mode - #32801

Closed
CipherFrame wants to merge 1 commit into
NousResearch:mainfrom
CipherFrame:fix/hindsight-local-external-import-check
Closed

fix(memory): add hindsight_client import check for local_external mode#32801
CipherFrame wants to merge 1 commit into
NousResearch:mainfrom
CipherFrame:fix/hindsight-local-external-import-check

Conversation

@CipherFrame

Copy link
Copy Markdown
Contributor

Problem

In local_external mode, is_available() returns True unconditionally (line 602-603), causing hermes memory status to report Hindsight as "available ✓" even when the hindsight-client Python package is not installed in the runtime.

This creates a false-positive that only surfaces at runtime when hindsight_recall / hindsight_reflect tools fail with:

ModuleNotFoundError: No module named 'hindsight_client'

This is especially confusing in Docker deployments where:

  • The external Hindsight backend is healthy (health check passes, direct REST works)
  • hermes memory status says everything is fine
  • But the actual TUI/gateway tools crash

The root cause: #18924 proposed a fix for this but was closed without merging. The local_external branch of is_available() never got the import guard that local_embedded has via _check_local_runtime().

Fix

Add an importlib.import_module("hindsight_client") guard to the local_external branch. If the package is missing, log a warning and return False so hermes memory status accurately reflects reality.

if mode == "local_external":
    try:
        importlib.import_module("hindsight_client")
    except ImportError:
        logger.warning(
            "hindsight-client package is not installed. "
            "Install it with: uv pip install hindsight-client"
        )
        return False
    return True

This is a minimal, targeted fix — 8 lines, one file, no new dependencies.

Testing

Field-tested in a Docker Compose deployment:

  • Without hindsight-client: is_available() returns False with warning log → status no longer lies
  • With hindsight-client installed via uv: is_available() returns True → tools work correctly

Refs: #18876

In local_external mode, is_available() returned True unconditionally,
causing hermes memory status to report Hindsight as available even when
the hindsight-client package is not installed. This leads to confusing
runtime failures when hindsight_recall/hindsight_reflect tools are
invoked in the TUI.

Add an importlib.import_module('hindsight_client') guard that returns
False with a warning log if the package is missing, matching the pattern
already used by _check_local_runtime() for local_embedded mode.

Refs: NousResearch#18876
@alt-glitch alt-glitch added type/bug Something isn't working P3 Low — cosmetic, nice to have comp/plugins Plugin system and bundled plugins tool/memory Memory tool and memory providers duplicate This issue or pull request already exists labels May 26, 2026
@alt-glitch

Copy link
Copy Markdown
Collaborator

Duplicate of #18882 which already guards is_available() for cloud/local_external modes with the same hindsight_client import check. Also overlaps with closed #22586 (same fix). See also #24353 (local_external health check probes).

@teknium1

Copy link
Copy Markdown
Contributor

Thanks for the focused report and minimal patch. The runtime failure described here is already addressed on current main by a later lazy-install implementation.

  • Automated hermes-sweeper review verified plugins/memory/hindsight/__init__.py:1054-1055 calls _ensure_cloud_client_dependency() before importing hindsight_client; local_external uses that non-embedded path.
  • Regression coverage at tests/plugins/memory/test_hindsight_provider.py:298-301 specifically verifies the local_external path ensures memory.hindsight before the client import.
  • Commit 6c44471bfdb8a243200abe7aac44371727fda5ca (fix(hindsight): lazy-install cloud client dependency) shipped in v2026.6.19.
  • The Docker-specific dependency gap from the discussion was also fixed by 96f0ddc6a946156c3f6d7151055329c0a99fec39, which bakes --extra hindsight into Dockerfile:183.

The proposed is_available() import guard would cause agent/agent_init.py:1393-1394 to skip provider activation before the lazy installer can run. Closing as implemented on main.

@teknium1 teknium1 closed this Jul 13, 2026
@teknium1 teknium1 added the sweeper:implemented-on-main Sweeper: behavior already present on current main label Jul 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/plugins Plugin system and bundled plugins duplicate This issue or pull request already exists P3 Low — cosmetic, nice to have sweeper:implemented-on-main Sweeper: behavior already present on current main tool/memory Memory tool and memory providers type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants