Skip to content

Codex can commit in a plain checkout: the driver makes the git dir writable - #1780

Merged
suleimansh merged 1 commit into
mainfrom
agent-codex-git-dir-writable
Sep 14, 2026
Merged

suleimansh merged 1 commit into
mainfrom
agent-codex-git-dir-writable

Conversation

@suleimansh

Copy link
Copy Markdown
Contributor

Codex's workspace-write sandbox keeps a .git/ directory at the workspace root read-only. So a Codex agent in a plain clone failed its first commit on .git/index.lock. Agent checkouts under .branches/ are git worktrees, so they never hit it.

  • CodexSession.prompt() looks up the git common dir on every turn with git rev-parse --path-format=absolute --git-common-dir.
  • Under workspace-write, the driver passes that dir as -c sandbox_workspace_write.writable_roots=[...].
  • If the folder is not in a repository, or git is missing, nothing is added. read-only and danger-full-access are unchanged.
  • extraArgs still come last, so a caller's own writable_roots replaces ours. The option's doc comment now says so.
  • A writable git dir also lets the agent change hooks and git config. This is accepted: committing is the agent's job, and worktrees already allowed it.
  • Two new tests cover a git init temp repo and the read-only sandbox. With the flag switched off, the repo test fails.
  • codex.LOGIC.md and codex.test.LOGIC.md are updated.

Closes #1747

🤖 Generated with Claude Code

Opened from The Framework session codex-git-dir-writable.

…itable under workspace-write (#1747)

Codex's workspace-write sandbox keeps a root .git/ directory read-only, so a
Codex agent in a plain clone failed its first commit on .git/index.lock. Each
turn now resolves the git common dir and passes it as a writable root.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@suleimansh
suleimansh enabled auto-merge (squash) September 14, 2026 21:48
@suleimansh
suleimansh merged commit 4845d77 into main Sep 14, 2026
2 checks passed
@suleimansh
suleimansh deleted the agent-codex-git-dir-writable branch September 14, 2026 21:50
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.

Codex cannot commit in a plain checkout: the default sandbox refuses writes under .git/

1 participant