Skip to content

test(drivers): codex conformance commit item fails locally on macOS — git add exits 128 inside the sandbox #1480

Open

Description

@admarble

Problem

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 fails locally on macOS: git add conformance.txt exits 128 inside the codex sandbox (expected 0, line 902).

It is red at origin/main too, so no branch caused it:

Ref Result
Head feature/1454-… @ f9c40d8d7 FAIL (exit 1)
Base origin/main @ 9f1fb3fdc FAIL (exit 1)

It still fails with every SEQUANT_* var unset, so this is not #1086. Found by scripts/settle-against-base.sh during the #1454 exec phase (2026-10-16).

Likely cause (not verified)

The test runs only where a codex binary is installed, so CI may never run it. Exit 128 from git add inside a seatbelt sandbox usually means git could not write .git/index.lock or read a path outside the sandbox's writable roots (for example a gitdir or a global config outside the worktree).

Acceptance Criteria

  • AC-1: The codex commit item passes on a macOS machine with codex installed, or it skips with a named reason when the sandbox cannot run there. Evidence: npx vitest run src/lib/workflow/drivers/__tests__/driver-conformance.test.ts -t "git add and git commit succeed" on such a machine.

Activity

  1. added
    bug
    on Oct 16, 2026
  2. admarble commented on Oct 18, 2026

    @admarble
    ContributorAuthor

    Root cause verified 2026-10-18 on codex-cli 0.154.0, macOS. This is a driver bug, not a test bug: the test is doing its job.

    What fails. From a linked worktree, git add and git commit inside the sandbox die with
    fatal: Unable to create '<repo>/.git/worktrees/<wt>/index.lock': Operation not permitted (exit 128). Reproduced with GIT_CONFIG_GLOBAL=/dev/null, so commit signing is not involved.

    Why. The driver passes one writable root: git rev-parse --git-common-dir (<repo>/.git, the #1076 fix). codex's workspace-write policy marks <writable_root>/.git read-only and, when the cwd's .git is a gitdir: pointer file, also marks the resolved directory read-only (default_read_only_subpaths_for_writable_root, see openai/codex#27418). For a worktree that resolved directory is <repo>/.git/worktrees/<wt>, where the index, HEAD and COMMIT_EDITMSG live. A deny on a subpath beats the allow on its parent, so granting <repo>/.git is not enough.

    Probes (same permission profile the conformance test writes, touch under each path):

    cwd writable roots target result
    worktree wt, <repo>/.git <repo>/.git/probe writable
    worktree wt, <repo>/.git <repo>/.git/objects/probe writable
    worktree wt, <repo>/.git <repo>/.git/worktrees/<wt>/probe denied
    worktree wt, <repo>/.git, <repo>/.git/worktrees/<wt> <repo>/.git/worktrees/<wt>/probe writable
    main checkout repo, <repo>/.git <repo>/.git/probe writable

    Fix. buildCodexArgs adds git rev-parse --git-dir (resolved to an absolute path) as a second writable root whenever it differs from the common dir. Plain clones are unchanged (both resolve to .git). Every sequant phase runs in a worktree, so today the codex driver cannot commit in any real run — the #1076 class, worktree variant.

    Caveat. Verified through codex sandbox --permission-profile (the test's translation of the exec flags); codex exec -s workspace-write shares the policy builder but was not run here (API cost). The conformance item is skipped in CI because codex is not on PATH there, so this only shows on a developer machine.

    Suggested reshaping of the issue: title fix(codex): workspace-write denies the worktree gitdir — add --git-dir to writable_roots so phases can commit from a worktree; AC-1 a unit test on buildCodexArgs against a real temp repo + worktree asserting both roots are present and a plain clone yields one; AC-2 the existing conformance item passing on a codex machine (runner evidence, since CI skips it).

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

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions