Skip to content

Codex intermittently segfaults when starting pytest in Conda env, while same repo/tests work in user terminal and Cursor #14723

@guido-h

Description

@guido-h

Title: Codex intermittently segfaults when starting pytest in Conda env, while same repo/tests work in user terminal and Cursor

Product: Codex desktop app / Codex coding agent runner
Date/time: March 14, 2026, America/Los_Angeles
OS: macOS
Repo: /Users/guido/dev/cerbex/CBE_P

Issue:
Codex intermittently fails to validate unit tests in a Conda environment. In this repo, pytest startup sometimes exits with Segmentation fault: 11 under Codex, even when following the repo’s required Conda workflow exactly. The same commands work for the user in their own terminal and have also worked in some other Codex/Cursor sessions, so this appears intermittent and runner-specific.

Expected behavior:
Codex should be able to activate the existing Conda env and run pytest reliably, or at minimum fail with a normal Python/test error rather than a segfault.

Actual behavior:
Inside Codex, after:

  1. cd /Users/guido/dev/cerbex/CBE_P
  2. source /Users/guido/anaconda3/etc/profile.d/conda.sh
  3. conda activate CBE_P
  4. pytest tests/unit/api/test_hotel_websocket.py -q

pytest sometimes crashes immediately with:
Segmentation fault: 11

Additional observations:

  • python -c "import pytest; print(pytest.__version__)" succeeds in the same activated env.
  • python -m pytest --version can segfault under Codex.
  • The same repo and env work from the user’s terminal outside Codex.
  • Some Codex sessions succeed; others fail, so the issue appears intermittent.
  • We explicitly ruled out command drift:
    • no .venv
    • no poetry run pytest
    • no conda run
    • persistent PTY shell used
  • Repo docs were updated to standardize this flow, but the segfault still occurs in some Codex sessions.

Why this matters:
The agent can write tests but cannot always validate them, which makes unit-test tasks unreliable in Conda-based repos.

Artifacts available:

  • conversation transcript showing repeated segfaults in Codex
  • repo-local instructions used by the agent
  • exact commands above

Metadata

Metadata

Assignees

No one assigned

    Labels

    appIssues related to the Codex desktop appbugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions