Skip to content

fix(update): heal active memory provider deps after venv rebuild - #72363

Merged
teknium1 merged 4 commits into
mainfrom
fix/memory-provider-update-refresh
Jul 27, 2026
Merged

fix(update): heal active memory provider deps after venv rebuild#72363
teknium1 merged 4 commits into
mainfrom
fix/memory-provider-update-refresh

Conversation

@teknium1

Copy link
Copy Markdown
Contributor

Summary

hermes update now heals the active memory provider's pip dependencies after the core reinstall — Mem0 OSS and local Hindsight (including the embedded daemon stack) survive every update instead of silently breaking until a manual reinstall (fixes #53272, fixes the hindsight-embed half of #70636).

Root cause: memory-provider bridge packages are declared in each provider's plugin.yaml (installed by hermes memory setup), NOT in Hermes' extras or LAZY_DEPS — so the update flow's .[all] reinstall + lazy refresh could strip or downgrade them and nothing ever put them back. Hindsight local_embedded is worse: setup installs hindsight-all (daemon + embedder + client), which even the manifest doesn't declare, so hindsight-embed was invisible to every refresh path.

Changes

  • hermes_cli/main.py: _refresh_active_memory_provider_dependencies() — re-runs the ACTIVE provider's declared dep install after the core install + lazy refresh, wired into both the git-pull and ZIP update paths. Skips builtin/none/disabled. Never raises.
  • hermes_cli/memory_setup.py: _install_dependencies(force=True) hands every declared spec to the resolver (restores missing AND version-drifted packages; no-op when satisfied). Spec-aware import probing so version ranges (mem0ai>=2.0.10,<3) map to import names correctly.
  • hermes_cli/memory_setup.py: _provider_pip_dependencies() — mode-aware expansion: Hindsight in local/local_embedded mode adds hindsight-all, matching what setup actually installs (hermes update downgrades/removes third-party packages installed into the managed venv (e.g. hindsight-embed) #70636's missing piece).
  • plugins/memory/hindsight/__init__.py: availability probe now imports sentence_transformers too (salvaged from fix(memory/hindsight): availability probe must check the embedding stack, not just the API modules #68009 by @spiky02plateau) — hermes memory status / is_available() report the real ImportError instead of staying green while the daemon aborts at startup.
  • 9 new tests (update wiring, skip guards, never-raise, mode expansion, force path, probe coverage).

Validation

Before After
hermes update with mem0 OSS active mem0ai gone → "No module named 'mem0'" reinstalled every update
update with Hindsight local_embedded hindsight-embed stripped, daemon dead, status green hindsight-client + hindsight-all healed; probe reports embedding-stack breakage honestly
provider install fails mid-update warning printed, update continues (never-raise)
  • scripts/run_tests.sh tests/hermes_cli/test_update_autostash.py tests/hermes_cli/test_memory_setup.py tests/plugins/memory/test_hindsight_provider.py — 184/184 green
  • Sabotage run: removing the cmd_update wiring fails test_cmd_update_refreshes_active_memory_provider_dependencies
  • E2E (real imports, temp HERMES_HOME, real config.yaml + hindsight config.json in local_embedded mode): refresh installs exactly ['hindsight-client>=0.6.1', 'hindsight-all']

Credit

Salvages #53505 by @LeonSGP43 (update-path refresh — surgical reapply, stale base) and #68009 by @spiky02plateau (embedding-stack probe), authorship preserved. #40341 (@GodsBoy discussion) and #53298 identified the same mechanism earlier for the plugin.yaml route.

Fixes #53272. Fixes the package-healing half of #70636 (the hermes.env overwrite half is #70606, separate).

Infographic

infographic

spiky02plateau and others added 4 commits July 26, 2026 18:15
… 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
Surgical reapply of #53505 by @LeonSGP43 onto current main (stale-base
cherry-pick conflicted in main.py):

- _refresh_active_memory_provider_dependencies() in hermes_cli/main.py,
  wired into BOTH the git-pull update path (after lazy refresh) and the
  ZIP update path — the provider's plugin.yaml bridge packages are not
  in extras or LAZY_DEPS, so the core reinstall could strip/downgrade
  them and the update flow never healed them (#53272 mem0ai).
- _install_dependencies(force=True) in memory_setup.py: hand every
  declared spec to the resolver on update so missing AND version-drifted
  packages are restored (no-op when satisfied).
- Skip guards: no provider / builtin store / memory.enabled=false.

Widened beyond the original PR for the #70636 half:
- _provider_pip_dependencies(): mode-aware expansion — Hindsight in
  local/local_embedded mode needs hindsight-all (daemon + embedder), not
  just the declared hindsight-client; setup installs it but plugin.yaml
  can't express it, so update-time healing previously missed
  hindsight-embed and the daemon stayed broken.
- Spec-aware import probing: version ranges in pip_dependencies
  (mem0ai>=2.0.10,<3) no longer break the pip-name -> import-name
  mapping.

Fixes #53272. Fixes the hindsight-embed half of #70636.
@alt-glitch alt-glitch added type/bug Something isn't working comp/cli CLI entry point, hermes_cli/, setup wizard comp/plugins Plugin system and bundled plugins tool/memory Memory tool and memory providers area/install-update Installer, updater, packaging, wheels, doctor P3 Low — cosmetic, nice to have sweeper:risk-compatibility Sweeper risk: may break existing users, config, migrations, defaults, or upgrades labels Jul 27, 2026
@github-actions

github-actions Bot commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

૮ >ﻌ< ა ci review

ran on b295ce3

all good!

@teknium1
teknium1 merged commit 139282f into main Jul 27, 2026
41 checks passed
@teknium1
teknium1 deleted the fix/memory-provider-update-refresh branch July 27, 2026 02:29
Enough1122 added a commit to Enough1122/hermes-agent that referenced this pull request Aug 8, 2026
…hindsight-all

_provider_pip_dependencies appends a bare `hindsight-all` spec for
every local/local_embedded install (added by NousResearch#72363 to heal Hindsight
after a venv rebuild).  On Intel macOS the full local-ML dependency set
pulls MLX packages that ship no x86_64 wheels; the resolver backtracks
instead of failing, installing ancient hindsight-all / hindsight-api
releases whose overlapping hindsight_api files override the working
slim API.  The daemon then crashes with 'Unknown embeddings provider:
onnx' and the web UI reports HTTP 500/502 (NousResearch#81421).

Fix: detect Darwin + x86_64 in _provider_pip_dependencies and install
the thin slim stack (hindsight-all-slim + hindsight-api-slim[local-onnx])
for local/local_embedded mode there.  Apple Silicon, Linux, and all
other platforms keep the full bundle — the NousResearch#70636 heal path is
unchanged.  Non-local modes and missing config are unaffected.

Adds 6 regression tests: Intel-macOS detection, arm64/linux negatives,
the issue's exact scenario (bare hindsight-all must not appear on Intel
macOS), non-Intel keeps the full bundle, non-local modes unchanged, and
missing-config fallback.  The issue scenario is RED on pre-fix code
(old code appends bare hindsight-all unconditionally).
Enough1122 added a commit to Enough1122/hermes-agent that referenced this pull request Aug 14, 2026
…hindsight-all

_provider_pip_dependencies appends a bare `hindsight-all` spec for
every local/local_embedded install (added by NousResearch#72363 to heal Hindsight
after a venv rebuild).  On Intel macOS the full local-ML dependency set
pulls MLX packages that ship no x86_64 wheels; the resolver backtracks
instead of failing, installing ancient hindsight-all / hindsight-api
releases whose overlapping hindsight_api files override the working
slim API.  The daemon then crashes with 'Unknown embeddings provider:
onnx' and the web UI reports HTTP 500/502 (NousResearch#81421).

Fix: detect Darwin + x86_64 in _provider_pip_dependencies and install
the thin slim stack (hindsight-all-slim + hindsight-api-slim[local-onnx])
for local/local_embedded mode there.  Apple Silicon, Linux, and all
other platforms keep the full bundle — the NousResearch#70636 heal path is
unchanged.  Non-local modes and missing config are unaffected.

Adds 6 regression tests: Intel-macOS detection, arm64/linux negatives,
the issue's exact scenario (bare hindsight-all must not appear on Intel
macOS), non-Intel keeps the full bundle, non-local modes unchanged, and
missing-config fallback.  The issue scenario is RED on pre-fix code
(old code appends bare hindsight-all unconditionally).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/install-update Installer, updater, packaging, wheels, doctor comp/cli CLI entry point, hermes_cli/, setup wizard comp/plugins Plugin system and bundled plugins P3 Low — cosmetic, nice to have sweeper:risk-compatibility Sweeper risk: may break existing users, config, migrations, defaults, or upgrades 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.

Bug: hermes update does not reinstall active memory provider pip dependencies (Mem0 OSS / mem0ai)

4 participants