From eef6ba797f6e359e467d72b59fd83011225de82d Mon Sep 17 00:00:00 2001 From: John Preston Date: Fri, 13 Mar 2026 17:28:09 +0400 Subject: [PATCH] [ai] Fix Codex child agents execution. --- .agents/skills/task-think/PROMPTS.md | 44 ++++++++++++++++++++++------ .agents/skills/task-think/SKILL.md | 16 +++++++++- 2 files changed, 50 insertions(+), 10 deletions(-) diff --git a/.agents/skills/task-think/PROMPTS.md b/.agents/skills/task-think/PROMPTS.md index ad804219a4..f41dea7342 100644 --- a/.agents/skills/task-think/PROMPTS.md +++ b/.agents/skills/task-think/PROMPTS.md @@ -437,18 +437,44 @@ When all phases including build verification and code review are done: - If build errors persist after the build phase's attempts, report the remaining errors to the user. - If a review fix phase introduces new build errors that it cannot resolve, report to the user. -## Reasoning Effort +## Model And Reasoning -Phases 2 (Plan), 3 (Assessment), and 6a (Review) require elevated reasoning. Pass `-c model_reasoning_effort="xhigh"` on those `codex exec` invocations. All other phases use the default reasoning effort. +All child sessions must use: +- `--model gpt-5.4` +- `-c model_reasoning_effort="xhigh"` + +Use the same settings for every phase, including setup, implementation, build verification, and review-fix runs. + +## Prompt Delivery + +Phase prompts can be large and contain complex formatting. Do not inline them as a quoted CLI argument. For each phase: +1. Write the full prompt to a file in `.ai///logs/phase-.prompt.md` +2. Pipe the file contents into `codex exec` with `Get-Content -Raw | codex exec ... -` +3. Save the JSONL stream to the matching `phase-.jsonl` + +If a sandboxed child launch fails with `Access is denied` in Codex desktop, retry the same command through an escalated shell invocation before falling back to same-session execution. ## Example Runner Commands ```powershell -codex exec --json -C "" | Tee-Object .ai///logs/phase-1-context.jsonl -codex exec --json -C -c model_reasoning_effort="xhigh" "" | Tee-Object .ai///logs/phase-2-plan.jsonl -codex exec --json -C -c model_reasoning_effort="xhigh" "" | Tee-Object .ai///logs/phase-3-assess.jsonl -codex exec --json -C "" | Tee-Object .ai///logs/phase-4-impl-N.jsonl -codex exec --json -C "" | Tee-Object .ai///logs/phase-5-build.jsonl -codex exec --json -C -c model_reasoning_effort="xhigh" "" | Tee-Object .ai///logs/phase-6a-review-R.jsonl -codex exec --json -C "" | Tee-Object .ai///logs/phase-6b-fix-R.jsonl +$PromptFile = ".ai///logs/phase-1-context.prompt.md" +Get-Content -Raw $PromptFile | codex exec --json --full-auto --model gpt-5.4 -c model_reasoning_effort="xhigh" -C - | Tee-Object .ai///logs/phase-1-context.jsonl + +$PromptFile = ".ai///logs/phase-2-plan.prompt.md" +Get-Content -Raw $PromptFile | codex exec --json --full-auto --model gpt-5.4 -c model_reasoning_effort="xhigh" -C - | Tee-Object .ai///logs/phase-2-plan.jsonl + +$PromptFile = ".ai///logs/phase-3-assess.prompt.md" +Get-Content -Raw $PromptFile | codex exec --json --full-auto --model gpt-5.4 -c model_reasoning_effort="xhigh" -C - | Tee-Object .ai///logs/phase-3-assess.jsonl + +$PromptFile = ".ai///logs/phase-4-impl-N.prompt.md" +Get-Content -Raw $PromptFile | codex exec --json --full-auto --model gpt-5.4 -c model_reasoning_effort="xhigh" -C - | Tee-Object .ai///logs/phase-4-impl-N.jsonl + +$PromptFile = ".ai///logs/phase-5-build.prompt.md" +Get-Content -Raw $PromptFile | codex exec --json --full-auto --model gpt-5.4 -c model_reasoning_effort="xhigh" -C - | Tee-Object .ai///logs/phase-5-build.jsonl + +$PromptFile = ".ai///logs/phase-6a-review-R.prompt.md" +Get-Content -Raw $PromptFile | codex exec --json --full-auto --model gpt-5.4 -c model_reasoning_effort="xhigh" -C - | Tee-Object .ai///logs/phase-6a-review-R.jsonl + +$PromptFile = ".ai///logs/phase-6b-fix-R.prompt.md" +Get-Content -Raw $PromptFile | codex exec --json --full-auto --model gpt-5.4 -c model_reasoning_effort="xhigh" -C - | Tee-Object .ai///logs/phase-6b-fix-R.jsonl ``` diff --git a/.agents/skills/task-think/SKILL.md b/.agents/skills/task-think/SKILL.md index 3f332e7887..ba68f01d9b 100644 --- a/.agents/skills/task-think/SKILL.md +++ b/.agents/skills/task-think/SKILL.md @@ -72,7 +72,21 @@ Use the phase prompt templates in `PROMPTS.md`. Run `codex exec --json` child sessions for each phase. Wait for each to finish before starting the next. After each phase, validate that the expected artifact file exists and has substantive content. -Phases that require elevated reasoning (Planning, Plan Assessment, Code Review) must use `-c model_reasoning_effort="xhigh"`. See example commands in `PROMPTS.md`. +Every child session must use: +- `--model gpt-5.4` +- `-c model_reasoning_effort="xhigh"` + +Do not pass long or complex phase prompts as a quoted command-line argument. Instead: +- Write the full phase prompt to a per-phase prompt file under `.ai///logs/` +- Pipe that file into `codex exec` with `Get-Content -Raw | codex exec ... -` +- Save the JSONL transcript to the matching `phase-*.jsonl` log file + +When running inside Codex desktop on Windows, a child `codex exec` may fail inside the normal agent sandbox with `Access is denied` even though the command itself is valid. If that happens: +- Re-run the same `codex exec` invocation through an escalated shell tool call +- Do not treat the first sandboxed launch failure as a phase failure +- Fall back to direct main-session execution only if escalated child execution is unavailable or denied + +Use the phase prompt templates and runner patterns in `PROMPTS.md`. ## Verification Rules