Commit 484e1d6
fix: tell review agents which project root to read files from (#363)
* fix: tell review agents which project root to read files from
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) <noreply@anthropic.com>
* chore: address review findings + changelog entry
Pre-existing code-quality issues surfaced by the reviewers on this PR
(none were introduced by the original fix, but pulling them in here
since the files are already under review):
instructions.py:
- _run_precompute_command docstring no longer claims "command" is an
absolute path — it's a shell command string, invoked via shell=True
- Noted the trust model for precompute shell commands (repo-sourced,
never fed untrusted input)
- ThreadPoolExecutor now caps at max_workers=8 so a repo with many
distinct precompute commands can't briefly fork dozens of shells
- _build_reference_files_section no longer re-encodes the (possibly
truncated) content string to recompute its byte count; the consumed
budget is now tracked explicitly as either original_byte_len or the
exact remaining budget on truncation
config.py:
- ReviewRule.precomputed_info_bash_command field comment matches the
docstring fix above
test_instructions.py:
- Moved five traceability comment blocks from inside the method body
to the two lines directly preceding the def line, matching the
convention enforced by test_file_quality
- test_count_cap_triggers_omission no longer hardcodes "f20.txt" as
"one of the omitted" — derives the filename from MAX_INLINE_FILES
so the test stays correct if the constant changes
- _sanitize_for_id import moved from a function-local line to the
top-of-module import block
REVIEW-REQ-005 spec:
- Split five compound requirements so each numbered item carries
exactly one RFC 2119 keyword (requirements_file DeepSchema rule).
Preserved existing IDs (5.1.4, 5.1.8, 5.8.4–5.8.6) — each retains
its primary MUST — and appended the secondary obligations as new
sequential IDs (5.1.10, 5.1.11, 5.8.7–5.8.11)
CHANGELOG.md:
- Added entry for the worktree file-path fix under the Unreleased
Fixed section
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* chore: address remaining low-severity review findings
instructions.py:
- precomputed_info lookup now uses direct key access ([]) instead of
.get() so a dict/filter drift between unique_commands and the per-task
lookup would fail loudly instead of silently dropping precomputed
context. Also aligned both predicates on `is not None` so an
empty-string command would not be executed then silently discarded.
- Added a docstring note to _content_hash pinning the trust contract:
files entries must be repo-root-relative paths from trusted
.deepreview config, with no absolute paths or .. traversal.
test_instructions.py:
- New module-level `instructions_dir` pytest fixture that creates
`.deepwork/tmp/review_instructions/` under tmp_path. Seven tests now
use it instead of repeating the two-line setup inline.
- test_single_file_produces_expected_format uses direct
`(tmp_path / "src").mkdir(...)` instead of the indirect `.parent.mkdir`
form, matching adjacent tests in TestComputeReviewId.
- Added an inline comment on the `2 * MAX_INLINE_FILES` fence-count
assertion explaining the 2x relationship.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>1 parent 567ae88 commit 484e1d6
5 files changed
Lines changed: 149 additions & 52 deletions
File tree
- specs/deepwork/review
- src/deepwork/review
- tests/unit/review
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
| 18 | + | |
| 19 | + | |
18 | 20 | | |
19 | 21 | | |
20 | 22 | | |
| |||
Lines changed: 13 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
14 | | - | |
| 14 | + | |
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
18 | | - | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
19 | 22 | | |
20 | 23 | | |
21 | 24 | | |
| |||
61 | 64 | | |
62 | 65 | | |
63 | 66 | | |
64 | | - | |
65 | | - | |
66 | | - | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
42 | 42 | | |
43 | 43 | | |
44 | 44 | | |
45 | | - | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
46 | 48 | | |
47 | 49 | | |
48 | 50 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
85 | 85 | | |
86 | 86 | | |
87 | 87 | | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
88 | 93 | | |
89 | 94 | | |
90 | 95 | | |
| |||
105 | 110 | | |
106 | 111 | | |
107 | 112 | | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
108 | 118 | | |
109 | | - | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
110 | 122 | | |
111 | 123 | | |
112 | 124 | | |
| |||
146 | 158 | | |
147 | 159 | | |
148 | 160 | | |
| 161 | + | |
| 162 | + | |
149 | 163 | | |
150 | | - | |
| 164 | + | |
151 | 165 | | |
152 | 166 | | |
153 | 167 | | |
| |||
205 | 219 | | |
206 | 220 | | |
207 | 221 | | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
208 | 225 | | |
209 | | - | |
210 | | - | |
| 226 | + | |
| 227 | + | |
211 | 228 | | |
212 | 229 | | |
213 | | - | |
| 230 | + | |
214 | 231 | | |
215 | 232 | | |
216 | 233 | | |
| |||
223 | 240 | | |
224 | 241 | | |
225 | 242 | | |
| 243 | + | |
226 | 244 | | |
227 | 245 | | |
228 | 246 | | |
| |||
231 | 249 | | |
232 | 250 | | |
233 | 251 | | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
234 | 258 | | |
235 | 259 | | |
236 | 260 | | |
| |||
241 | 265 | | |
242 | 266 | | |
243 | 267 | | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
244 | 283 | | |
245 | 284 | | |
246 | 285 | | |
| |||
353 | 392 | | |
354 | 393 | | |
355 | 394 | | |
356 | | - | |
| 395 | + | |
| 396 | + | |
357 | 397 | | |
358 | 398 | | |
359 | 399 | | |
360 | | - | |
361 | | - | |
| 400 | + | |
362 | 401 | | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
363 | 405 | | |
364 | 406 | | |
365 | 407 | | |
366 | | - | |
| 408 | + | |
367 | 409 | | |
368 | 410 | | |
369 | 411 | | |
| |||
0 commit comments