The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(cli): /bg turns hold their prompts open like the foreground turn
Brooklyn Nicholson553bd72f33ea
diff --git a/hermes_cli/cli_commands_mixin.py b/hermes_cli/cli_commands_mixin.pyindex a1ed54c9b42..506038fde37 100644--- a/hermes_cli/cli_commands_mixin.py+++ b/hermes_cli/cli_commands_mixin.py@@ -1987,6 +1987,9 @@ class CLICommandsMixin:self._app.invalidate()bg_agent.thinking_callback = _bg_thinking+ # /bg prompts paint on this terminal: they wait until answered, like the foreground turn's.+ from tools.approval_context import reset_prompts_wait_for_answer, set_prompts_wait_for_answer+ prompts_token = set_prompts_wait_for_answer()try:result = bg_agent.run_conversation(user_message=prompt, task_id=task_id)response = result.get("final_response", "") if result else ""@@ -1994,6 +1997,7 @@ class CLICommandsMixin:response = _gt("model.error_prefix", error=result["error"])return responsefinally:+ reset_prompts_wait_for_answer(prompts_token)# One agent per /bg task in a long-lived CLI process: close()# is the owner boundary (memory shutdown, tool subprocesses,# httpx clients); an unclosed side agent leaks all of themdiff --git a/tests/hermes_cli/test_cli_approval_ui.py b/tests/hermes_cli/test_cli_approval_ui.pyindex b015dc96e73..a7ee0071b33 100644--- a/tests/hermes_cli/test_cli_approval_ui.py+++ b/tests/hermes_cli/test_cli_approval_ui.py@@ -7,6 +7,7 @@ from unittest.mock import MagicMock, patchimport cli as cli_modulefrom agent.i18n import tfrom cli import HermesCLI+from tools import approval_contextclass _FakeBuffer:@@ -261,6 +262,7 @@ class TestCliApprovalUi:seen["approval"] = _get_approval_callback()seen["sudo"] = _get_sudo_password_callback()+ seen["approval_wait"] = approval_context.approval_wait_seconds()return {"final_response": "done","messages": [],@@ -269,6 +271,7 @@ class TestCliApprovalUi:}with patch("run_agent.AIAgent", FakeAgent), \+ patch.object(approval_context, "_get_approval_config", lambda: {"timeout": 1}), \patch.object(cli_module, "_cprint"), \patch.object(cli_module, "ChatConsole") as chat_console:chat_console.return_value.print = MagicMock()@@ -284,6 +287,8 @@ class TestCliApprovalUi:assert seen["approval"].__func__ is HermesCLI._approval_callbackassert seen["sudo"].__self__ is cliassert seen["sudo"].__func__ is HermesCLI._sudo_password_callback+ # The panel waits until answered, so the turn's accounting must too (not approvals.timeout).+ assert seen["approval_wait"] > 1assert not cli._background_tasks