-
Notifications
You must be signed in to change notification settings - Fork 969
fix(ce-work-beta): document Codex exec pitfalls for delegation #365
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
7a8978c
fc42fcb
eaeaa0e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,43 @@ | ||
| --- | ||
| title: "fix: add explicit stdin piping guidance for Codex delegation" | ||
| type: fix | ||
| status: active | ||
| date: 2026-03-24 | ||
| --- | ||
|
|
||
| # fix: add explicit stdin piping guidance for Codex delegation | ||
|
|
||
| ## Problem | ||
|
|
||
| When ce:work-beta delegates to Codex CLI, the skill says "piping the prompt file via stdin" but provides no concrete command example. The agent interprets this as a shell redirect: | ||
|
|
||
| ```bash | ||
| codex --dangerously-bypass-approvals-and-sandbox < /tmp/codex_task_20980.txt 2>&1 | ||
| ``` | ||
|
|
||
| This fails with: | ||
|
|
||
| ``` | ||
| Error: Exit code 1 | ||
| Error: stdin is not a terminal | ||
| ``` | ||
|
|
||
| Codex CLI checks whether stdin is a terminal (likely `isatty()`) and rejects shell redirects (`< file`). A pipe (`cat file | codex`) works because it presents data differently to the process. | ||
|
|
||
| ## Approach | ||
|
|
||
| In step 5 ("Delegate") of the External Delegate Mode section in `ce-work-beta/SKILL.md`, add: | ||
|
|
||
| 1. A concrete command example using `cat file | codex ...` | ||
| 2. An explicit warning that `< file` (shell redirect) does NOT work -- Codex rejects it with "stdin is not a terminal" | ||
| 3. Keep the existing note about avoiding argv expansion for large prompts | ||
|
|
||
| ## Files | ||
|
|
||
| - `plugins/compound-engineering/skills/ce-work-beta/SKILL.md` -- step 5 of External Delegate Mode | ||
|
|
||
| ## Acceptance Criteria | ||
|
|
||
| - [ ] Step 5 contains a concrete `cat ... | codex exec ...` command example with placeholder flags from step 2 | ||
| - [ ] Explicit warning: shell redirects (`< file`) fail with "stdin is not a terminal" | ||
| - [ ] Existing guidance about avoiding argv expansion is preserved |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -472,7 +472,23 @@ When external delegation is active, follow this workflow for each tagged task. D | |
|
|
||
| 3. **Write prompt to file** — Save the assembled prompt to a unique temporary file to avoid shell quoting issues and cross-task races. Use a unique filename per task. | ||
|
|
||
| 4. **Delegate** — Run the delegate CLI, piping the prompt file via stdin (not argv expansion, which hits `ARG_MAX` on large prompts). Omit the model flag to use the delegate's default model, which stays current without manual updates. | ||
| 4. **Delegate** — Run `codex exec` with the prompt piped via stdin. Use `exec` (not bare `codex`) for non-interactive delegation. Omit the model flag to use the delegate's default model, which stays current without manual updates. | ||
|
|
||
| ```bash | ||
| cat /tmp/codex-task-XXXXX.txt | codex exec --skip-git-repo-check - 2>&1 | ||
| ``` | ||
|
|
||
| **Codex exec pitfalls (all discovered during testing):** | ||
|
|
||
| | Pitfall | Error you get | Fix | | ||
| |---------|--------------|-----| | ||
| | Shell redirect `< file` instead of pipe | "stdin is not a terminal" | Use `cat file \| codex exec ...` | | ||
| | Bare `codex` instead of `codex exec` | Enters interactive mode, hangs | Use `codex exec` for non-interactive delegation | | ||
| | `--approval-mode` flag on `exec` | "unexpected argument" | `exec` has its own flags; `--approval-mode` is for bare `codex` only | | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
The new pitfalls row says to avoid Useful? React with 👍 / 👎. |
||
| | Running outside a git repo | "Not inside a trusted directory" | Add `--skip-git-repo-check` flag | | ||
| | Forgetting `-` at end | Prompt not read from stdin | Trailing `-` tells `codex exec` to read the prompt from stdin | | ||
|
|
||
| Piping also avoids `ARG_MAX` limits that would occur if passing the prompt as a CLI argument. | ||
|
|
||
| 5. **Review diff** — After the delegate finishes, verify the diff is non-empty and in-scope. Run the project's test/lint commands. If the diff is empty or out-of-scope, fall back to standard mode for that task. | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This adds
cat /tmp/codex-task-XXXXX.txt | codex exec --skip-git-repo-check - 2>&1, butplugins/compound-engineering/AGENTS.mdexplicitly requires shell examples in skills to avoid chaining, pipes, and redirects. Because plugin skills are copied across platforms, this shell-specific pipeline can fail in runners that execute commands as argv (without shell parsing), causing the delegation step to break instead of running Codex. Please switch to a single-command invocation pattern that is compatible with the repo’s cross-platform skill rules.Useful? React with 👍 / 👎.