fix: use read-only sandbox for Codex with unified diff file fallback#620
fix: use read-only sandbox for Codex with unified diff file fallback#620
Conversation
roborev: Combined Review (
|
roborev: Combined Review (
|
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, avoiding extra git calls for small diffs - 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
5b233a6 to
7b40338
Compare
roborev: Combined Review (
|
7b40338 to
e3a75ee
Compare
roborev: Combined Review (
|
roborev: Combined Review (
|
Replace the Codex-specific large-diff handling with a single path that works the same for every agent: 1. Worker writes the full diff to a snapshot file before building the prompt 2. Builder inlines the diff if it fits; references the file if it doesn't 3. No agent-specific branching, no prompt parsing, no placeholders Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
209273e to
389f1ef
Compare
roborev: Combined Review (
|
CodexDiffFilePathPlaceholder → DiffFilePathPlaceholder preparePrebuiltCodexPrompt → preparePrebuiltPrompt The placeholder and replacement logic are agent-agnostic — the CI poller already passes the placeholder for all agents, not just Codex. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Replace `cat '/path'` with tool-neutral "Read the diff from: `/path`" so oversized-diff prompts work on Windows - Make prepareDiffFile return an error so the worker retries when the snapshot cannot be written, instead of running a useless review with no diff access Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Return ErrDiffTruncatedNoFile from the builder when the diff is too large to inline and no file path was provided. The worker calls Build first; on ErrDiffTruncatedNoFile it writes the snapshot and retries with BuildWithDiffFile. Small diffs never touch the snapshot path. For prebuilt CI prompts, degrade gracefully when the snapshot cannot be created (strip placeholder) instead of hard-failing. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…radation - Build() returns a plain truncation note for oversized diffs (no error), preserving backward compat for roborev review --local, batch reviews, and other non-worker callers - Only BuildWithDiffFile() with empty path returns ErrDiffTruncatedNoFile, which the worker uses to trigger snapshot creation - On prebuilt prompt snapshot failure, strip the entire file-reference block (not just the placeholder) so the agent sees a clean truncation note without misleading "written to a file" instructions Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Match on the common prefix "(Diff too large to include inline" and truncate at the closing paren, handling both the verbose and compact forms from diffFileFallbackVariants. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
roborev: Combined Review (
|
roborev: Combined Review (
|
…FileBlock Prebuilt prompts with the diff file placeholder need the snapshot to be useful — if it can't be created, fail the job so it retries instead of running a review with no diff access. Delete stripDiffFileBlock since the degradation path is no longer used. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
roborev: Combined Review (
|
Summary
--sandbox danger-full-accessback to--sandbox read-only. With full access, Codex was scanning/home,/nix/store, and/rootwhen investigating large diffs.ResolveGitDirexported frominternal/gitwith MSYS path normalization.🤖 Generated with Claude Code