Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions run_agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -5140,6 +5140,7 @@ def _dispatch_delegate_task(self, function_args: dict) -> str:
acp_command=function_args.get("acp_command"),
acp_args=function_args.get("acp_args"),
role=function_args.get("role"),
background=function_args.get("background"),
parent_agent=self,
)

Expand Down
16 changes: 16 additions & 0 deletions tests/run_agent/test_run_agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,22 @@ def agent_with_memory_tool():
return a


def test_dispatch_delegate_task_forwards_background_flag(agent):
"""AIAgent's delegate_task dispatch must preserve async background requests."""
with patch("tools.delegate_tool.delegate_task", return_value="ok") as mock_delegate:
assert agent._dispatch_delegate_task(
{
"goal": "slow background task",
"context": "context",
"toolsets": ["web"],
"role": "leaf",
"background": True,
}
) == "ok"

assert mock_delegate.call_args.kwargs["background"] is True


def test_aiagent_reuses_existing_errors_log_handler():
"""Repeated AIAgent init should not accumulate duplicate errors.log handlers."""
root_logger = logging.getLogger()
Expand Down