The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(delegation): refresh pins a backend-only move itself
Tekniumb3555420ba83
diff --git a/agent/delegation_backends.py b/agent/delegation_backends.pyindex 918991f839e..f6b8756ca34 100644--- a/agent/delegation_backends.py+++ b/agent/delegation_backends.py@@ -123,11 +123,10 @@ def apply_requested_tool_rebuild(agent: Any) -> bool:return False_rebuild_requests.discard(key)from hermes_cli.observability.shared_metrics_efficiency import record_cache_break- from tools.mcp_tool_agent import persist_agent_tool_names, refresh_agent_mcp_tools+ from tools.mcp_tool_agent import refresh_agent_mcp_toolsbefore = getattr(agent, "tools", None)refresh_agent_mcp_tools(agent, quiet_mode=True, content_aware=True) # adopts the saved backend, re-pins a changeif agent.tools is before:- persist_agent_tool_names(agent) # only the backend moved (two backends, one schema): pin itreturn Falserecord_cache_break(agent, "toolset_change")return Truediff --git a/tools/mcp_tool_agent.py b/tools/mcp_tool_agent.pyindex 9b999a67bdf..7a31cb2af75 100644--- a/tools/mcp_tool_agent.py+++ b/tools/mcp_tool_agent.py@@ -145,9 +145,12 @@ def refresh_agent_mcp_tools(added = _publish_tool_snapshot(agent, new_defs, new_names, snapshot_generation=snapshot_generation,staged_engine_names=staged_engine_names, content_aware=content_aware, prefix_registered=prefix_registered)+ backend_before = getattr(agent, "_delegation_backend", None)if prefix_registered is None: # a rebuild: the session now routes on the backend its new delegate_task is fromadopt_built_backend(agent, new_defs, built_backend)if added is None:+ if getattr(agent, "_delegation_backend", None) != backend_before:+ persist_agent_tool_names(agent) # only the backend moved (two backends build one schema): pin itreturn set()persist_agent_tool_names(agent) # re-pin so a rebuild after agent-cache eviction restores this orderreturn added