Skip to content

The agent that grows with you

fix: remove dead code, deduplicate error constants, fix skill key check

kshitijk4poor0eda2ba0c835
diff --git a/cron/jobs.py b/cron/jobs.py
index 1e305103fde..173034f7c7b 100644
--- a/cron/jobs.py
+++ b/cron/jobs.py
@@ -523,14 +523,6 @@ NO_AGENT_WITHOUT_SCRIPT_ERROR = (
)
-def job_no_agent_without_script(job: Dict[str, Any]) -> bool:
- """True when a job record claims ``no_agent`` but has no usable script.
-
- The script IS the job in no_agent mode, so this shape can never run.
- """
- return bool(job.get("no_agent")) and not _coerce_job_text(job.get("script")).strip()
-
-
def job_payload_is_empty(job: Dict[str, Any]) -> bool:
"""True when a job record has nothing runnable at all.
@@ -545,7 +537,7 @@ def job_payload_is_empty(job: Dict[str, Any]) -> bool:
if _normalize_skill_list(job.get("skill"), job.get("skills")):
return False
# Only flag if at least one payload field is explicitly present in the record
- if "prompt" in job or "script" in job or "skills" in job:
+ if "prompt" in job or "script" in job or "skill" in job or "skills" in job:
return True
return False
@@ -1917,10 +1909,7 @@ def _validate_job_mode_invariants(
"based on source changes. Use a plain no_agent script job instead."
)
if no_agent and not script:
- raise ValueError(
- "no_agent=True requires a script — with no agent and no script "
- "there is nothing for the job to run."
- )
+ raise ValueError(NO_AGENT_WITHOUT_SCRIPT_ERROR)
def create_job(
diff --git a/cron/scheduler.py b/cron/scheduler.py
index 1c80add037b..e4498ad34fd 100644
--- a/cron/scheduler.py
+++ b/cron/scheduler.py
@@ -5225,13 +5225,13 @@ def run_job(
# otherwise wake the LLM with an empty instruction on every fire. Pause
# the job so it stops being scheduled, and never construct the agent.
# ---------------------------------------------------------------
- from cron.jobs import job_payload_is_empty
+ from cron.jobs import EMPTY_PAYLOAD_ERROR, job_payload_is_empty
if job_payload_is_empty(job):
return _block_and_pause_job(
job_id,
job_name,
- "Cron job has nothing to run: prompt is blank and no script or skills are set",
+ EMPTY_PAYLOAD_ERROR,
)
# ---------------------------------------------------------------