fix(cron): prevent unbound automation execution

This commit is contained in:
chengyongru
2026-06-16 14:07:08 +08:00
parent 04545b95d9
commit 6239114c46
5 changed files with 140 additions and 1 deletions
+3
View File
@@ -24,6 +24,7 @@ from websockets.http11 import Request as WsRequest
from websockets.http11 import Response
from nanobot.command.builtin import builtin_command_palette
from nanobot.cron.session_turns import is_bound_cron_job
from nanobot.cron.types import CronJob, CronSchedule
from nanobot.utils.subagent_channel_display import scrub_subagent_messages_for_channel
from nanobot.webui.file_preview import WebUIFilePreviewError, file_preview_payload
@@ -579,6 +580,8 @@ class GatewayHTTPHandler:
return _http_error(404, "automation not found")
if job.payload.kind == "system_event":
return _http_error(403, "system automation is protected")
if action in {"enable", "run"} and not is_bound_cron_job(job):
return _http_error(409, "automation has no linked chat")
if action == "enable":
if self.cron_service.enable_job(job_id, enabled=True) is None: