fix: tell review agents which project root to read files from#363
Open
fix: tell review agents which project root to read files from#363
Conversation
In git-worktree setups, reviewer subagents were reading files from the main checkout instead of the worktree where the commits actually live, producing spurious findings against stale (un-refactored) content. The "@filepath" entries in the instruction file's "Files to Review" section are not auto-expanded — the reviewer must Read each file itself — so they were being resolved against whatever cwd the subagent happened to inherit. Emit an explicit "## Project Root" directive at the top of each instruction file stating the absolute project root and instructing the reviewer to prepend it when calling Read. Adds REVIEW-REQ-005.1.9 and tests validating presence, ordering, and the write_instruction_files plumbing that threads project_root through. Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
file-purpose-comment MUST FAILhits on files that already had purpose comments in the worktree).@filepathentries in each instruction file's "Files to Review" section are not auto-expanded — the reviewer mustReadeach file itself — so they resolve against whatever cwd the subagent inherits. When that cwd is the main checkout,Readreturns un-refactored content, which then disagrees with the "Relevant File Contents" block that was correctly inlined from the worktree.## Project Rootdirective at the top of each instruction file stating the absolute project root and telling the reviewer to prepend it when callingRead. Reviewer behavior is now cwd-independent.Changes
src/deepwork/review/instructions.py—build_instruction_filetakes an optionalproject_root: Path; emits the new section when provided.write_instruction_filesthreads it through.specs/deepwork/review/REVIEW-REQ-005-instruction-generation.md— adds REVIEW-REQ-005.1.9 with the worktree rationale.tests/unit/review/test_instructions.py— new tests covering presence, ordering before "Review Instructions", backward-compat whenproject_rootis omitted, and thewrite_instruction_filesplumbing.Test plan
uv run pytest tests/unit/review/test_instructions.py(60 passed)uv run pytest tests/unit/review/(260 passed)## Project Rootsection in an actual worktree run🤖 Generated with Claude Code