Skip to content

Commit 7798c3f

Browse files
tmchowclaude
andcommitted
fix(ce-work-beta): clarify launch vs poll as separate Bash tool calls
In testing, agents merged the background launch and polling loop into one Bash call, hitting the 2-minute timeout. The skill now explicitly labels Step A (launch, run_in_background: true on the tool parameter) and Step B (poll, separate foreground calls) and warns that shell & is not equivalent to the tool parameter. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent f48cc11 commit 7798c3f

1 file changed

Lines changed: 10 additions & 7 deletions

File tree

plugins/compound-engineering/skills/ce-work-beta/references/codex-delegation-workflow.md

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -197,10 +197,11 @@ This intentionally ignores untracked files. Only staged or unstaged modification
197197

198198
If tracked files are dirty, stop and present options: (1) commit current changes, (2) stash explicitly (`git stash push -m "pre-delegation"`), (3) continue in standard mode (sets `delegation_active` to false). Do not auto-stash user changes.
199199

200-
**Delegation invocation:** For each batch:
200+
**Delegation invocation:** For each batch, execute these as **separate Bash tool calls** (not combined into one):
201201

202-
1. Write the prompt file using the Prompt Template above
203-
2. Launch the Codex CLI in the **background** (no timeout ceiling):
202+
**Step A — Launch (background, separate Bash call):**
203+
204+
Write the prompt file, then make a single Bash tool call with `run_in_background: true` set on the tool parameter. This call returns immediately and has no timeout ceiling.
204205

205206
```bash
206207
# Resolve sandbox flag
@@ -219,13 +220,15 @@ codex exec \
219220
- < .context/compound-engineering/codex-delegation/<run-id>/prompt-batch-<batch-num>.md
220221
```
221222

222-
Run this command with `run_in_background: true` so there is no timeout ceiling. Codex batches can take 5-20+ minutes depending on plan size and test-fix iterations.
223+
Critical: `run_in_background: true` must be set as a **Bash tool parameter**, not as a shell `&` suffix. The tool parameter is what removes the timeout ceiling. A shell `&` inside a foreground Bash call still hits the 2-minute default timeout.
223224

224-
Quoting is critical for the `-c` flag: use single quotes around the entire key=value and double quotes around the TOML string value inside. Example: `-c 'model_reasoning_effort="high"'`. The `-m` value does not need special quoting unless the model name contains spaces.
225+
Quoting is critical for the `-c` flag: use single quotes around the entire key=value and double quotes around the TOML string value inside. Example: `-c 'model_reasoning_effort="high"'`.
225226

226227
Do not improvise CLI flags or modify this invocation template.
227228

228-
3. **Poll for completion.** Immediately after launching, enter a foreground polling loop that checks every 10 seconds whether the result file exists. This keeps the agent's turn active so the user cannot interfere with the working tree during delegation.
229+
**Step B — Poll (foreground, separate Bash calls):**
230+
231+
After the launch call returns, make a **new, separate** foreground Bash tool call that polls for the result file. This keeps the agent's turn active so the user cannot interfere with the working tree.
229232

230233
```bash
231234
RESULT_FILE=".context/compound-engineering/codex-delegation/<run-id>/result-batch-<batch-num>.json"
@@ -236,7 +239,7 @@ done
236239
echo "Waiting for Codex..."
237240
```
238241

239-
If the output is "Waiting for Codex...", issue the same polling command again. Repeat until the result file appears. When the output is "DONE", read the result file and proceed to classification.
242+
If the output is "Waiting for Codex...", issue the same polling command again as another separate Bash call. Repeat until the output is "DONE", then read the result file and proceed to classification.
240243

241244
**Result classification:** Codex is responsible for running verification internally and fixing failures before reporting -- the orchestrator does not re-run verification independently.
242245

0 commit comments

Comments
 (0)