The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
refactor(cron): pass monitor context as a plain kwarg; trim salvage tests to two
teknium1719a420ec61f
diff --git a/cron/scheduler.py b/cron/scheduler.pyindex 4b62ca4685b..37ba122be31 100644--- a/cron/scheduler.py+++ b/cron/scheduler.py@@ -1979,10 +1979,10 @@ def _prepare_job_prompt(return (True, silent_doc, SILENT_MARKER, None), Nonetry:- build_kwargs = {"prerun_script": prerun_script, "extra_prompt": extra_prompt}- if monitor_context:- build_kwargs["runtime_data_prompt"] = monitor_context- prompt = _build_job_prompt(job, **build_kwargs)+ prompt = _build_job_prompt(+ job, prerun_script=prerun_script, extra_prompt=extra_prompt,+ runtime_data_prompt=monitor_context,+ )except CronPromptInjectionBlocked as block_exc:# Injection scanner tripped: refuse this tick and tell the operator WHY.logger.warning(diff --git a/tests/cron/test_cron_prompt_injection_skill.py b/tests/cron/test_cron_prompt_injection_skill.pyindex f630a4b6672..6e0f28d85dc 100644--- a/tests/cron/test_cron_prompt_injection_skill.py+++ b/tests/cron/test_cron_prompt_injection_skill.py@@ -395,17 +395,9 @@ class TestScriptOutputNotStrictScanned:class TestMonitorOutputIsRuntimeData:- """Monitor context is runtime data, not part of the stored user prompt."""-- def test_bidi_monitor_output_is_sanitized_not_blocked(self, cron_env):- _, scheduler = cron_env- prompt = scheduler._build_job_prompt(- {"id": "job-monitor", "name": "WhatsApp", "prompt": "Summarize changes."},- runtime_data_prompt="## Monitor Baseline\n\nWhatsApp: Alice\u202a Work",- )- assert prompt is not None- assert "\u202a" not in prompt- assert "WhatsApp: Alice Work" in prompt+ """Monitor context is runtime data, not part of the stored user prompt (#111523).+ The positive case (bidi data sanitized, job runs) lives in tests/cron/test_monitor_kind.py+ through the real run_job path; this pins the control: the operator's own prompt stays strict."""def test_stored_user_prompt_remains_strict_with_monitor_data(self, cron_env):_, scheduler = cron_envdiff --git a/tests/cron/test_monitor_kind.py b/tests/cron/test_monitor_kind.pyindex 5f281990bfe..07f43f70125 100644--- a/tests/cron/test_monitor_kind.py+++ b/tests/cron/test_monitor_kind.py@@ -294,7 +294,7 @@ def test_first_run_always_runs_agent(hermes_env, monkeypatch):def test_bidi_monitor_output_is_sanitized_before_agent(hermes_env, monkeypatch):- """Runtime monitor data with a WhatsApp-style bidi marker must not block the job."""+ """Runtime monitor data with a WhatsApp-style bidi marker must not block the job (#111523)."""from cron.scheduler import run_jobjob = _make_monitor_job(hermes_env, "printf 'Alice\\342\\200\\252 Work\\n'\n")