Skip to content

The agent that grows with you

fix(cron): drop the is_cron_silence_response alias; trim tests to three invariants

teknium16bbfd63ae410
diff --git a/cron/scheduler.py b/cron/scheduler.py
index 6fcbe0e9647..fd4351cbdfa 100644
--- a/cron/scheduler.py
+++ b/cron/scheduler.py
@@ -510,11 +510,6 @@ def _is_cron_silence_response(text: str) -> bool:
return is_autonomous_silence_response(text)
-
-# Public alias for sibling split modules: ``scheduler_prompt`` reaches this late-bound instead
-# of poking the private name, so a rename of the private helper cannot break it silently.
-is_cron_silence_response = _is_cron_silence_response
-
# Persistent pool for parallel cron jobs: tick() submits and returns; long jobs never block it.
_parallel_pool: Optional[concurrent.futures.ThreadPoolExecutor] = None
_parallel_pool_max_workers: Optional[int] = None
diff --git a/cron/scheduler_prompt.py b/cron/scheduler_prompt.py
index dacf71247ed..4050c7ab57c 100644
--- a/cron/scheduler_prompt.py
+++ b/cron/scheduler_prompt.py
@@ -78,7 +78,7 @@ def _archive_answer(archive: str) -> str | None:
if "## Response" not in archive:
return archive
answer = archive.rpartition("## Response")[2].strip()
- if not answer or _sched.is_cron_silence_response(answer):
+ if not answer or _sched._is_cron_silence_response(answer):
return None
return answer
diff --git a/tests/cron/test_context_from_response_extraction.py b/tests/cron/test_context_from_response_extraction.py
index 2b4b5216f9e..b87be964261 100644
--- a/tests/cron/test_context_from_response_extraction.py
+++ b/tests/cron/test_context_from_response_extraction.py
@@ -83,92 +83,6 @@ class TestUnusableAnswersFallThrough:
assert "OLDER-REAL-ANSWER" in prompt
assert "[SILENT]" not in prompt
- def test_blank_response_falls_through_to_older_archive(self, cron_env):
- from cron.jobs import create_job
- from cron.scheduler_prompt import _inject_context_from
-
- job = create_job(prompt="Report", schedule="0 8 * * *", context_from="self")
- _write_archive(
- cron_env, job["id"], "2026-09-18_08-00-00.md",
- "# Cron Job: probe\n\n## Prompt\n\ndo the thing\n\n## Response\n\nOLDER-REAL-ANSWER\n",
- )
- _write_archive(
- cron_env, job["id"], "2026-09-19_08-00-00.md",
- "# Cron Job: probe\n\n## Prompt\n\ndo the thing\n\n## Response\n\n",
- )
-
- prompt, injected = _inject_context_from(job, "Report")
-
- assert injected is True
- assert "OLDER-REAL-ANSWER" in prompt
-
- def test_all_unusable_archives_inject_nothing(self, cron_env):
- from cron.jobs import create_job
- from cron.scheduler_prompt import _inject_context_from
-
- job = create_job(prompt="Report", schedule="0 8 * * *", context_from="self")
- _write_archive(
- cron_env, job["id"], "2026-09-19_08-00-00.md",
- "# Cron Job: probe\n\n## Prompt\n\ndo the thing\n\n## Response\n\n[SILENT]\n",
- )
-
- prompt, injected = _inject_context_from(job, "Report")
-
- assert injected is False
- assert prompt == "Report"
-
-
-class TestPromptHalfCarryingTheHeading:
- """The assembled prompt half can itself contain a literal ``## Response`` heading
- (a skill documenting its response format, an injected previous answer quoting it).
- The writer appends the response section last, so the LAST occurrence is the
- boundary — an early split would inject the prompt tail plus the answer."""
-
- def test_heading_inside_prompt_half_does_not_split_early(self, cron_env):
- from cron.jobs import create_job
- from cron.scheduler import _build_job_prompt
-
- job = create_job(prompt="Run the daily check", schedule="0 8 * * *", context_from="self")
- _write_archive(
- cron_env, job["id"], "2026-09-19_08-00-00.md",
- "# Cron Job: probe\n\n## Prompt\n\n"
- "Use this format:\n\n## Response\n\nSKILL-DOCUMENTED-FORMAT\n"
- "\nEnd of format spec.\n\n## Response\n\nREAL-RUN-ANSWER-7\n",
- )
-
- prompt = _build_job_prompt(job)
-
- assert "REAL-RUN-ANSWER-7" in prompt
- assert "SKILL-DOCUMENTED-FORMAT" not in prompt # prompt-half copy is dropped
-
-
-class TestBracketlessSilenceFallsThrough:
- """The delivery lane suppresses more than the literal ``[SILENT]`` — bracketless
- ``SILENT`` / ``NO_REPLY`` forms too (#46917, #51438). An archive whose answer is one
- of those forms carries no usable continuity either, and must not be injected."""
-
- @pytest.mark.parametrize("silent_answer", ["SILENT", "NO_REPLY", "[SILENT] No changes today"])
- def test_bracketless_silent_answer_falls_through(self, cron_env, silent_answer):
- from cron.jobs import create_job
- from cron.scheduler_prompt import _inject_context_from
-
- job = create_job(prompt="Report", schedule="0 8 * * *", context_from="self")
- _write_archive(
- cron_env, job["id"], "2026-09-18_08-00-00.md",
- "# Cron Job: probe\n\n## Prompt\n\ndo the thing\n\n## Response\n\nOLDER-REAL-ANSWER\n",
- )
- _write_archive(
- cron_env, job["id"], "2026-09-19_08-00-00.md",
- "# Cron Job: probe\n\n## Prompt\n\ndo the thing\n\n## Response\n\n" + silent_answer + "\n",
- )
-
- prompt, injected = _inject_context_from(job, "Report")
-
- assert injected is True
- assert "OLDER-REAL-ANSWER" in prompt
- assert silent_answer not in prompt
-
-
class TestScriptModeArchives:
"""Archives without a ## Response heading (script-mode) stay whole-document."""
@@ -184,45 +98,3 @@ class TestScriptModeArchives:
assert injected is True
assert "plain script payload" in prompt
assert "line two" in prompt
-
-
-class TestBudgetClipping:
- """An oversized answer clips head+tail — conclusions sit at the end."""
-
- def test_oversized_answer_clips_head_and_tail(self, cron_env):
- from cron.jobs import create_job
- from cron.scheduler_prompt import _inject_context_from, _MAX_CONTEXT_CHARS
-
- job = create_job(prompt="Report", schedule="0 8 * * *", context_from="self")
- long_answer = "HEAD-" + "filler line\n" * 1200 + "TAIL-CONCLUSION"
- assert len(long_answer) > _MAX_CONTEXT_CHARS
- _write_archive(
- cron_env, job["id"], "2026-09-19_08-00-00.md",
- "# Cron Job: probe\n\n## Prompt\n\nshort\n\n## Response\n\n" + long_answer,
- )
-
- prompt, injected = _inject_context_from(job, "Report")
-
- assert injected is True
- assert "HEAD-" in prompt
- assert "TAIL-CONCLUSION" in prompt
- assert "chars omitted" in prompt
-
- block = prompt.split("## Your previous run's output", 1)[-1] if "## Your previous run's output" in prompt else prompt
- assert len(block) < _MAX_CONTEXT_CHARS + 400 # clipped, not whole
-
- def test_short_answer_injects_verbatim(self, cron_env):
- from cron.jobs import create_job
- from cron.scheduler_prompt import _inject_context_from
-
- job = create_job(prompt="Report", schedule="0 8 * * *", context_from="self")
- _write_archive(
- cron_env, job["id"], "2026-09-19_08-00-00.md",
- "# Cron Job: probe\n\n## Prompt\n\ndo the thing\n\n## Response\n\nAll quiet.\n",
- )
-
- prompt, injected = _inject_context_from(job, "Report")
-
- assert injected is True
- assert "All quiet." in prompt
- assert "do the thing" not in prompt # only the answer is injected