codex CLI fails in CI environments (GitHub Actions) due to Ink raw mode error, even with --quiet, CODEX_QUIET_MODE=1, and --no-terminal

Resolved 💬 7 comments Opened May 22, 2025 by charlie87041 Closed Nov 2, 2025
💡 Likely answer: A maintainer (etraut-openai, contributor) responded on this thread — see the highlighted reply below.

What version of Codex is running?

0.1.2505172129

Which model were you using?

default. just trying demos in CI pipeline

What platform is your computer?

github actions

What steps can reproduce the bug?

Running the Codex CLI in GitHub Actions fails with an Ink-related stdin error, even when using recommended non-interactive flags and environment variables.

Environment

Runner: ubuntu-latest (GitHub Actions)

Node: 22.15.0

Codex CLI installed globally: npm install -g @openai/codex

Prompt: any (e.g. "Update CHANGELOG" or "Look for vulnerabilities...")

What I tried;

jobs:
   ...
    env:
       CODEX_QUIET_MODE: 1
codex -a auto-edit --quiet "Update CHANGELOG for next release"
codex --no-terminal "Look for vulnerabilities and create a security review report"

And also export CODEX_QUIET_MODE=1 and codex --quiet --no-terminal ... in the step

What is the expected behavior?

A valid response of the codex app

What do you see instead?

ERROR Raw mode is not supported on the current process.stdin, which Ink uses as input stream by default.
Read about how to prevent this error on https://github.com/vadimdemedes/ink/#israwmodesupported

Additional information

This is the relevant action code

  name: Codex review integration
  
  on:
    push:
      branches: [ "master" ]
  
  concurrency:
    group: '${{ github.workflow }} @ ${{ github.event.pull_request.head.label || github.head_ref || github.ref }}'
    cancel-in-progress: true
  
  jobs:
    codex-review:
      runs-on: ubuntu-latest
      env:
        OPENAI_API_KEY: ${{ secrets.CODEX_API_KEY }}
        CODEX_QUIET_MODE: 1 #deshabilita el modo consola para git action
      permissions:
        contents: read
        pull-requests: write
  
      steps:
        - name: Use Node.js 22
          uses: actions/setup-node@v4
          with:
            node-version: '22'
  
  
        - name: Install Codex CLI
          run: npm install -g @openai/codex
  
        - name: Check Codex CLI version
          run: codex --version
  
        # Ejemplo de paso: actualizar changelog automáticamente
        - name: Auto-update CHANGELOG with Codex
          run: |
            export CODEX_QUIET_MODE=1
            codex --no-terminal  -a auto-edit "Update CHANGELOG for next release"
  
  
        # Otro paso: revisión de seguridad (puedes duplicar con diferentes prompts)
        - name: Security review with Codex
          run: |
            codex --quiet "Look for vulnerabilities and create a security review report"
  
        # Otro paso: sugerencia de PRs útiles
        - name: Suggest high-impact PRs
          run: |
            codex --quiet "Carefully review this repo, and propose 3 high impact well-scoped PRs"

View original on GitHub ↗

7 Comments

michaelmoore-s1 · 1 year ago

A workaround is to specify a container, and allocate a tty.

container:
 image: node:24
 options: --tty
petrosoft-fi · 1 year ago

⚠️ Same underlying issue in #1080, #1156, and #1208 (also reproducible in AWS Lambda)

All three reports crash with the identical Ink error:

Error: Raw mode is not supported on the current process.stdin …

The Codex CLI calls stdin.setRawMode(true) via Ink’s useInput.
If the process has no real TTY (CI runners, Jupyter/Colab, Lambda, Docker without -t) Ink throws and Codex exits before any flags are parsed.

➡️ There is no reliable headless work-around yet

• Setting CI=true and passing --yes --allow-outside-git --approval-mode full-auto is not sufficient—Ink still initialises useInput and the CLI crashes.
• Same result in Lambda, GitHub Actions, Azure Functions, and Colab notebooks.

🛠 Proposed fix for the CLI

  1. Provide an official --ci / --headless flag (or honour CI=true) that completely disables Ink’s useInput before raw-mode is attempted.
  2. Make that flag automatically imply --yes and --allow-outside-git.
  3. Document usage for CI/CD environments (Actions, GitLab, Lambda, etc.).

Until then the only viable option is:

Run Codex CLI inside an environment that has a TTY (e.g. self-hosted runner with docker run -it …).

hannut91 · 1 year ago

I had the same problem, so I checked the problem, and it turned out that OPENAI_API_KEY was not working properly as an environment variable.

If you look at the get-api-key.tsx file, it looks like this:

export async function getApiKey(
  issuer: string,
  clientId: string,
  forceLogin: boolean = false,
): Promise<string> {
  if (!forceLogin && process.env["OPENAI_API_KEY"]) {
    return process.env["OPENAI_API_KEY"]!;
  }
  const choice = await promptUserForChoice(); // render
  // ... 
}

If don't read the value from the environment variable, it will be rendered and an error will occur in the GitHub Actions environment. Please check if it is properly caught by doing the following in CI.

      - name: Run codex
        env:
          OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
        run: |
          if [ -z "$OPENAI_API_KEY" ]; then
            echo "❌ OPENAI_API_KEY is not set"
          else
            echo "✅ OPENAI_API_KEY is set"
          fi

          if [ -z "$GITHUB_TOKEN" ]; then
            echo "❌ GITHUB_TOKEN is not set"
          else
            echo "✅ GITHUB_TOKEN is set"
          fi
// ...

You can test it like this.

FROM node:22-alpine
WORKDIR /app
ENV OPENAI_API_KEY=
RUN npm install -g @openai/codex
CMD ["codex", "-a", "full-auto", "-q", "hello world"]
$ docker build -f Dockerfile.test -t codex-ci-test . && docker run --rm codex-ci-test
ERROR Raw mode is not supported on the current process.stdin, which Ink uses
       as input stream by default.
       Read about how to prevent this error on
       https://github.com/vadimdemedes/ink/#israwmodesupported

An error occurs because OPENAI_API_KEY is empty. However, if you enter a correct value in OPENAI_API_KEY and run the same command again, it will be printed correctly.

doggy8088 · 1 year ago

Is there any workaround for this raw mode error?

thingersoft · 1 year ago
Is there any workaround for this raw mode error?

script -qfc "your-shell-command" /dev/null

jdoxey · 11 months ago

Hey @charlie87041, I noticed there's now a section in the README.md about Non-interactive / CI mode. It suggests using codex exec --full-auto "prompt goes here". Can you retry using this?

I also noticed your GitHub Actions yml is missing the checkout step. (N.B. You _can_ use Codex CLI without having a checked-out repo if you want, but you'd also need the --skip-git-repo-check flag).

The yml I used for testing was,

on:
  workflow_dispatch:
jobs:
  codex-test:
    runs-on: ubuntu-latest
    env:
      OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
    steps:
      - name: Checkout repo
        uses: actions/checkout@v4
      - name: Make sure key is set
        run: |
          if [ -z "$OPENAI_API_KEY" ]; then
            echo "❌ OPENAI_API_KEY is not set"
            exit 1
          else
            echo "✅ OPENAI_API_KEY is set"
          fi
      - name: Use Node.js 22
        uses: actions/setup-node@v4
        with:
          node-version: '22'
      - name: Install and use Codex CLI
        run: |
          npm install -g @openai/codex
          codex --version
          codex exec --full-auto "Put a description of this repo's purpose into PURPOSE.md"
          cat PURPOSE.md

You can see the GitHub Actions run here: https://github.com/jdoxey/codex-bug-test/actions/runs/17008004859/job/48220199682

etraut-openai contributor · 8 months ago

The original issue reported here is no longer relevant because the CLI has since been rewritten in Rust and no longer uses ink.