The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(update): a ZIP swap killed with hermes_cli/ aside repairs under custody again
Teknium99e954838f2c
diff --git a/hermes_bootstrap.py b/hermes_bootstrap.pyindex f42d20d7174..ce469833c3b 100644--- a/hermes_bootstrap.py+++ b/hermes_bootstrap.py@@ -520,13 +520,23 @@ def _settle_interrupted_update() -> None:moved_aside = _root / "hermes_cli.hermes-update-old" / "_early_recovery.py"if not (_root / ".hermes-update-zip-swap").is_file() or not moved_aside.is_file():return # not a torn update: the imports below report the real damage- import importlib.util+ import types++ # The moved-aside directory stands in as ``hermes_cli`` (its ``__init__`` not run), so the+ # repair's own ``from hermes_cli import update_lock`` finds the custody code beside it:+ # without that the restore refuses to repair unguarded. Dropped again unless it relaunches.+ package = types.ModuleType("hermes_cli")+ package.__path__ = [str(moved_aside.parent), str(_root / "hermes_cli")]+ sys.modules["hermes_cli"] = package+ try:+ from hermes_cli import _early_recovery as recovery- spec = importlib.util.spec_from_file_location("_hermes_moved_aside_recovery", moved_aside)- if spec is None or spec.loader is None:- return- recovery = importlib.util.module_from_spec(spec)- spec.loader.exec_module(recovery)+ if recovery.restore_interrupted_pull(_root):+ recovery.relaunch_after_restore()+ finally:+ for name in [n for n in sys.modules if n == "hermes_cli" or n.startswith("hermes_cli.")]:+ del sys.modules[name]+ returnif recovery.restore_interrupted_pull(_root):recovery.relaunch_after_restore()