diff --git a/nanobot/webui/session_automations.py b/nanobot/webui/session_automations.py index 19340856..a63cf4da 100644 --- a/nanobot/webui/session_automations.py +++ b/nanobot/webui/session_automations.py @@ -160,7 +160,7 @@ def _origin_payload( title = "" preview = "" - if session_manager is not None: + if channel == "websocket" and session_manager is not None: data = session_manager.read_session_file(session_key) if isinstance(data, dict): title = str(data.get("title") or "") diff --git a/tests/channels/test_websocket_http_routes.py b/tests/channels/test_websocket_http_routes.py index 4ee76da9..8cbbe80c 100644 --- a/tests/channels/test_websocket_http_routes.py +++ b/tests/channels/test_websocket_http_routes.py @@ -832,6 +832,14 @@ async def test_webui_automations_route_lists_all_jobs_and_allows_user_actions( message="Practice English", session_key="unified:default", ) + external_job = cron.add_job( + name="WeChat quiz", + schedule=CronSchedule(kind="every", every_ms=3_600_000), + message="Send a quiz", + session_key="weixin:wx-chat", + origin_channel="weixin", + origin_chat_id="wx-chat", + ) cron.register_system_job( CronJob( id="heartbeat", @@ -840,9 +848,13 @@ async def test_webui_automations_route_lists_all_jobs_and_allows_user_actions( payload=CronPayload(kind="system_event"), ) ) + session_manager = _seed_session(tmp_path, key="websocket:abc") + external_session = Session(key="weixin:wx-chat") + external_session.add_message("user", "Scheduled cron job triggered") + session_manager.save(external_session) channel = _ch( bus, - session_manager=_seed_session(tmp_path, key="websocket:abc"), + session_manager=session_manager, cron_service=cron, cron_pending_job_ids=lambda key: {user_job.id} if key == "websocket:abc" else set(), port=29932, @@ -870,6 +882,8 @@ async def test_webui_automations_route_lists_all_jobs_and_allows_user_actions( assert by_id[user_job.id]["origin"]["preview"] == "hi" assert by_id[legacy_job.id]["payload"]["session_key"] == "unified:default" assert by_id[legacy_job.id]["origin"] is None + assert by_id[external_job.id]["origin"]["session_key"] == "weixin:wx-chat" + assert by_id[external_job.id]["origin"]["preview"] == "" assert by_id["heartbeat"]["protected"] is True disabled = await _http_get( diff --git a/webui/src/components/settings/SettingsView.tsx b/webui/src/components/settings/SettingsView.tsx index c9b3ef9d..39e80249 100644 --- a/webui/src/components/settings/SettingsView.tsx +++ b/webui/src/components/settings/SettingsView.tsx @@ -13,7 +13,6 @@ import { ArrowUpCircle, Bot, Brain, - CalendarClock, Check, CircleAlert, ChevronDown, @@ -3390,23 +3389,14 @@ function AutomationsSettings({ return (
-
-
-
- - {tx("settings.automations.kicker", "Workspace automations")} -
-

- {tx("settings.automations.title", "Automations")} -

-

- {tx( - "settings.automations.description", - "Review cron reminders, recurring agent turns, one-time jobs, and protected system automations in one place.", - )} -

-
-
+
+

+ {tx( + "settings.automations.description", + "Review cron reminders, recurring agent turns, one-time jobs, and protected system jobs.", + )} +

+