perf(agent): prepare prompts outside the event loop (#6224)

* perf(agent): prepare prompts outside the event loop

* fix(agent): preserve cancellation during run cleanup

* refactor(agent): clarify prompt preparation boundaries

* revert(agent): restore original prompt preparation structure

This reverts commit 484cb96a08bf3a805f5828d5a65316be7decaaa5.
This commit is contained in:
chengyongru authored and GitHub committed 2026-10-16 13:16:13 +08:00
1 parent fdeda8a468
commit 3abcfe70c5
6 files changed
+521 -90

No files matched your search

+2 -2
View File
@@ -1,7 +1,6 @@
"""Tests for subagent tool registration and wiring."""
import asyncio
from types import SimpleNamespace
from unittest.mock import AsyncMock, MagicMock, patch
import pytest
@@ -768,7 +767,8 @@ async def test_terminal_drain_reuses_one_timeout_budget(tmp_path):
content="result",
)
fake_loop = SimpleNamespace(time=clock)
fake_loop = MagicMock(wraps=asyncio.get_running_loop())
fake_loop.time = clock
with (
patch("nanobot.agent.loop.asyncio.get_running_loop", return_value=fake_loop),
patch("nanobot.agent.loop.asyncio.wait_for", side_effect=_deliver),