Skip to content

fix(ce-work-beta): document Codex exec pitfalls for delegation#365

Open
huntharo wants to merge 3 commits intoEveryInc:mainfrom
huntharo:claude/fix-codex-stdin-piping
Open

fix(ce-work-beta): document Codex exec pitfalls for delegation#365
huntharo wants to merge 3 commits intoEveryInc:mainfrom
huntharo:claude/fix-codex-stdin-piping

Conversation

@huntharo
Copy link
Copy Markdown

Summary

  • Add concrete cat file | codex exec --skip-git-repo-check - example to the delegation step
  • Add pitfalls table documenting five failure modes discovered during hands-on testing:
    • Shell redirect (< file) → "stdin is not a terminal"
    • Bare codex instead of codex exec → enters interactive mode, hangs
    • --approval-mode flag on exec → "unexpected argument"
    • Running outside a git repo → "Not inside a trusted directory"
    • Missing trailing - → prompt not read from stdin

Test plan

  • Invoke /ce:work-beta with a plan tagged external-delegate and verify the agent uses the documented cat ... | codex exec --skip-git-repo-check - pattern
  • Verify the agent does not use shell redirects or --approval-mode on exec

🤖 Generated with Claude Code

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: f3094bab38

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

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
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Avoid shell pipes in delegation command example

This adds cat /tmp/codex-task-XXXXX.txt | codex exec --skip-git-repo-check - 2>&1, but plugins/compound-engineering/AGENTS.md explicitly 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 👍 / 👎.

huntharo and others added 3 commits March 27, 2026 09:08
…ation

Codex CLI rejects shell redirects (`< file`) with "stdin is not a
terminal". The delegation step said "pipe via stdin" but gave no
concrete example, so the agent used a redirect instead.

Add a concrete `cat file | codex exec ...` example and an explicit
warning against `< file`.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…ation

`codex exec` does not accept `--approval-mode` flag. When piping a
prompt via stdin, use `codex --approval-mode full-auto --quiet`
directly (no `exec` subcommand).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…alls

Replace incorrect `codex --approval-mode` example with the tested
working invocation: `cat file | codex exec --skip-git-repo-check - `.

Add a pitfalls table documenting all five failure modes discovered
during testing: shell redirects, bare codex vs exec, wrong flags,
missing git repo check skip, and missing trailing dash for stdin.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@huntharo huntharo force-pushed the claude/fix-codex-stdin-piping branch from f3094ba to eaeaa0e Compare March 27, 2026 13:08
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: eaeaa0e4be

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

|---------|--------------|-----|
| 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 |
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Use supported approval flag in Codex exec guidance

The new pitfalls row says to avoid --approval-mode on codex exec and implies that flag belongs to bare codex, but the current Codex CLI reference documents --ask-for-approval (not --approval-mode) and states global options apply to subcommands like codex exec. In non-interactive delegation flows, this guidance can push users toward an invalid flag or back to interactive codex, causing command failures/hangs instead of setting approval behavior correctly.

Useful? React with 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant