The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(compat-fallout): module-restore also rebinds pkg.<child> attributes so 'from pkg import child' matches sys.modules after the wipe
Tekniumeb2e96d65782
diff --git a/tests/agent/test_empty_tool_name_loop_dampening.py b/tests/agent/test_empty_tool_name_loop_dampening.pyindex 7076f75f8d2..79e7174cb77 100644--- a/tests/agent/test_empty_tool_name_loop_dampening.py+++ b/tests/agent/test_empty_tool_name_loop_dampening.py@@ -161,6 +161,13 @@ def agent_env():# land on modules the app no longer imports.sys.modules.clear()sys.modules.update(saved_modules)+ for _name, _mod in saved_modules.items():+ _parent, _, _child = _name.rpartition(".")+ if _parent and _parent in saved_modules:+ try:+ setattr(saved_modules[_parent], _child, _mod)+ except Exception:+ passif prev_home is None:os.environ.pop("HERMES_HOME", None)else:diff --git a/tests/agent/test_verification_stop_caching.py b/tests/agent/test_verification_stop_caching.pyindex a059383e117..56781040316 100644--- a/tests/agent/test_verification_stop_caching.py+++ b/tests/agent/test_verification_stop_caching.py@@ -27,8 +27,21 @@ def _restore_sys_modules():the app no longer imports."""saved = dict(sys.modules)yield+ _restore_modules(saved)+++def _restore_modules(saved):sys.modules.clear()sys.modules.update(saved)+ # Re-imports rebound ``pkg.<child>`` attributes to the fresh module objects; point them+ # back so ``from pkg import child`` and ``sys.modules["pkg.child"]`` agree again.+ for name, mod in saved.items():+ parent, _, child = name.rpartition(".")+ if parent and parent in saved:+ try:+ setattr(saved[parent], child, mod)+ except Exception:+ passdef _fresh_run_agent(hermes_home):