fix(codex): grant write access to main repo so decision files land in canonical path#187
Conversation
… canonical path Codex judges run with --sandbox workspace-write and --cd <pr-N worktree> (PR #182). The sandbox blocks writes anywhere outside the cwd workspace — including the main repo's .prompts/decisions/ where decision JSONs MUST land. Result: gpt-5.5 judges (Backend, Frontend & UX) silently failed to write their decisions; only opus/claude judges (which use a different sandbox) actually persisted. Pass --add-dir <project_root> to codex when worktree differs from PROJECT_ROOT. Sandbox stays in place; just adds the main repo to the writeable allowlist so judges can write the decision file at its canonical absolute path. find_decision_file's worktree-scan fallback still acts as a safety net for any judge that writes to the worktree's .prompts/decisions/ instead. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
WalkthroughCodexAdapter now detects when Codex executes within a per-PR worktree that differs from the main project root. When detected, it extends the Codex command with ChangesCodex worktree sandbox directory support
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Poem
Comment |
Codex judges run with
--sandbox workspace-writeand--cd <pr-N worktree>(PR #182). Sandbox blocks writes outside cwd — including the main repo's.prompts/decisions/. gpt-5.5 judges (Backend, Frontend & UX) silently failed to persist decisions; claude judges (different sandbox) worked.Fix: pass
--add-dir <project_root>when worktree ≠ PROJECT_ROOT. Sandbox stays in place; just adds the main repo to writeable allowlist.find_decision_fileworktree-scan still acts as a safety net.Test plan
CodexAdapter now grants write access to main repository for decision files
Problem: When Codex judges run in per-PR worktrees with
--sandbox workspace-write, the sandbox blocks writes outside the worktree, preventing decision JSON files from landing in the main repo's.prompts/decisions/directory.Solution:
CodexAdapter._run_oncenow detects when the worktree differs from the project root and extends the Codex command with--add-dir <project_root>. This whitelists the main repository directory for writes while maintaining sandbox security. The implementation includes error handling to suppress any issues during project-root resolution.Testing: Tests updated to verify the
--add-dirflag is added when needed and command structure remains correct before and after the new argument.