Revert Codex sandbox from --sandbox danger-full-access back to
--sandbox read-only. With full access, Codex was scanning /home,
/nix/store, and /root when investigating large diffs.
For large diffs that don't fit inline in the prompt, the worker writes
the full diff to a file in the repo's git dir (resolved via git
rev-parse --git-dir) and references the absolute path in the prompt so
sandboxed Codex can read it directly.
- Diff file is only captured when the prompt builder detects truncation
(DiffTruncatedHint), avoiding extra git calls for small diffs
- Portable prompt (without ephemeral file paths) is persisted so
retries rebuild the diff file fresh
- CI prebuilt prompts with a diff file placeholder are resolved at job
time; legacy prebuilt prompts get a diff file reference appended
- Exclude patterns applied consistently to both inline and file-based
diffs
- Codex review prompt instructs the agent not to search or read files
outside the repository checkout
- ResolveGitDir exported from internal/git with MSYS path normalization
- Config-aware agent resolution for diff file requirement checks
Summary
--sandbox danger-full-accessback to--sandbox read-only. With full access, Codex was scanning/home,/nix/store, and/rootwhen investigating large diffs.git rev-parse --git-dir) and references the absolute path in the prompt so sandboxed Codex can read it directly.preparePrebuiltCodexPrompt.🤖 Generated with Claude Code