Revert "fix(cli): /bg turns hold their prompts open like the foreground turn"
This reverts commit 553bd72f33.
This commit is contained in:
@@ -1990,9 +1990,6 @@ 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 ""
|
||||
@@ -2000,7 +1997,6 @@ class CLICommandsMixin:
|
||||
response = _gt("model.error_prefix", error=result["error"])
|
||||
return response
|
||||
finally:
|
||||
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 them
|
||||
|
||||
@@ -7,7 +7,6 @@ from unittest.mock import MagicMock, patch
|
||||
import cli as cli_module
|
||||
from agent.i18n import t
|
||||
from cli import HermesCLI
|
||||
from tools import approval_context
|
||||
|
||||
|
||||
class _FakeBuffer:
|
||||
@@ -262,7 +261,6 @@ 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": [],
|
||||
@@ -271,7 +269,6 @@ 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()
|
||||
@@ -287,8 +284,6 @@ class TestCliApprovalUi:
|
||||
assert seen["approval"].__func__ is HermesCLI._approval_callback
|
||||
assert seen["sudo"].__self__ is cli
|
||||
assert 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"] > 1
|
||||
assert not cli._background_tasks
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user