fix: show websocket cron jobs in automations

This commit is contained in:
chengyongru
2026-06-11 23:53:45 +08:00
parent 3725b42e0e
commit 8dac6b2889
3 changed files with 38 additions and 24 deletions
+7 -5
View File
@@ -189,7 +189,7 @@ async def test_session_automations_route_filters_by_webui_session(
cron.add_job(
name="Legacy same target",
schedule=hourly,
message="Legacy job should not be treated as bound",
message="Legacy job should still show in WebUI",
deliver=True,
channel="websocket",
to="abc",
@@ -227,11 +227,15 @@ async def test_session_automations_route_filters_by_webui_session(
assert resp.status_code == 200
body = resp.json()
assert [job["name"] for job in body["jobs"]] == ["Morning check"]
assert [job["name"] for job in body["jobs"]] == [
"Morning check",
"Legacy same target",
]
job = body["jobs"][0]
assert job["schedule"]["kind"] == "every"
assert job["schedule"]["every_ms"] == 3_600_000
assert job["payload"]["message"] == "Check the project status"
assert body["jobs"][1]["payload"]["message"] == "Legacy job should still show in WebUI"
finally:
await channel.stop()
await server_task
@@ -743,9 +747,7 @@ async def test_session_delete_can_cascade_bound_automations(
assert resp.json()["deleted"] is True
assert not path.exists()
assert cron.list_bound_agent_jobs_for_session("websocket:doomed") == []
assert [job.name for job in cron.list_jobs(include_disabled=True)] == [
"Legacy same target"
]
assert cron.list_jobs(include_disabled=True) == []
finally:
await channel.stop()
await server_task