Skip to content

fix(codex): git add exits 128 inside the codex driver's default sandbox on macOS 27.2 #1700

Open

Description

@admarble

Problem

On macOS 27.2.1, the codex driver conformance test fails locally and deterministically. CI on Linux is green at the same commit, b0eaf8015.

FAIL  src/lib/workflow/drivers/__tests__/driver-conformance.test.ts > driver conformance > codex > commit: git add and git commit succeed inside the driver's default sandbox
AssertionError: expected 128 to be +0
 ❯ driver-conformance.test.ts:902:13   prepared.run(["git", "add", "conformance.txt"], worktree)

The test hasn't changed since 2026-09-30 (397c12635). It ran in the release pre-flight's full npm test on 2026-11-17 (1 failed, 9,389 passed) and again on its own with -t "commit: git add and git commit succeed" (1 failed, 3 passed). The codex CLI isn't installed on this machine; the test exercises the adapter's own sandbox.prepare(worktree) policy.

If the adapter's macOS sandbox policy no longer lets git add write the index under 27.2, a codex phase on current macOS can't commit.

Acceptance Criteria

  • AC-1: On macOS 27.2 or later, the codex conformance commit item passes. Evidence: npx vitest run src/lib/workflow/drivers/__tests__/driver-conformance.test.ts -t "commit: git add and git commit succeed" → 0 failed

Non-Goals

  • The other drivers' sandboxes.

Done when

git add and git commit succeed inside the codex driver's default sandbox on current macOS, or the test records a typed skip naming the OS gap.

Activity

  1. admarble commented on Nov 24, 2026

    @admarble
    ContributorAuthor

    This now fails in CI on Linux, and it blocks every PR (runner finding, 2026-11-24).

    The required test check failed twice on PR #1705 at 2c6beb7c2, a docs-only commit (one re-run of the failed job, same result):

    FAIL src/lib/workflow/drivers/__tests__/driver-conformance.test.ts > driver conformance > codex > commit: git add and git commit succeed inside the driver's default sandbox
    AssertionError: expected 128 to be +0      (driver-conformance.test.ts:902)
    Tests  1 failed | 9383 passed | 1 expected fail | 9 skipped (9394)
    

    What changed is the runner image, not the code. ci.yml uses runs-on: ubuntu-latest:

    Run Commit Image The codex commit item
    CI on 2026-11-18 (green) adc1b2bc5 ubuntu-24.04, 20261111.370.1 skipped: "unavailable: codex sandbox rejected the permissions profile (status 1); the 0.154.0 schema this suite writes may have changed"
    CI on 2026-11-24 (red, twice) 2c6beb7c2 ubuntu-26.04, 20261116.202.1 ran; git add exited 128

    So the item never ran in CI before: on 24.04 the sandbox smoke probe failed and the item skipped. On 26.04 the probe passes, the item runs, and it shows the same exit 128 this issue reports on macOS 27.2. The title's "on macOS 27.2" is too narrow.

    Not checked: git's stderr inside the sandbox (the test asserts on the exit code only), and whether the cause on Linux is the same as on macOS.

    Until this is fixed, test is red on any PR that runs on ubuntu-latest. A stopgap would be pinning the test job to ubuntu-24.04, which restores the earlier skip rather than fixing anything.

  2. admarble commented on Nov 30, 2026

    @admarble
    ContributorAuthor

    git's error, reproduced on macOS 27.2 with the bundled codex-cli 0.162.1 (runner, 2026-11-29). CI is still red: four more PR runs failed on 2026-11-26 on ubuntu-26.04, each with this one test failing (1 failed, 9383 passed).

    The test discards stderr, so I rebuilt its fixture and profile in a script and captured it:

    $ codex sandbox --permission-profile sequant_conformance -C <wt> -- git add conformance.txt     → 128
    fatal: Unable to create '<repo>/.git/worktrees/<wt>/index.lock': Operation not permitted
    

    That is the #1076 message, although the driver's writable root is present: buildCodexArgs returned writable_roots = ["<repo>/.git"], and the profile grants it write. /bin/echo passes under the same profile, so the profile loads.

    Varying only the extra write path in the profile:

    Extra write grant git add git's error
    <repo>/.git (what the test writes from the driver's root) 128 can't create .git/worktrees/<wt>/index.lock
    <repo> (the parent of .git) 128 the same index.lock error
    <repo>/.git/worktrees/<wt> 128 the lock is created; then "unable to create temporary file … failed to insert into database" (the object store)

    So under 0.162.1 a write grant on .git, or on a directory that contains it, doesn't reach inside .git; a grant on a path inside .git does. The test's comment records the .git grant working on codex-cli 0.154.0. That reads as a codex change between 0.154.0 and 0.162.1 in how .git is protected, but I haven't bisected versions.

    Not checked: whether codex exec -s workspace-write with the driver's sandbox_workspace_write.writable_roots behaves the same way (that needs a live run; codex sandbox in 0.162.1 only takes a named profile), and the stderr on Linux. Until the first is known, whether a codex phase can commit in a worktree on sequant 3.0.0 is open.

  3. admarble commented on Nov 30, 2026

    @admarble
    ContributorAuthor

    Stopgap merged: the test job is pinned to ubuntu-24.04 (PR #1711, 943d44381, on the owner's word).

    On the pin PR, test ran on ubuntu-24.04 and passed with the codex commit item skipped again ("codex sandbox rejected the permissions profile (status 1)"): 9384 passed, 1 expected fail, 9 skipped. So CI is green because the item doesn't run, not because it passes.

    To do with this issue's work: remove the pin in .github/workflows/ci.yml (the comment above runs-on: ubuntu-24.04 points here), so the item runs on the current image.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions