feat(subagent): add session-owned task messaging and cancellation (#5985)
let's go!
This commit is contained in:
1 parent
f75470e72f
commit
6ff96f2a8f
93 files changed
+5632
-1156
No files matched your search
@@ -6,7 +6,6 @@ import asyncio
|
||||
import os
|
||||
import re
|
||||
import threading
|
||||
import time
|
||||
from pathlib import Path
|
||||
from types import SimpleNamespace
|
||||
from unittest.mock import AsyncMock, MagicMock
|
||||
@@ -15,7 +14,7 @@ import pytest
|
||||
|
||||
from nanobot.agent.loop import AgentLoop
|
||||
from nanobot.agent.memory import Consolidator
|
||||
from nanobot.agent.subagent import SubagentManager, SubagentStatus
|
||||
from nanobot.agent.subagent import SubagentManager
|
||||
from nanobot.agent.tools.registry import is_tool_error_result
|
||||
from nanobot.agent.tools.search import FindFilesTool, GrepTool
|
||||
from nanobot.agent.tools.web import WebSearchTool
|
||||
@@ -801,15 +800,14 @@ async def test_subagent_registers_search_backend(tmp_path: Path, monkeypatch, us
|
||||
mgr.runner.run = fake_run
|
||||
mgr._announce_result = AsyncMock()
|
||||
|
||||
status = SubagentStatus(task_id="sub-1", label="label", task_description="search task", started_at=time.monotonic())
|
||||
await mgr._run_subagent(
|
||||
"sub-1",
|
||||
"search task",
|
||||
"label",
|
||||
{"channel": "cli", "chat_id": "direct"},
|
||||
status,
|
||||
LLMRuntime.capture(provider, "test-model", context_window_tokens=128_000),
|
||||
await mgr.spawn(
|
||||
task="search task",
|
||||
label="label",
|
||||
origin_channel="cli",
|
||||
origin_chat_id="direct",
|
||||
runtime=LLMRuntime.capture(provider, "test-model", context_window_tokens=128_000),
|
||||
)
|
||||
await asyncio.gather(*mgr._running_tasks.values(), return_exceptions=True)
|
||||
|
||||
assert ("rg" in captured["tool_names"]) == use_rg
|
||||
assert ("find_files" in captured["tool_names"]) == (not use_rg)
|
||||
|
||||
Reference in new issue
Block a user