Skip to content

Commit 2bb3624

Browse files
fix(a6df-0162): constrain reviewer file field to diff files and add overlap recovery (merge worktree-20260327-100311)
2 parents 9e973b2 + b09f23c commit 2bb3624

13 files changed

+280
-29
lines changed

.test-index

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,15 @@ plugins/dso/commands/review.md:plugins/dso/skills/preplanning/tests/test_adversa
3131
plugins/dso/docs/CONFIG-RESOLUTION.md:tests/scripts/test-config-resolution-doc-accuracy.sh
3232
plugins/dso/docs/INSTALL.md:tests/scripts/test-reinstall-hooks-config-paths.sh,tests/scripts/test-reinstall-hooks.sh
3333
plugins/dso/docs/MIGRATION.md:tests/hooks/test-state-dir-migration.sh,tests/scripts/test-doc-migration.sh
34+
plugins/dso/docs/SUB-AGENT-BOUNDARIES.md:tests/docs/test_sub_agent_boundaries_anti_coverup.py
3435
plugins/dso/docs/adapters/flask-jinja2.json:tests/plugin/test_flask_jinja2_adapter_yaml.py
3536
plugins/dso/docs/component-discovery-schema.json:tests/plugin/test_component_discovery_schema.py
3637
plugins/dso/docs/decisions/adr-config-system.md:tests/scripts/test-adr-config-system.sh
3738
plugins/dso/docs/workflow-config-schema.json:tests/scripts/test-workflow-config-schema.sh
3839
plugins/dso/docs/workflows/COMMIT-WORKFLOW.md:tests/scripts/test-commit-workflow-step-1-5.sh
3940
plugins/dso/docs/workflows/REVIEW-PROTOCOL-WORKFLOW.md:tests/hooks/test-review-protocol-workflow.sh
40-
plugins/dso/docs/workflows/REVIEW-WORKFLOW.md:tests/workflows/test-review-workflow-no-snapshot.sh,tests/workflows/test-review-workflow-size-thresholds.sh,tests/workflows/test-review-workflow-classifier-override-prevention.sh,tests/skills/test_review_workflow_model_escalation.py
41+
plugins/dso/docs/workflows/prompts/reviewer-base.md:tests/docs/test-reviewer-base-file-constraint.sh
42+
plugins/dso/docs/workflows/REVIEW-WORKFLOW.md:tests/workflows/test-review-workflow-no-snapshot.sh,tests/workflows/test-review-workflow-size-thresholds.sh,tests/workflows/test-review-workflow-classifier-override-prevention.sh,tests/skills/test_review_workflow_model_escalation.py,tests/docs/test-reviewer-base-file-constraint.sh
4143
plugins/dso/hooks/dispatchers/pre-bash.sh:tests/hooks/test-pre-bash-dispatcher.sh
4244
plugins/dso/hooks/dispatchers/pre-edit.sh:tests/hooks/test-pre-edit-write-dispatcher.sh
4345
plugins/dso/hooks/dispatchers/pre-write.sh:tests/hooks/test-pre-edit-write-dispatcher.sh

plugins/dso/agents/code-reviewer-deep-arch.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name: code-reviewer-deep-arch
33
model: opus
44
description: Deep-tier architectural reviewer (Opus): synthesizes specialist findings, assesses systemic risk, produces unified verdict across all dimensions.
55
---
6-
<!-- content-hash: 5726710d4d9c90e5b79810a1b16bbdb047fc53bc2aaa65780598cffff23ed9a6 -->
6+
<!-- content-hash: e356045cd2825e9e3f698ffe1411de98b6406107455e9425857841636ab7fe01 -->
77
<!-- generated by build-review-agents.sh — do not edit manually -->
88

99
# Code Reviewer — Universal Base Guidance
@@ -92,7 +92,7 @@ Produce a JSON object with this EXACT schema (for writing to disk in Step 3).
9292

9393
VIOLATIONS CAUSE RE-DISPATCH.
9494

95-
REQUIRED: EXACTLY three top-level keys: "scores", "findings", "summary".
95+
REQUIRED: EXACTLY three top-level keys: "scores", "findings" (file field must reference diff files only), "summary".
9696
Do NOT add "schema_version", "review_result", "id", "review_date", or any other key —
9797
the validator will reject any extra keys and force a re-dispatch.
9898
The "scores" object MUST contain ALL five dimensions listed below with integer 1–5 or "N/A".
@@ -115,13 +115,15 @@ will be rejected by the validator and force a re-dispatch.
115115
"severity": "critical|important|minor",
116116
"category": "<one of the 5 score dimensions>",
117117
"description": "...",
118-
"file": "path/to/file"
118+
"file": "path/to/file (MUST be from the diff being reviewed)"
119119
}
120120
],
121121
"summary": "2-3 sentence assessment"
122122
}
123123
```
124124

125+
**`file` field constraint**: The `file` field in each finding MUST reference a file present in the diff being reviewed (DIFF_FILE). Do not use files from your recommendations (e.g., test files that should be created) — only files that appear in the actual diff. `record-review.sh` validates that finding files overlap with changed files and rejects the review if they do not.
126+
125127
---
126128

127129
## Scoring Rules

plugins/dso/agents/code-reviewer-deep-correctness.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name: code-reviewer-deep-correctness
33
model: sonnet
44
description: Deep-tier correctness specialist (Sonnet A): focused exclusively on correctness — edge cases, error handling, security, efficiency.
55
---
6-
<!-- content-hash: d42a3d7b417a4e0699de9eda503d6b9ec64de71a5b320dedff5901ae671580e1 -->
6+
<!-- content-hash: b19cd9c73923f3f67f1b9642dda3d007261f6c349f63edbf7d246e0d69fb678d -->
77
<!-- generated by build-review-agents.sh — do not edit manually -->
88

99
# Code Reviewer — Universal Base Guidance
@@ -92,7 +92,7 @@ Produce a JSON object with this EXACT schema (for writing to disk in Step 3).
9292

9393
VIOLATIONS CAUSE RE-DISPATCH.
9494

95-
REQUIRED: EXACTLY three top-level keys: "scores", "findings", "summary".
95+
REQUIRED: EXACTLY three top-level keys: "scores", "findings" (file field must reference diff files only), "summary".
9696
Do NOT add "schema_version", "review_result", "id", "review_date", or any other key —
9797
the validator will reject any extra keys and force a re-dispatch.
9898
The "scores" object MUST contain ALL five dimensions listed below with integer 1–5 or "N/A".
@@ -115,13 +115,15 @@ will be rejected by the validator and force a re-dispatch.
115115
"severity": "critical|important|minor",
116116
"category": "<one of the 5 score dimensions>",
117117
"description": "...",
118-
"file": "path/to/file"
118+
"file": "path/to/file (MUST be from the diff being reviewed)"
119119
}
120120
],
121121
"summary": "2-3 sentence assessment"
122122
}
123123
```
124124

125+
**`file` field constraint**: The `file` field in each finding MUST reference a file present in the diff being reviewed (DIFF_FILE). Do not use files from your recommendations (e.g., test files that should be created) — only files that appear in the actual diff. `record-review.sh` validates that finding files overlap with changed files and rejects the review if they do not.
126+
125127
---
126128

127129
## Scoring Rules

plugins/dso/agents/code-reviewer-deep-hygiene.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name: code-reviewer-deep-hygiene
33
model: sonnet
44
description: Deep-tier hygiene/design specialist (Sonnet C): focused on hygiene, design, and maintainability.
55
---
6-
<!-- content-hash: ff89bbdf4a3ffd69f24e1e87a394c3a5bea7444d9fb17202094107ff6cfdfe8c -->
6+
<!-- content-hash: 4e79d423e1ec1c1b351a07a0d816c67e4955f9039cf6dc28ba256fe30760a08b -->
77
<!-- generated by build-review-agents.sh — do not edit manually -->
88

99
# Code Reviewer — Universal Base Guidance
@@ -92,7 +92,7 @@ Produce a JSON object with this EXACT schema (for writing to disk in Step 3).
9292

9393
VIOLATIONS CAUSE RE-DISPATCH.
9494

95-
REQUIRED: EXACTLY three top-level keys: "scores", "findings", "summary".
95+
REQUIRED: EXACTLY three top-level keys: "scores", "findings" (file field must reference diff files only), "summary".
9696
Do NOT add "schema_version", "review_result", "id", "review_date", or any other key —
9797
the validator will reject any extra keys and force a re-dispatch.
9898
The "scores" object MUST contain ALL five dimensions listed below with integer 1–5 or "N/A".
@@ -115,13 +115,15 @@ will be rejected by the validator and force a re-dispatch.
115115
"severity": "critical|important|minor",
116116
"category": "<one of the 5 score dimensions>",
117117
"description": "...",
118-
"file": "path/to/file"
118+
"file": "path/to/file (MUST be from the diff being reviewed)"
119119
}
120120
],
121121
"summary": "2-3 sentence assessment"
122122
}
123123
```
124124

125+
**`file` field constraint**: The `file` field in each finding MUST reference a file present in the diff being reviewed (DIFF_FILE). Do not use files from your recommendations (e.g., test files that should be created) — only files that appear in the actual diff. `record-review.sh` validates that finding files overlap with changed files and rejects the review if they do not.
126+
125127
---
126128

127129
## Scoring Rules

plugins/dso/agents/code-reviewer-deep-verification.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name: code-reviewer-deep-verification
33
model: sonnet
44
description: Deep-tier verification specialist (Sonnet B): focused exclusively on verification — test presence, quality, edge case coverage, mock correctness.
55
---
6-
<!-- content-hash: d814c1f3e94c5d3b14ebdcb18b0f4251fc0da7811ac48f42d26a09ea7e8a3e46 -->
6+
<!-- content-hash: 602c046ebbc4c7b30de2b9977ef704f29432a3d17e0eec13781409a3a48e7c4a -->
77
<!-- generated by build-review-agents.sh — do not edit manually -->
88

99
# Code Reviewer — Universal Base Guidance
@@ -92,7 +92,7 @@ Produce a JSON object with this EXACT schema (for writing to disk in Step 3).
9292

9393
VIOLATIONS CAUSE RE-DISPATCH.
9494

95-
REQUIRED: EXACTLY three top-level keys: "scores", "findings", "summary".
95+
REQUIRED: EXACTLY three top-level keys: "scores", "findings" (file field must reference diff files only), "summary".
9696
Do NOT add "schema_version", "review_result", "id", "review_date", or any other key —
9797
the validator will reject any extra keys and force a re-dispatch.
9898
The "scores" object MUST contain ALL five dimensions listed below with integer 1–5 or "N/A".
@@ -115,13 +115,15 @@ will be rejected by the validator and force a re-dispatch.
115115
"severity": "critical|important|minor",
116116
"category": "<one of the 5 score dimensions>",
117117
"description": "...",
118-
"file": "path/to/file"
118+
"file": "path/to/file (MUST be from the diff being reviewed)"
119119
}
120120
],
121121
"summary": "2-3 sentence assessment"
122122
}
123123
```
124124

125+
**`file` field constraint**: The `file` field in each finding MUST reference a file present in the diff being reviewed (DIFF_FILE). Do not use files from your recommendations (e.g., test files that should be created) — only files that appear in the actual diff. `record-review.sh` validates that finding files overlap with changed files and rejects the review if they do not.
126+
125127
---
126128

127129
## Scoring Rules

plugins/dso/agents/code-reviewer-light.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name: code-reviewer-light
33
model: haiku
44
description: Light-tier code reviewer: single-pass, highest-signal checklist for fast feedback on low-to-medium-risk changes.
55
---
6-
<!-- content-hash: 5673f0c1e9c4b3a2b26ead04e6d15316679f75c7e03de602dc4eabcc01a40463 -->
6+
<!-- content-hash: fe59b4bf97783cc606b8b560efe24fd7d26c0bbeaa5bbc8936cb71c31797959e -->
77
<!-- generated by build-review-agents.sh — do not edit manually -->
88

99
# Code Reviewer — Universal Base Guidance
@@ -92,7 +92,7 @@ Produce a JSON object with this EXACT schema (for writing to disk in Step 3).
9292

9393
VIOLATIONS CAUSE RE-DISPATCH.
9494

95-
REQUIRED: EXACTLY three top-level keys: "scores", "findings", "summary".
95+
REQUIRED: EXACTLY three top-level keys: "scores", "findings" (file field must reference diff files only), "summary".
9696
Do NOT add "schema_version", "review_result", "id", "review_date", or any other key —
9797
the validator will reject any extra keys and force a re-dispatch.
9898
The "scores" object MUST contain ALL five dimensions listed below with integer 1–5 or "N/A".
@@ -115,13 +115,15 @@ will be rejected by the validator and force a re-dispatch.
115115
"severity": "critical|important|minor",
116116
"category": "<one of the 5 score dimensions>",
117117
"description": "...",
118-
"file": "path/to/file"
118+
"file": "path/to/file (MUST be from the diff being reviewed)"
119119
}
120120
],
121121
"summary": "2-3 sentence assessment"
122122
}
123123
```
124124

125+
**`file` field constraint**: The `file` field in each finding MUST reference a file present in the diff being reviewed (DIFF_FILE). Do not use files from your recommendations (e.g., test files that should be created) — only files that appear in the actual diff. `record-review.sh` validates that finding files overlap with changed files and rejects the review if they do not.
126+
125127
---
126128

127129
## Scoring Rules

plugins/dso/agents/code-reviewer-standard.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name: code-reviewer-standard
33
model: sonnet
44
description: Standard-tier code reviewer: comprehensive review across all five scoring dimensions for moderate-to-high-risk changes.
55
---
6-
<!-- content-hash: 00da22af428ebe07e30ae88b6f3af311c37719a343780d3ab8a5fe4c15b07972 -->
6+
<!-- content-hash: 6b7521de5275fb0e3e381a422bb5ecef99bba2096586edc65d21a9642540b740 -->
77
<!-- generated by build-review-agents.sh — do not edit manually -->
88

99
# Code Reviewer — Universal Base Guidance
@@ -92,7 +92,7 @@ Produce a JSON object with this EXACT schema (for writing to disk in Step 3).
9292

9393
VIOLATIONS CAUSE RE-DISPATCH.
9494

95-
REQUIRED: EXACTLY three top-level keys: "scores", "findings", "summary".
95+
REQUIRED: EXACTLY three top-level keys: "scores", "findings" (file field must reference diff files only), "summary".
9696
Do NOT add "schema_version", "review_result", "id", "review_date", or any other key —
9797
the validator will reject any extra keys and force a re-dispatch.
9898
The "scores" object MUST contain ALL five dimensions listed below with integer 1–5 or "N/A".
@@ -115,13 +115,15 @@ will be rejected by the validator and force a re-dispatch.
115115
"severity": "critical|important|minor",
116116
"category": "<one of the 5 score dimensions>",
117117
"description": "...",
118-
"file": "path/to/file"
118+
"file": "path/to/file (MUST be from the diff being reviewed)"
119119
}
120120
],
121121
"summary": "2-3 sentence assessment"
122122
}
123123
```
124124

125+
**`file` field constraint**: The `file` field in each finding MUST reference a file present in the diff being reviewed (DIFF_FILE). Do not use files from your recommendations (e.g., test files that should be created) — only files that appear in the actual diff. `record-review.sh` validates that finding files overlap with changed files and rejects the review if they do not.
126+
125127
---
126128

127129
## Scoring Rules

plugins/dso/docs/workflows/REVIEW-WORKFLOW.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -393,6 +393,8 @@ REPO_ROOT=$(git rev-parse --show-toplevel)
393393

394394
`record-review.sh` reads scores, summary, and findings from `reviewer-findings.json`, verifies `--reviewer-hash` integrity, validates findings against scores, checks file overlap with the actual diff, verifies `--expected-hash` against the current diff hash, and writes the review state file that the commit gate checks. If it rejects, fix and retry.
395395

396+
**File-overlap rejection recovery**: If `record-review.sh` exits with `ERROR: reviewer findings files do not overlap with any changed files in the diff`, the reviewer's `file` fields in its findings reference files not in the diff (e.g., test files from verification recommendations instead of the source files being reviewed). Do NOT escalate to the user immediately. Instead: (1) re-dispatch the review with a higher-tier reviewer (e.g., light → standard) which is more reliable at correctly reporting diff files in the `file` field; (2) if the re-dispatched reviewer also produces non-overlapping files, THEN escalate to the user.
397+
396398
**IMPORTANT — always use `compute-diff-hash.sh`**: Never compute the diff hash via raw `git diff | shasum` — the canonical script applies pathspec exclusions (`.tickets-tracker/`, snapshots, images) and checkpoint-aware diff base detection. Untracked files are excluded (new files must be staged before review). A raw pipeline produces a completely different hash and will cause `--expected-hash` mismatch errors.
397399

398400
## After Review

plugins/dso/docs/workflows/prompts/reviewer-base.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ Produce a JSON object with this EXACT schema (for writing to disk in Step 3).
8484

8585
VIOLATIONS CAUSE RE-DISPATCH.
8686

87-
REQUIRED: EXACTLY three top-level keys: "scores", "findings", "summary".
87+
REQUIRED: EXACTLY three top-level keys: "scores", "findings" (file field must reference diff files only), "summary".
8888
Do NOT add "schema_version", "review_result", "id", "review_date", or any other key —
8989
the validator will reject any extra keys and force a re-dispatch.
9090
The "scores" object MUST contain ALL five dimensions listed below with integer 1–5 or "N/A".
@@ -107,13 +107,15 @@ will be rejected by the validator and force a re-dispatch.
107107
"severity": "critical|important|minor",
108108
"category": "<one of the 5 score dimensions>",
109109
"description": "...",
110-
"file": "path/to/file"
110+
"file": "path/to/file (MUST be from the diff being reviewed)"
111111
}
112112
],
113113
"summary": "2-3 sentence assessment"
114114
}
115115
```
116116

117+
**`file` field constraint**: The `file` field in each finding MUST reference a file present in the diff being reviewed (DIFF_FILE). Do not use files from your recommendations (e.g., test files that should be created) — only files that appear in the actual diff. `record-review.sh` validates that finding files overlap with changed files and rejects the review if they do not.
118+
117119
---
118120

119121
## Scoring Rules

plugins/dso/hooks/lib/red-zone.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,8 @@ parse_failing_tests_from_output() {
8282
|| true
8383

8484
# Bash-style (assert_pass_if_clean): "FAIL: test_name" on stderr merged into output
85-
grep -oE '^FAIL: [a-zA-Z_][a-zA-Z0-9_-]*' "$output_file" \
85+
# No ^ anchor — many test scripts output indented " FAIL: test_name" lines
86+
grep -oE 'FAIL: [a-zA-Z_][a-zA-Z0-9_-]*' "$output_file" \
8687
| sed 's/^FAIL: //' \
8788
|| true
8889

0 commit comments

Comments
 (0)