You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add opt-in executive summary and focus areas to review-pull-request
Adds a new `executive_summary` parameter to the `review-pull-request`
template (`auto` default, plus `always` and `never`). When triggered,
the template produces a holistic change narrative and a short
suggested-focus-areas list to help a reviewer orient themselves on
broad-scope or large-diff PRs and decide where to concentrate
attention.
The narrative and focus areas are surfaced via the report's Problem
Statement section in document mode and presented to the reviewer
before findings walk-through in action mode. They are never auto-posted
to the GitHub review body. Phase 2 per-file coverage is preserved;
focus areas advise reviewer attention only and never reduce coverage.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copy file name to clipboardExpand all lines: templates/review-pull-request.md
+106-4Lines changed: 106 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -22,6 +22,7 @@ params:
22
22
additional_protocols: "Optional — specific protocols to apply (e.g., memory-safety-c, thread-safety)"
23
23
context: "What this PR does, which system it affects, any known concerns"
24
24
output_mode: "Output mode — 'document' (produce investigation report) or 'action' (post review comments via gh CLI)"
25
+
executive_summary: "Whether to include a holistic change narrative explaining what the PR is actually doing — 'auto' (default; produced for broad-scope or large PRs based on diff size, breadth, and impact signals), 'always', or 'never'. Blank or invalid values are treated as 'auto'."
25
26
input_contract: null
26
27
output_contract:
27
28
type: investigation-report
@@ -51,6 +52,8 @@ isolation, but the diff, commit history, linked issues, and CI status.
51
52
52
53
**Output Mode**: {{output_mode}}
53
54
55
+
**Executive Summary Mode**: {{executive_summary}}
56
+
54
57
## Instructions
55
58
56
59
### Phase 1: Gather PR Context
@@ -78,6 +81,83 @@ isolation, but the diff, commit history, linked issues, and CI status.
78
81
protocols are relevant (e.g., `memory-safety-c` for C,
79
82
`thread-safety` for concurrent code). Apply these in Phase 2.
80
83
84
+
5.**Establish Change Narrative** (when applicable per `executive_summary`).
85
+
86
+
**Normalization.** If `executive_summary` is blank, unset, or not one
87
+
of `auto`, `always`, or `never`, treat it as `auto`. This guards
88
+
against missing values when the template is packaged as a Copilot
89
+
prompt file or agentic workflow.
90
+
91
+
**Determine scope:**
92
+
-`never` — skip the rest of this step.
93
+
-`always` — produce the narrative.
94
+
-`auto` (default) — produce the narrative when **any** of these
95
+
triggers fires:
96
+
-**Size signals**: more than ~300 lines changed (additions +
97
+
deletions, excluding lockfiles, generated code, and vendored
98
+
deps), OR more than ~15 source files modified (same exclusions).
99
+
If exact filtered counts are unavailable, estimate
100
+
conservatively rather than spending excessive effort calculating.
101
+
-**Breadth signals**: the PR touches multiple unrelated subsystems
102
+
(e.g., distinct top-level code roots that don't simply mirror
103
+
each other like `src/` and `tests/`).
104
+
-**Impact signals**: the PR introduces public API or interface
105
+
changes, schema or data-model changes, auth / permission /
106
+
security changes, CI or deployment / infrastructure changes, or
107
+
broad dependency or configuration changes.
108
+
-**Description-gap signals**: the PR description is sparse
109
+
(< 2 short paragraphs) AND total change exceeds 100 LOC.
110
+
111
+
**Skip condition (`auto` only):** even when a trigger fires, skip
112
+
the narrative if the PR description already provides a clear,
113
+
accurate change overview AND the diff does not reveal materially
| Problem Statement | What the PR claims to change and why. When the change narrative was produced in Phase 1, lead this section with the holistic narrative, then the suggested focus areas (if any were produced), then state the author's motivation.|
| Coverage | Files examined, search method, exclusions, limitations. In `auto` mode for `executive_summary`, briefly note whether the change narrative was produced and the triggering condition (or reason for skipping).|
171
251
172
252
#### Action Mode (`output_mode: action`)
173
253
174
254
1.**Present findings** to the user using the document structure above.
255
+
If a change narrative or suggested focus areas were produced in
256
+
Phase 1, present them (from `Problem Statement`) before walking
257
+
through individual findings.
175
258
2.**Ask the user to confirm** which findings to post as review comments.
176
259
Present each finding (or batch by file) and ask:
177
260
- Post this comment? (yes / skip / edit)
@@ -185,7 +268,17 @@ PR review concepts to report sections:
185
268
only; code references, file paths, and quoted reviewer text are
186
269
exempt.
187
270
3.**Post confirmed findings** as inline review comments using a JSON
188
-
payload file so `comments` is sent as an array, not a string:
271
+
payload file so `comments` is sent as an array, not a string.
272
+
273
+
**Constructing the `body` field**: the review `body` is the
Do NOT prepend the Phase 1 change narrative or suggested focus
276
+
areas — the PR author already wrote the PR description, and
277
+
reviewer feedback should focus on the verdict, not on re-describing
278
+
the change. These are reviewer-internal grounding artifacts; do not
279
+
add them to the body unless the user explicitly requests it as part
280
+
of confirming the review.
281
+
189
282
```
190
283
cat > review.json <<'EOF'
191
284
{
@@ -225,6 +318,12 @@ PR review concepts to report sections:
225
318
action mode, you may post an `APPROVE`, `REQUEST_CHANGES`, or `COMMENT`
226
319
review only after explicit user confirmation, and you must not merge.
227
320
- Do NOT modify the PR branch or push commits.
321
+
- Do NOT speculate in the change narrative or suggested focus areas
322
+
beyond what is visible in the diff, PR description, or linked
323
+
issues — including author intent that is not explicitly stated.
324
+
- Do NOT use suggested focus areas to reduce Phase 2 coverage. Focus
325
+
areas advise reviewer attention only; every changed file remains
326
+
subject to analysis.
228
327
229
328
## Quality Checklist
230
329
@@ -238,4 +337,7 @@ Before finalizing, verify:
238
337
-[ ] Linked issues were checked against the actual changes
239
338
-[ ] CI status was noted (or stated as unavailable)
240
339
-[ ] At least 3 findings have been re-verified against the diff
340
+
-[ ] In `auto` mode for `executive_summary`, the decision to produce or skip the change narrative was made deliberately; in document mode, the decision is also recorded in the Coverage section
341
+
-[ ] If the change narrative was produced, every claim in it is grounded in the diff, PR description, linked issues, or context files (no speculation about author intent)
342
+
-[ ] If suggested focus areas were produced, each item is anchored to an observable impact signal that fired or to concentration of complexity in the diff (no fabrication)
241
343
-[ ] In action mode: user confirmation was obtained before every post
0 commit comments