Skip to content

Fix Codex CLI examples for containerized GitLab runners#2484

Open
lavrovpy wants to merge 1 commit intoopenai:mainfrom
lavrovpy:fix/codex-gitlab-ci-known-issues
Open

Fix Codex CLI examples for containerized GitLab runners#2484
lavrovpy wants to merge 1 commit intoopenai:mainfrom
lavrovpy:fix/codex-gitlab-ci-known-issues

Conversation

@lavrovpy
Copy link

@lavrovpy lavrovpy commented Mar 3, 2026

Summary

Updates all three YAML snippets in examples/codex/secure_quality_gitlab.md to fix two issues that break Codex CLI in containerized CI environments:

  • Auth: Codex CLI requires explicit authentication — the env var alone is not enough. Added printenv OPENAI_API_KEY | codex login --with-api-key to all three examples, per the CLI Reference.
  • Sandbox: Replaced --full-auto with --dangerously-bypass-approvals-and-sandbox because containerized runners (Kubernetes pods, Docker) lack the kernel features (landlock, seccomp) that Codex's default workspace-write sandbox requires. The Security docs recommend this flag when running inside containers that already provide isolation.

Both issues cause Codex to silently produce empty results ([]) with no clear error, making them hard to diagnose.

Changes

  • Added printenv OPENAI_API_KEY | codex login --with-api-key in all three job examples
  • Replaced codex exec --full-auto with codex exec --dangerously-bypass-approvals-and-sandbox in all three job examples
  • Updated intro text to reflect the new flag and explain why it's needed

Update all three YAML snippets in the GitLab cookbook to fix two issues
that break Codex in CI:

1. Add `codex login --with-api-key` — Codex CLI no longer reads
   OPENAI_API_KEY implicitly from the environment (openai/codex#3367).

2. Replace `--full-auto` with `--dangerously-bypass-approvals-and-sandbox`
   — containerized runners (k8s, Docker) lack landlock/seccomp kernel
   features required by Codex's default workspace-write sandbox.
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