The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(cron): honour job workdir on the inline _build_job_prompt script path too
teknium166884c4397ef
diff --git a/cron/scheduler_prompt.py b/cron/scheduler_prompt.pyindex c0e858ea057..400f6200e86 100644--- a/cron/scheduler_prompt.py+++ b/cron/scheduler_prompt.py@@ -222,7 +222,9 @@ def _build_job_prompt(script_path = job.get("script")if script_path:success, script_output = (- prerun_script if prerun_script is not None else _script._run_job_script(script_path))+ prerun_script if prerun_script is not None+ else _script._run_job_script(+ script_path, workdir=_sched._resolve_job_workdir(job, str(job.get("id") or ""))))if success and not script_output:return None # no output → nothing to report, skip the AI callheading, intro = (diff --git a/tests/cron/test_cron_workdir.py b/tests/cron/test_cron_workdir.pyindex 87f8e0ea1fb..dd8505966d4 100644--- a/tests/cron/test_cron_workdir.py+++ b/tests/cron/test_cron_workdir.py@@ -351,3 +351,25 @@ class TestRunJobTerminalCwd:assert success is Trueassert observed["script_workdir"] == str(workdir)+++def test_build_job_prompt_inline_script_receives_configured_workdir(monkeypatch, tmp_path):+ """Callers that skip the wake-gate (no cached ``prerun_script``) run the script inline from+ ``_build_job_prompt``; that path must honour the job's workdir too."""+ from cron import scheduler_prompt, scheduler_script++ workdir = tmp_path / "project"+ workdir.mkdir()+ observed: dict = {}++ def run_script(script_path, workdir=None, cancel_event=None):+ observed["script_workdir"] = workdir+ return True, "collected data"++ monkeypatch.setattr(scheduler_script, "_run_job_script", run_script)+ prompt = scheduler_prompt._build_job_prompt(+ {"id": "inline", "name": "inline", "prompt": "Review.", "script": "collect.py",+ "workdir": str(workdir)})++ assert observed["script_workdir"] == str(workdir)+ assert "collected data" in prompt