From 92fc6e5d680b022248ab23dcdd6d539bbea3fa47 Mon Sep 17 00:00:00 2001 From: ReachableCEO Date: Wed, 15 Oct 2025 17:31:52 -0500 Subject: [PATCH] fix(input): invoke codex exec with stdin --- input/Docker/watch_and_customize.py | 29 +++++++++++++---------------- 1 file changed, 13 insertions(+), 16 deletions(-) diff --git a/input/Docker/watch_and_customize.py b/input/Docker/watch_and_customize.py index dac7fc0..55d1c94 100644 --- a/input/Docker/watch_and_customize.py +++ b/input/Docker/watch_and_customize.py @@ -184,23 +184,26 @@ def slugify(component: str) -> str: return "-".join(parts) -def run_codex(prompt_path: Path, output_path: Path) -> None: - """Execute the Codex CLI.""" +def run_codex(prompt_text: str, output_path: Path) -> None: + """Execute the Codex CLI with the provided prompt text.""" + output_path.parent.mkdir(parents=True, exist_ok=True) + command = [ "codex", - "prompt", - "--input", - str(prompt_path), - "--output", + "exec", + "-", + "--output-last-message", str(output_path), - "--format", - "markdown", + "--skip-git-repo-check", + "--sandbox", + "read-only", ] logging.info("Running Codex CLI command: %s", " ".join(command)) try: subprocess.run( command, + input=prompt_text.encode("utf-8"), check=True, timeout=CODEX_TIMEOUT_SECONDS, env=os.environ.copy(), @@ -287,11 +290,8 @@ def normalize_job_description(job_file: Path) -> NormalizedJobDescription: with TemporaryDirectory() as tmp_dir_str: tmp_dir = Path(tmp_dir_str) - prompt_path = tmp_dir / "normalize_prompt.md" - prompt_path.write_text(prompt_text, encoding="utf-8") - output_path = tmp_dir / "normalize_output.md" - run_codex(prompt_path, output_path) + run_codex(prompt_text, output_path) normalized_text = output_path.read_text(encoding="utf-8").strip() return parse_normalized_output(normalized_text) @@ -342,11 +342,8 @@ def process_job(job_file: Path) -> None: with TemporaryDirectory() as tmp_dir_str: tmp_dir = Path(tmp_dir_str) - prompt_path = tmp_dir / "prompt.md" - prompt_path.write_text(prompt_text, encoding="utf-8") - output_path = tmp_dir / "codex_output.md" - run_codex(prompt_path, output_path) + run_codex(prompt_text, output_path) generated_output = out_dir / output_filename counter = 1