refactor(sessions)!: retire the global shared session (#6621)

Co-authored-by: chengyongru <chengyongru.ai@gmail.com>
This commit is contained in:
Xubin Renandchengyongru authored and GitHub committed 2026-11-12 09:55:55 +08:00
1 parent 28d73b6942
commit e6b0aec2a8
77 files changed
+311 -1255

No files matched your search

+3 -4
View File
@@ -13,7 +13,6 @@ from nanobot.agent.tools.subagent import SubagentTool
from nanobot.cron.service import CronService
from nanobot.providers.base import GenerationSettings, LLMProvider
from nanobot.runtime_context import RUNTIME_CONTEXT_INPUT_META, RuntimeContextBlock
from nanobot.session.keys import UNIFIED_SESSION_KEY
from nanobot.utils.llm_runtime import LLMRuntime
@@ -281,7 +280,7 @@ async def test_cron_tool_basic_request_context_and_execute(tmp_path) -> None:
@pytest.mark.asyncio
async def test_webui_cron_tool_uses_origin_session_when_unified_enabled(tmp_path) -> None:
async def test_webui_cron_tool_binds_origin_chat(tmp_path) -> None:
tool = CronTool(CronService(tmp_path / "jobs.json"))
with request_context(
@@ -289,7 +288,7 @@ async def test_webui_cron_tool_uses_origin_session_when_unified_enabled(tmp_path
channel="websocket",
chat_id="chat-123",
metadata={"webui": True},
session_key=UNIFIED_SESSION_KEY,
session_key="websocket:chat-123",
)
):
result = await tool.execute(action="add", message="standup", every_seconds=300)
@@ -321,7 +320,7 @@ async def test_cron_tool_snapshots_only_persistable_request_metadata(tmp_path) -
],
"opaque": object(),
},
session_key=UNIFIED_SESSION_KEY,
session_key="websocket:chat-123",
)
):
result = await tool.execute(action="add", message="standup", every_seconds=300)