fix: keep session automations bound-only

This commit is contained in:
chengyongru
2026-06-12 00:15:57 +08:00
parent 369237f6a8
commit 29f1473940
2 changed files with 15 additions and 27 deletions
+5 -7
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 still show in WebUI",
message="Legacy job should not be treated as bound",
deliver=True,
channel="websocket",
to="abc",
@@ -227,15 +227,11 @@ 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",
"Legacy same target",
]
assert [job["name"] for job in body["jobs"]] == ["Morning check"]
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
@@ -747,7 +743,9 @@ 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 cron.list_jobs(include_disabled=True) == []
assert [job.name for job in cron.list_jobs(include_disabled=True)] == [
"Legacy same target"
]
finally:
await channel.stop()
await server_task