The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(cli): heal memory-provider bridge packages on every venv repair path
Yagna Vudathu1f6e737ecbca
diff --git a/hermes_cli/update_cmd.py b/hermes_cli/update_cmd.pyindex ba2c2ce6e12..3aebc4466e6 100644--- a/hermes_cli/update_cmd.py+++ b/hermes_cli/update_cmd.py@@ -651,6 +651,9 @@ def _repair_venv_on_current_checkout(_m()._refresh_active_lazy_features(repair_prefix, env=repair_env, features=active_lazy_features)_m()._restore_active_tool_dependencies(active_tool_dependencies, repair_prefix, env=repair_env)_m()._reapply_plugin_python_dependencies()+ # Heal memory-provider bridge packages last. The steps above may have stripped them+ # (parity with the git-pull and ZIP paths, #113741).+ _m()._refresh_active_memory_provider_dependencies()# Core ``.[all]`` install finished. Clear the generic core breadcrumb before the lazy-refresh phase —# that phase uses its own marker so a later lazy failure cannot be "healed" by clearing the core marker# based on a narrow 7-package import probe (#58004 review).@@ -742,6 +745,9 @@ def _repair_current_checkout(_m()._restore_active_tool_dependencies(active_tool_dependencies, repair_prefix, env=repair_env)_m()._reapply_plugin_python_dependencies()+ # Heal memory-provider bridge packages last. The swapped-in venv was built+ # from uv.lock alone (parity with the pull/ZIP/venv-repair paths, #113741).+ _m()._refresh_active_memory_provider_dependencies()current_checkout_complete = _repair_node_deps_on_current_checkout(_print_verified_update_completion, assume_yes=assume_yes, gateway_mode=gateway_mode,pre_update_snapshot_id=pre_update_snapshot_id,diff --git a/tests/hermes_cli/test_cmd_update.py b/tests/hermes_cli/test_cmd_update.pyindex b9d38f847f1..24fff6438be 100644--- a/tests/hermes_cli/test_cmd_update.py+++ b/tests/hermes_cli/test_cmd_update.py@@ -351,6 +351,48 @@ class TestRepairCurrentCheckoutRuntimeRepair:assert markers == []+ def test_repair_refreshes_memory_provider_after_tool_restore(self, monkeypatch):+ """The venv-repair path must heal memory-provider bridge packages like the+ git-pull and ZIP paths do, after the tool-dep restore (#113741)."""+ from hermes_cli import main as hm++ calls: list = []+ monkeypatch.setattr(+ hm, "_refresh_active_memory_provider_dependencies", lambda: calls.append("memory"))+ restored, _, _, _ = self._run(monkeypatch, repaired=True)+ assert calls == ["memory"]+ assert restored[-1][0] == "tools"++ def test_venv_repair_path_refreshes_memory_provider(self, monkeypatch, tmp_path):+ """The unhealthy-venv repair path heals memory-provider bridge packages too+ (parity with pull/ZIP, #113741). Drives _repair_venv_on_current_checkout."""+ from hermes_cli import main as hm++ calls: list = []+ monkeypatch.setattr(hm, "_abort_dependency_sync_if_self_locked", lambda *_a, **k: None)+ monkeypatch.setattr(update_cmd, "_write_update_incomplete_marker", lambda: None)+ monkeypatch.setattr(update_cmd, "_venv_core_imports_healthy", lambda: (True, "ok"))+ monkeypatch.setattr(update_cmd, "project_venv_dir", lambda _root: tmp_path / "venv")+ monkeypatch.setattr(+ update_cmd, "venv_python_path", lambda _d, **k: tmp_path / "venv" / "bin" / "python")+ monkeypatch.setattr(update_cmd, "_pip_install_prefix", lambda _uv: (["uv", "pip"], {}))+ monkeypatch.setattr(+ hm, "_install_python_dependencies_with_optional_fallback", lambda *_a, **k: None)+ monkeypatch.setattr(hm, "_refresh_active_lazy_features", lambda *a, **k: True)+ monkeypatch.setattr(hm, "_restore_active_tool_dependencies", lambda *a, **k: None)+ monkeypatch.setattr(+ hm, "_refresh_active_memory_provider_dependencies", lambda: calls.append("memory"))+ monkeypatch.setattr(hm, "_clear_update_incomplete_marker", lambda: None)+ monkeypatch.setattr(hm, "_is_windows", lambda: False)+ monkeypatch.setattr("hermes_cli.managed_uv.ensure_uv", lambda **k: "uv")++ assert update_cmd._repair_venv_on_current_checkout(+ assume_yes=True, gateway_mode=False, pre_update_snapshot_id=None,+ had_desktop_app_before_update=False, active_lazy_features=[],+ active_tool_dependencies=[], _windows_gateway_resume=None,+ )+ assert calls == ["memory"]+class TestCmdUpdateBranchFallback:"""cmd_update falls back to main when current branch has no remote counterpart."""