From 19dada927aa83b8db20d7c430e3c700b4fb02578 Mon Sep 17 00:00:00 2001 From: Your Name Date: Wed, 15 Apr 2026 17:13:27 +0800 Subject: [PATCH] fix: make cron tool schema require message for add action Previously the JSON schema only required "action" but the runtime rejected empty messages, causing LLM retry loops. Making "message" required in the schema prevents the mismatch, and the improved error message guides the LLM to retry with the correct parameters. Fixes #3113 Co-Authored-By: Claude Sonnet 4.6 --- nanobot/agent/tools/cron.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/nanobot/agent/tools/cron.py b/nanobot/agent/tools/cron.py index f0d3ddab..d8f90fd5 100644 --- a/nanobot/agent/tools/cron.py +++ b/nanobot/agent/tools/cron.py @@ -36,7 +36,7 @@ from nanobot.cron.types import CronJob, CronJobState, CronSchedule default=True, ), job_id=StringSchema("Job ID (for remove)"), - required=["action"], + required=["action", "message"], ) ) class CronTool(Tool): @@ -128,7 +128,11 @@ class CronTool(Tool): deliver: bool = True, ) -> str: if not message: - return "Error: message is required for add" + return ( + "Error: cron action='add' requires a non-empty 'message' " + "parameter describing what to do when the job triggers " + "(e.g. the reminder text). Retry including message=\"...\"." + ) if not self._channel or not self._chat_id: return "Error: no session context (channel/chat_id)" if tz and not cron_expr: