You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Prevent .git/index.lock contention and enforce read-only sandbox for review agents (#518) (#539)
## Summary
Fixes#518.
- Set `GIT_OPTIONAL_LOCKS=0` in the environment of all agent
subprocesses via `configureSubprocess()`. Git 2.15+ honours this
variable and skips the optional index lock that read-only commands (`git
status`, `git diff`) normally take to refresh cached stat data. This
prevents background agents from contending with the user's own git
operations.
- Enforce read-only sandbox for codex review mode by replacing
`--full-auto` (which implies `--sandbox workspace-write`) with
`--sandbox read-only`. Previously, codex had full write access to the
working tree during background reviews — it could run `git add`, modify
files, and take mandatory index locks. Now codex review jobs are
read-only, matching Claude Code's existing `--allowedTools
Read,Glob,Grep` restriction. Agentic mode (fix/refine jobs, `--agentic`)
is unchanged and still uses
`--dangerously-bypass-approvals-and-sandbox`.
- Use `cmd.Environ()` instead of `os.Environ()` when building subprocess
environments so `PWD` is correctly synthesized from `cmd.Dir` rather
than inheriting the daemon's stale working directory.
- Move `configureSubprocess()` after Claude's custom env setup so
`GIT_OPTIONAL_LOCKS=0` is appended to the final environment rather than
being overwritten.
- Probe `codex exec --help` (not top-level `--help`) for `--sandbox`
support to match the subcommand where the flag is actually used.
---------
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
0 commit comments