The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
Port from paradigmxyz/centaur#1479: cron runs no longer re-schedule themselves from recurring prompt language
Teknium0877decd1b13
diff --git a/cron/scheduler_prompt.py b/cron/scheduler_prompt.pyindex 400f6200e86..586a791ded0 100644--- a/cron/scheduler_prompt.py+++ b/cron/scheduler_prompt.py@@ -196,7 +196,12 @@ _CRON_HINT = ("SILENT: If there is genuinely nothing new to report, respond ""with exactly \"[SILENT]\" (nothing else) to suppress delivery. ""Never combine [SILENT] with content — either report your "- "findings normally, or say [SILENT] and nothing more.]\n\n"+ "findings normally, or say [SILENT] and nothing more. "+ "RECURSION: This is a run of an EXISTING scheduled job — execute "+ "the task now. NEVER create or update a cron job because of "+ "recurring or future-schedule language in the task prompt below; "+ "treat phrasing like \"each Monday\" or \"every day at 9\" as "+ "context for this run, not as a request to schedule another job.]\n\n")diff --git a/tests/cron/test_scheduler.py b/tests/cron/test_scheduler.pyindex 029040b6132..ce7c554fadb 100644--- a/tests/cron/test_scheduler.py+++ b/tests/cron/test_scheduler.py@@ -1679,6 +1679,32 @@ class TestBuildJobPromptSilentHint:assert "Check for updates" in result+class TestBuildJobPromptRecursionGuard:+ """Verify _build_job_prompt tells the agent this is an execution, not a+ request to schedule — recurring language in a task prompt must not spawn+ another cron job (recursive scheduled tasks)."""++ def test_recursion_guard_always_present(self):+ job = {"prompt": "Check for updates"}+ result = _build_job_prompt(job)+ assert "run of an EXISTING scheduled job" in result+ assert "NEVER create or update a cron job" in result++ def test_recurring_language_treated_as_context(self):+ job = {+ "prompt": (+ "Each Monday, review my calendar for the upcoming "+ "Monday-through-Sunday week and summarize it."+ )+ }+ result = _build_job_prompt(job)+ # The guard precedes the task prompt so the model reads it first.+ guard_pos = result.index("run of an EXISTING scheduled job")+ task_pos = result.index("Each Monday, review my calendar")+ assert guard_pos < task_pos+ assert 'phrasing like "each Monday"' in result++class TestParseWakeGate:"""Unit tests for _parse_wake_gate — pure function, no side effects."""