refactor: centralize cron session metadata keys

This commit is contained in:
chengyongru
2026-06-12 11:43:23 +08:00
parent 0e3a57b371
commit d9d481bc15
18 changed files with 116 additions and 62 deletions
+3 -2
View File
@@ -10,6 +10,7 @@ from nanobot.agent.tools.cron import CronTool
from nanobot.agent.tools.message import MessageTool
from nanobot.agent.tools.spawn import SpawnTool
from nanobot.cron.service import CronService
from nanobot.session.keys import UNIFIED_SESSION_KEY
@pytest.mark.asyncio
@@ -262,7 +263,7 @@ async def test_webui_cron_tool_uses_unified_session_when_enabled(tmp_path) -> No
"websocket",
"chat-123",
metadata={"webui": True},
session_key="unified:default",
session_key=UNIFIED_SESSION_KEY,
)
result = await tool.execute(action="add", message="standup", every_seconds=300)
@@ -270,7 +271,7 @@ async def test_webui_cron_tool_uses_unified_session_when_enabled(tmp_path) -> No
jobs = tool._cron.list_jobs()
assert len(jobs) == 1
assert jobs[0].payload.session_key == "unified:default"
assert jobs[0].payload.session_key == UNIFIED_SESSION_KEY
@pytest.mark.asyncio