Your lightweight open-source personal agent.
Python agent-frameworkai-agentai-agentschatbotchatopsdiscord-botllm-agentsllmslocal-llmmcpmodel-context-protocolmulti-agentopenai-compatibleopenclawpersonal-ai-assistantpythonself-hostedtelegram-bot-ai-assistantwebuiworkflow-automation
test(cron): cover stale instance mutation consistency
yu-xin-c64c7ff5fdcf1
diff --git a/tests/cron/test_cron_service.py b/tests/cron/test_cron_service.pyindex 9a2ed3372..5e58cfbb2 100644--- a/tests/cron/test_cron_service.py+++ b/tests/cron/test_cron_service.py@@ -699,6 +699,36 @@ async def test_external_update_preserves_run_history_records(tmp_path):fresh._save_store()+def test_stale_instance_remove_preserves_external_add(tmp_path) -> None:+ """A stopped instance must not save a stale snapshot over another instance's job."""+ store_path = tmp_path / "cron" / "jobs.json"+ schedule = CronSchedule(kind="every", every_ms=60_000)+ service_a = CronService(store_path)+ service_b = CronService(store_path)++ first = service_a.add_job(+ name="first",+ schedule=schedule,+ message="first",+ **_bound_chat("first"),+ )++ # Prime service_b with a view that does not include later external changes.+ assert [job.name for job in service_b.list_jobs(include_disabled=True)] == ["first"]++ service_a.add_job(+ name="second",+ schedule=schedule,+ message="second",+ **_bound_chat("second"),+ )++ assert service_b.remove_job(first.id) == "removed"++ reloaded = CronService(store_path)+ assert [job.name for job in reloaded.list_jobs(include_disabled=True)] == ["second"]++# ── timer race regression tests ──