The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
revert(cli): retire the CLI agent inline again; it is a GatewayAgent
kshitijk4poor3c14c870e9f2
diff --git a/hermes_cli/cli_agent_setup_mixin.py b/hermes_cli/cli_agent_setup_mixin.pyindex 3ae01aa2c83..2119c21dadc 100644--- a/hermes_cli/cli_agent_setup_mixin.py+++ b/hermes_cli/cli_agent_setup_mixin.py@@ -233,17 +233,11 @@ def _resume_panel_colors() -> tuple:def _retire_agent(cli) -> None:"""Drop ``cli.agent`` so the next turn rebuilds it, releasing its LLM clients first: the Codexapp-server child (and MCP descendants) belongs to the instance, so ``self.agent = None`` alone- orphans it for the CLI process lifetime (#72548). Session tool state is kept (soft release).- The release drains and shuts down memory providers (seconds), so it runs off the command path;- non-daemon, so a normal exit still waits for it."""+ orphans it for the CLI process lifetime (#72548). Session tool state is kept (soft release)."""agent = cli.agent- cli.agent = Noneif agent is not None and hasattr(agent, "release_clients"):- from agent.memory_provider import spawn_context_thread- try:- spawn_context_thread(agent.release_clients, name="cli-agent-retire", daemon=False).start()- except RuntimeError: # no new threads (interpreter shutting down): release inline- agent.release_clients()+ agent.release_clients()+ cli.agent = Noneclass CLIAgentSetupMixin:diff --git a/tests/hermes_cli/test_cli_retire_agent.py b/tests/hermes_cli/test_cli_retire_agent.pyindex bd7c8db347d..1c69e555f3b 100644--- a/tests/hermes_cli/test_cli_retire_agent.py+++ b/tests/hermes_cli/test_cli_retire_agent.py@@ -7,7 +7,6 @@ from types import SimpleNamespacefrom unittest.mock import patchfrom hermes_cli.cli_commands_mixin import CLICommandsMixin-from tests.waiting import wait_untilclass _FakeAgent:@@ -25,4 +24,4 @@ def test_reasoning_command_releases_old_agent_clients_before_rebuild():CLICommandsMixin._handle_reasoning_command(stub, "/reasoning high")assert stub.reasoning_config == {"enabled": True, "effort": "high"}assert stub.agent is None- wait_until(lambda: agent.release_calls == 1, what="the retired agent's clients to be released")+ assert agent.release_calls == 1