pr-shepherd 2.4.1 → 2.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (70) hide show
  1. package/.claude-plugin/plugin.json +3 -3
  2. package/.grok-plugin/marketplace.json +1 -1
  3. package/README.md +7 -9
  4. package/bin/classify/apply.d.mts +8 -1
  5. package/bin/classify/apply.mjs +37 -47
  6. package/bin/classify/items.d.mts +7 -0
  7. package/bin/classify/items.mjs +57 -0
  8. package/bin/classify/standard/coderabbit-notices.d.mts +2 -1
  9. package/bin/classify/standard/coderabbit-notices.mjs +33 -1
  10. package/bin/classify/standard/index.d.mts +2 -1
  11. package/bin/classify/standard/index.mjs +2 -1
  12. package/bin/classify/types.d.mts +8 -3
  13. package/bin/cli/iterate-lean.mjs +3 -0
  14. package/bin/cli/list-formatters.d.mts +1 -0
  15. package/bin/cli/list-formatters.mjs +3 -1
  16. package/bin/cli/triage-formatter.mjs +6 -1
  17. package/bin/commands/check-activity.mjs +2 -1
  18. package/bin/commands/check-fingerprint.mjs +1 -0
  19. package/bin/commands/check.mjs +39 -9
  20. package/bin/commands/iterate/check-instructions.d.mts +2 -0
  21. package/bin/commands/iterate/check-instructions.mjs +14 -0
  22. package/bin/commands/iterate/classify.d.mts +17 -3
  23. package/bin/commands/iterate/classify.mjs +105 -66
  24. package/bin/commands/iterate/escalate.mjs +6 -1
  25. package/bin/commands/iterate/index.mjs +16 -24
  26. package/bin/commands/iterate/render.d.mts +2 -11
  27. package/bin/commands/iterate/render.mjs +10 -19
  28. package/bin/commands/iterate/stall.mjs +3 -0
  29. package/bin/commands/iterate/triage.d.mts +1 -0
  30. package/bin/commands/iterate/triage.mjs +18 -13
  31. package/bin/commands/resolve-mutate.mjs +39 -4
  32. package/bin/commands/resolve-review-guard.d.mts +19 -0
  33. package/bin/commands/resolve-review-guard.mjs +61 -0
  34. package/bin/comments/resolve.mjs +4 -4
  35. package/bin/comments/review-thread-markers.d.mts +1 -1
  36. package/bin/comments/review-thread-markers.mjs +23 -9
  37. package/bin/comments/superseded-approvals.d.mts +28 -0
  38. package/bin/comments/superseded-approvals.mjs +99 -0
  39. package/bin/config/schema.d.mts +2 -0
  40. package/bin/config/schema.mjs +1 -0
  41. package/bin/github/batch-parsers.mjs +31 -0
  42. package/bin/github/batch-raw-types.d.mts +3 -0
  43. package/bin/github/batch-viewer.d.mts +2 -2
  44. package/bin/github/batch.mjs +1 -1
  45. package/bin/github/gql/batch-pr-page.gql +8 -2
  46. package/bin/github/gql/batch-pr.gql +4 -1
  47. package/bin/github/poll-summary-review-helpers.d.mts +20 -0
  48. package/bin/github/poll-summary-review-helpers.mjs +81 -0
  49. package/bin/github/poll-summary-review.mjs +37 -46
  50. package/bin/github/poll-summary-rule-auto-resolve.mjs +1 -0
  51. package/bin/github/poll-summary-rule-items.d.mts +1 -1
  52. package/bin/github/poll-summary-rule-items.mjs +3 -2
  53. package/bin/github/rest-batch-snapshot.mjs +25 -1
  54. package/bin/github/review-unresolved-threads.d.mts +13 -0
  55. package/bin/github/review-unresolved-threads.mjs +152 -0
  56. package/bin/github/stack-handoff-page.mjs +5 -1
  57. package/bin/state/seen-comments.d.mts +3 -1
  58. package/bin/state/seen-comments.mjs +28 -2
  59. package/bin/types/escalate.d.mts +1 -0
  60. package/bin/types/github.d.mts +7 -1
  61. package/bin/types/iterate.d.mts +4 -2
  62. package/bin/types/report.d.mts +8 -0
  63. package/package.json +5 -5
  64. package/plugins/pr-shepherd/.claude-plugin/plugin.json +3 -3
  65. package/plugins/pr-shepherd/.codex-plugin/plugin.json +6 -6
  66. package/plugins/pr-shepherd/skills/setup-pr-shepherd/SKILL.md +1 -1
  67. package/plugins/pr-shepherd/skills/setup-pr-shepherd/references/classifiers.md +3 -3
  68. package/plugins/pr-shepherd/skills/setup-pr-shepherd/references/upstream-standard-rule.md +2 -2
  69. package/pr-shepherd.schema.json +4 -0
  70. package/src/classify/types.mts +9 -1
@@ -69,6 +69,20 @@ export function buildResolveCommandInstruction(resolveCommand, rendered) {
69
69
  }
70
70
  return [`Run, even if no code changed: \`${rendered}\``];
71
71
  }
72
+ /** Build the separate review-dismissal / review-hiding step once all inline items are resolved. */
73
+ export function buildDismissReviewsCommandInstruction(dismissReviewsCommand, rendered) {
74
+ if (!dismissReviewsCommand?.hasMutations)
75
+ return [];
76
+ if (dismissReviewsCommand.requiresDismissMessage) {
77
+ const verb = dismissReviewsCommand.argv.includes("--minimize-comment-ids")
78
+ ? "dismiss and hide"
79
+ : "dismiss";
80
+ return [
81
+ `\`$CHANGE_MESSAGE\`: one sentence on what changed. Run even if no code changed to ${verb} resolved reviews: \`${rendered}\``,
82
+ ];
83
+ }
84
+ return [`Run to hide resolved reviews: \`${rendered}\``];
85
+ }
72
86
  /** One pointer. Conclusion, rerun, and bare-check rules live in the CI playbook. */
73
87
  export function buildFailingCheckInstructions(checks) {
74
88
  if (checks.length === 0)
@@ -1,18 +1,32 @@
1
1
  import type { AgentThread, Review, ResolveCommand, AgentCheck, ReviewThread, ViewerAuthorization } from "../../types.mts";
2
2
  import { type NormalizedBotUsernames } from "../../comments/authors.mts";
3
3
  import type { MinimizeCommentsPolicy, ResolveOtherHumanThreads } from "../../config/load.mts";
4
+ export interface ClassifyReviewSummaryOptions {
5
+ minimizeSupersededApprovals?: boolean;
6
+ supersededApprovals?: Review[];
7
+ changesRequestedReviews?: Review[];
8
+ latestReviews?: Array<{
9
+ login: string;
10
+ state: string;
11
+ }>;
12
+ }
4
13
  export declare function classifyReviewSummaries(summaries: {
5
14
  firstLook: Review[];
6
15
  seen: Review[];
7
16
  edited: Review[];
8
- }, approvals: Review[], minimizeApprovals: boolean, minimizeComments?: MinimizeCommentsPolicy | undefined, botUsernames?: NormalizedBotUsernames, unresolvedThreads?: ReadonlyArray<Pick<ReviewThread, "reviewId">>, ruleAutoResolveIds?: string[]): {
17
+ }, approvals: Review[], minimizeApprovals: boolean, minimizeComments?: MinimizeCommentsPolicy | undefined, botUsernames?: NormalizedBotUsernames, unresolvedThreads?: ReadonlyArray<Pick<ReviewThread, "reviewId">>, ruleAutoResolveIds?: string[], options?: ClassifyReviewSummaryOptions): {
9
18
  minimizeIds: string[];
10
- selfMinimizeIds: string[];
11
19
  firstLookSummaries: Review[];
12
20
  editedSummaries: Review[];
13
21
  surfacedApprovals: Review[];
14
22
  };
15
- export declare function buildResolveCommand(threads: AgentThread[], resolutionOnlyThreads: ReviewThread[], allCommentIds: string[], reviews: Review[], checks: AgentCheck[], prReference: string | number, botUsernames?: NormalizedBotUsernames, ruleAutoResolveThreadIds?: string[], viewerAuthorization?: ViewerAuthorization, authorizationThreads?: ReviewThread[], resolveOtherHumanThreads?: ResolveOtherHumanThreads): {
23
+ export interface BuildResolveReviewOptions {
24
+ reviewMinimizeIds?: string[];
25
+ blockedReviewIds?: ReadonlySet<string>;
26
+ minimizeComments?: MinimizeCommentsPolicy;
27
+ }
28
+ export declare function buildResolveCommand(threads: AgentThread[], resolutionOnlyThreads: ReviewThread[], allCommentIds: string[], reviews: Review[], checks: AgentCheck[], prReference: string | number, botUsernames?: NormalizedBotUsernames, ruleAutoResolveThreadIds?: string[], viewerAuthorization?: ViewerAuthorization, authorizationThreads?: ReviewThread[], resolveOtherHumanThreads?: ResolveOtherHumanThreads, reviewOptions?: BuildResolveReviewOptions): {
16
29
  resolveCommand: ResolveCommand;
17
30
  resolveOnlyCommand?: ResolveCommand;
31
+ dismissReviewsCommand?: ResolveCommand;
18
32
  };
@@ -1,5 +1,6 @@
1
1
  import { buildPrShepherdCommand } from "../../cli/runner.mjs";
2
2
  import { shouldMinimizeAuthor } from "../../comments/minimize-policy.mjs";
3
+ import { findSupersededApprovalIds, reviewOrderingEntriesFromReviews, } from "../../comments/superseded-approvals.mjs";
3
4
  import { isConfiguredBotAuthor, isHumanAuthor, } from "../../comments/authors.mjs";
4
5
  import { buildThreadMutationRouting } from "./thread-mutation-routing.mjs";
5
6
  import { canGenerateGithubMutation } from "../../github/mutation-policy.mjs";
@@ -15,38 +16,55 @@ function dedupeIds(ids) {
15
16
  }
16
17
  return out;
17
18
  }
18
- export function classifyReviewSummaries(summaries, approvals, minimizeApprovals, minimizeComments = "all", botUsernames = new Set(), unresolvedThreads = [], ruleAutoResolveIds = []) {
19
+ export function classifyReviewSummaries(summaries, approvals, minimizeApprovals, minimizeComments = "all", botUsernames = new Set(), unresolvedThreads = [], ruleAutoResolveIds = [], options = {}) {
19
20
  const blockedReviewIds = new Set(unresolvedThreads.flatMap((t) => (t.reviewId !== undefined ? [t.reviewId] : [])));
20
21
  const eligible = (r) => canGenerateGithubMutation(r.viewerCanMinimize, "minimize") &&
21
22
  shouldMinimizeAuthor(r.authorType, minimizeComments, r.author, botUsernames) &&
22
23
  !blockedReviewIds.has(r.id);
23
- // First-look summaries still need one tick to surface their body to the agent,
24
- // so their minimize IDs ride in the agent-facing apply command. Seen summaries
25
- // (already surfaced in a prior tick) have no new content to show — the CLI
26
- // self-minimizes them in-process (selfMinimizeIds) instead of routing a
27
- // cosmetic-only mutation through triage (issue #313). Edited summaries are
28
- // excluded entirely: they are already minimized server-side (body changed after
29
- // minimize was applied).
30
- const minimizeIds = summaries.firstLook.filter(eligible).map((r) => r.id);
31
- const selfMinimizeIds = summaries.seen.filter(eligible).map((r) => r.id);
24
+ // Both first-look and already-seen summaries stay in the agent-facing review
25
+ // command once all of their inline threads are resolved — never hidden
26
+ // automatically in-process. Edited summaries are excluded: they are already
27
+ // minimized server-side (body changed after minimize was applied).
28
+ const minimizeIds = dedupeIds([...summaries.firstLook, ...summaries.seen].filter(eligible).map((r) => r.id));
32
29
  // Rule-matched summaries are already suppressed from agent output; bypass normal
33
- // policy gates. Keep the two sets disjoint.
30
+ // policy gates, while still waiting for any unresolved inline threads.
34
31
  for (const id of ruleAutoResolveIds) {
35
- if (!minimizeIds.includes(id) && !selfMinimizeIds.includes(id))
32
+ if (!blockedReviewIds.has(id) && !minimizeIds.includes(id))
36
33
  minimizeIds.push(id);
37
34
  }
38
- if (minimizeApprovals) {
39
- const surfacedApprovals = [];
40
- for (const r of approvals) {
41
- if (canGenerateGithubMutation(r.viewerCanMinimize, "minimize") &&
42
- shouldMinimizeAuthor(r.authorType, minimizeComments, r.author, botUsernames))
43
- minimizeIds.push(r.id);
44
- else
45
- surfacedApprovals.push(r);
35
+ const minimizeSupersededApprovals = options.minimizeSupersededApprovals ?? true;
36
+ const candidateApprovalsById = new Map();
37
+ for (const r of options.supersededApprovals ?? [])
38
+ candidateApprovalsById.set(r.id, r);
39
+ for (const r of approvals) {
40
+ if (!candidateApprovalsById.has(r.id))
41
+ candidateApprovalsById.set(r.id, r);
42
+ }
43
+ const candidateApprovals = [...candidateApprovalsById.values()];
44
+ if (minimizeApprovals || minimizeSupersededApprovals) {
45
+ const precomputed = new Set((options.supersededApprovals ?? []).map((r) => r.id));
46
+ const supersededIds = minimizeApprovals
47
+ ? new Set(candidateApprovals.map((r) => r.id))
48
+ : findSupersededApprovalIds({
49
+ reviews: reviewOrderingEntriesFromReviews({
50
+ approvedReviews: candidateApprovals,
51
+ changesRequestedReviews: options.changesRequestedReviews ?? [],
52
+ reviewSummaries: [...summaries.firstLook, ...summaries.seen, ...summaries.edited],
53
+ }),
54
+ latestReviews: options.latestReviews,
55
+ precomputedSupersededIds: precomputed,
56
+ });
57
+ const minimizedApprovalIds = new Set();
58
+ for (const r of candidateApprovals) {
59
+ if (supersededIds.has(r.id) && eligible(r)) {
60
+ if (!minimizeIds.includes(r.id))
61
+ minimizeIds.push(r.id);
62
+ minimizedApprovalIds.add(r.id);
63
+ }
46
64
  }
65
+ const surfacedApprovals = approvals.filter((r) => !minimizedApprovalIds.has(r.id));
47
66
  return {
48
67
  minimizeIds,
49
- selfMinimizeIds,
50
68
  firstLookSummaries: summaries.firstLook,
51
69
  editedSummaries: summaries.edited,
52
70
  surfacedApprovals,
@@ -54,7 +72,6 @@ export function classifyReviewSummaries(summaries, approvals, minimizeApprovals,
54
72
  }
55
73
  return {
56
74
  minimizeIds,
57
- selfMinimizeIds,
58
75
  firstLookSummaries: summaries.firstLook,
59
76
  editedSummaries: summaries.edited,
60
77
  surfacedApprovals: approvals,
@@ -69,7 +86,7 @@ function pushAdoptExistingReplies(argv, hasReply) {
69
86
  if (hasReply && durableStateRequested())
70
87
  argv.push("--adopt-existing-replies");
71
88
  }
72
- export function buildResolveCommand(threads, resolutionOnlyThreads, allCommentIds, reviews, checks, prReference, botUsernames = new Set(), ruleAutoResolveThreadIds = [], viewerAuthorization, authorizationThreads = [], resolveOtherHumanThreads = "none") {
89
+ export function buildResolveCommand(threads, resolutionOnlyThreads, allCommentIds, reviews, checks, prReference, botUsernames = new Set(), ruleAutoResolveThreadIds = [], viewerAuthorization, authorizationThreads = [], resolveOtherHumanThreads = "none", reviewOptions = {}) {
73
90
  const allThreads = [...threads, ...resolutionOnlyThreads];
74
91
  const routed = buildThreadMutationRouting(allThreads, botUsernames, ruleAutoResolveThreadIds, resolveOtherHumanThreads);
75
92
  const canReply = new Set(authorizationThreads
@@ -86,47 +103,71 @@ export function buildResolveCommand(threads, resolutionOnlyThreads, allCommentId
86
103
  const pairedResolveThreadIds = routed.pairedResolveThreadIds.filter((id) => canReply.has(id) && canResolve.has(id));
87
104
  const standaloneResolveThreadIds = routed.standaloneResolveThreadIds.filter((id) => canResolve.has(id));
88
105
  const resolveThreadIds = dedupeIds([...pairedResolveThreadIds, ...standaloneResolveThreadIds]);
89
- // Bot/non-human CHANGES_REQUESTED reviews are auto-dismissed after the agent pushes a fix.
90
- // Human reviews are left for the reviewer to re-review or dismiss themselves.
91
- const dismissReviewIds = dedupeIds(canGenerateGithubMutation(viewerAuthorization?.viewerCanAdminister, "dismiss")
92
- ? reviews
93
- .filter((r) => !isHumanAuthor(r) || isConfiguredBotAuthor(r, botUsernames))
94
- .map((r) => r.id)
95
- : []);
96
- const hasReply = replyThreadIds.length > 0;
106
+ // Bot/non-human CHANGES_REQUESTED reviews are dismissed and minimized in a separate command
107
+ // only once all of their inline threads are resolved. Human reviews are left for the reviewer.
108
+ const blockedReviewIds = new Set(reviewOptions.blockedReviewIds);
109
+ for (const thread of allThreads) {
110
+ if (thread.reviewId !== undefined)
111
+ blockedReviewIds.add(thread.reviewId);
112
+ }
113
+ const dismissibleReviews = canGenerateGithubMutation(viewerAuthorization?.viewerCanAdminister, "dismiss")
114
+ ? reviews.filter((r) => (!isHumanAuthor(r) || isConfiguredBotAuthor(r, botUsernames)) &&
115
+ !blockedReviewIds.has(r.id))
116
+ : [];
117
+ const dismissReviewIds = dedupeIds(dismissibleReviews.map((r) => r.id));
118
+ const minimizePolicy = reviewOptions.minimizeComments ?? "all";
119
+ const dismissMinimizeIds = dismissibleReviews
120
+ .filter((r) => r.isMinimized !== true &&
121
+ canGenerateGithubMutation(r.viewerCanMinimize, "minimize") &&
122
+ shouldMinimizeAuthor(r.authorType, minimizePolicy, r.author, botUsernames))
123
+ .map((r) => r.id);
124
+ const reviewMinimizeIds = dedupeIds([
125
+ ...dismissMinimizeIds,
126
+ ...(reviewOptions.reviewMinimizeIds ?? []),
127
+ ]);
97
128
  const hasDismiss = dismissReviewIds.length > 0;
98
- // Mutations that require --message: replies (to human threads) and dismissals (of bot CR reviews).
99
- const hasMessageMutations = hasReply || hasDismiss;
129
+ const hasReviewMinimize = reviewMinimizeIds.length > 0;
130
+ let dismissReviewsCommand;
131
+ if (hasDismiss || hasReviewMinimize) {
132
+ const reviewArgv = buildPrShepherdCommand(["apply", "review", String(prReference)]).argv;
133
+ if (hasReviewMinimize) {
134
+ reviewArgv.push("--minimize-comment-ids", reviewMinimizeIds.join(","));
135
+ }
136
+ if (hasDismiss) {
137
+ reviewArgv.push("--dismiss-review-ids", dismissReviewIds.join(","));
138
+ reviewArgv.push("--message", "$CHANGE_MESSAGE");
139
+ }
140
+ dismissReviewsCommand = {
141
+ argv: reviewArgv,
142
+ requiresHeadSha: hasDismiss,
143
+ requiresDismissMessage: hasDismiss,
144
+ ...(hasDismiss ? { dismissReviewIds } : undefined),
145
+ hasMutations: true,
146
+ };
147
+ }
148
+ const hasReply = replyThreadIds.length > 0;
100
149
  const hasResolveOrMinimize = resolveThreadIds.length > 0 || allCommentIds.length > 0;
101
150
  const hasStandaloneResolveOrMinimize = standaloneResolveThreadIds.length > 0 || allCommentIds.length > 0;
102
- if (hasMessageMutations && hasStandaloneResolveOrMinimize) {
103
- // Split: message-bearing mutations plus their paired viewer-authored resolves ride in
104
- // resolveArgv; standalone resolve/minimize mutations go in resolveOnlyArgv so they can
105
- // run without SHA or message.
151
+ if (hasReply && hasStandaloneResolveOrMinimize) {
152
+ // Split: reply mutations plus their paired viewer-authored resolves ride in
153
+ // resolveArgv; standalone resolve/PR-comment minimize mutations go in resolveOnlyArgv so
154
+ // they can run without SHA or message.
106
155
  const resolveArgv = buildPrShepherdCommand(["apply", "review", String(prReference)]).argv;
107
- if (replyThreadIds.length > 0) {
108
- resolveArgv.push("--reply-thread-ids", replyThreadIds.join(","));
109
- }
156
+ resolveArgv.push("--reply-thread-ids", replyThreadIds.join(","));
110
157
  if (pairedResolveThreadIds.length > 0) {
111
158
  resolveArgv.push("--resolve-thread-ids", pairedResolveThreadIds.join(","));
112
159
  }
113
160
  resolveArgv.push("--message", "$CHANGE_MESSAGE");
114
- pushAdoptExistingReplies(resolveArgv, hasReply);
115
- if (hasDismiss) {
116
- resolveArgv.push("--dismiss-review-ids", dismissReviewIds.join(","));
117
- }
118
- // SHA is required when actionable thread fixes or failing checks are being addressed,
119
- // or when bot CR reviews are being dismissed (post-push SHA gate).
120
- const requiresHeadSha = threads.length > 0 || checks.length > 0 || hasDismiss;
161
+ pushAdoptExistingReplies(resolveArgv, true);
162
+ const requiresHeadSha = threads.length > 0 || checks.length > 0;
121
163
  const resolveCommand = {
122
164
  argv: resolveArgv,
123
165
  requiresHeadSha,
124
166
  requiresDismissMessage: true,
125
- ...(replyThreadIds.length > 0 ? { replyThreadIds } : undefined),
167
+ replyThreadIds,
126
168
  ...(pairedResolveThreadIds.length > 0
127
169
  ? { resolveThreadIds: pairedResolveThreadIds }
128
170
  : undefined),
129
- ...(hasDismiss ? { dismissReviewIds } : undefined),
130
171
  hasMutations: true,
131
172
  };
132
173
  const resolveOnlyArgv = buildPrShepherdCommand(["apply", "review", String(prReference)]).argv;
@@ -145,11 +186,15 @@ export function buildResolveCommand(threads, resolutionOnlyThreads, allCommentId
145
186
  : undefined),
146
187
  hasMutations: true,
147
188
  };
148
- return { resolveCommand, resolveOnlyCommand };
189
+ return {
190
+ resolveCommand,
191
+ resolveOnlyCommand,
192
+ ...(dismissReviewsCommand ? { dismissReviewsCommand } : undefined),
193
+ };
149
194
  }
150
- // Single command: all mutations combined (or only one category present).
195
+ // Single command for inline threads and PR comments (or empty when only review mutations exist).
151
196
  const argv = buildPrShepherdCommand(["apply", "review", String(prReference)]).argv;
152
- if (replyThreadIds.length > 0) {
197
+ if (hasReply) {
153
198
  argv.push("--reply-thread-ids", replyThreadIds.join(","));
154
199
  argv.push("--message", "$CHANGE_MESSAGE");
155
200
  pushAdoptExistingReplies(argv, true);
@@ -160,24 +205,18 @@ export function buildResolveCommand(threads, resolutionOnlyThreads, allCommentId
160
205
  if (allCommentIds.length > 0) {
161
206
  argv.push("--minimize-comment-ids", allCommentIds.join(","));
162
207
  }
163
- if (hasDismiss) {
164
- // Add --message when dismissing without a reply (replies already added it above).
165
- if (!hasReply)
166
- argv.push("--message", "$CHANGE_MESSAGE");
167
- argv.push("--dismiss-review-ids", dismissReviewIds.join(","));
168
- }
169
- const hasMutations = hasMessageMutations || hasResolveOrMinimize;
170
- // SHA is required when replying after actionable fixes/checks, or whenever dismissing
171
- // (dismissal is a post-push operation that must race-check against a moving HEAD).
172
- const requiresHeadSha = hasDismiss || (hasReply && (threads.length > 0 || checks.length > 0));
208
+ const hasMutations = hasReply || hasResolveOrMinimize;
209
+ const requiresHeadSha = hasReply && (threads.length > 0 || checks.length > 0);
173
210
  const resolveCommand = {
174
211
  argv,
175
212
  requiresHeadSha,
176
- requiresDismissMessage: hasMessageMutations,
177
- ...(replyThreadIds.length > 0 ? { replyThreadIds } : undefined),
213
+ requiresDismissMessage: hasReply,
214
+ ...(hasReply ? { replyThreadIds } : undefined),
178
215
  ...(resolveThreadIds.length > 0 ? { resolveThreadIds } : undefined),
179
- ...(hasDismiss ? { dismissReviewIds } : undefined),
180
216
  hasMutations,
181
217
  };
182
- return { resolveCommand };
218
+ return {
219
+ resolveCommand,
220
+ ...(dismissReviewsCommand ? { dismissReviewsCommand } : undefined),
221
+ };
183
222
  }
@@ -198,7 +198,9 @@ export function buildEscalateHumanMessage(escalate, pr, opts) {
198
198
  }
199
199
  }
200
200
  const pending = escalate.pendingReviewCommands;
201
- if (pending?.resolveOnlyCommand?.hasMutations || pending?.resolveCommand?.hasMutations) {
201
+ if (pending?.resolveOnlyCommand?.hasMutations ||
202
+ pending?.resolveCommand?.hasMutations ||
203
+ pending?.dismissReviewsCommand?.hasMutations) {
202
204
  lines.push("", "## Pending review commands", "");
203
205
  if (pending.resolveOnlyCommand?.hasMutations) {
204
206
  lines.push(`- resolve-only: \`${renderResolveCommand(pending.resolveOnlyCommand)}\``);
@@ -206,6 +208,9 @@ export function buildEscalateHumanMessage(escalate, pr, opts) {
206
208
  if (pending.resolveCommand?.hasMutations) {
207
209
  lines.push(`- apply review: \`${renderResolveCommand(pending.resolveCommand)}\``);
208
210
  }
211
+ if (pending.dismissReviewsCommand?.hasMutations) {
212
+ lines.push(`- dismiss reviews: \`${renderResolveCommand(pending.dismissReviewsCommand)}\``);
213
+ }
209
214
  }
210
215
  lines.push("");
211
216
  lines.push("---");
@@ -12,7 +12,6 @@ import { clearStallState } from "../../state/iterate-stall.mjs";
12
12
  import { handleTriage } from "./triage.mjs";
13
13
  import { deferQueuedConflictReviewWork } from "./queued-conflict-deferral.mjs";
14
14
  import { normalizeBotUsernames } from "../../comments/authors.mjs";
15
- import { autoMinimizeComments } from "../../comments/resolve.mjs";
16
15
  import { hasCheckDrivenActionableWork, isQueuedConflict } from "../check-annotations.mjs";
17
16
  import { buildReadyMergeOutcome, handleActiveMergeState } from "./merge-state.mjs";
18
17
  import { buildIterateBase } from "./base.mjs";
@@ -111,32 +110,22 @@ async function runIterateCore(opts, tick) {
111
110
  failing: report.checks.failing.filter((check) => !deferredNames.has(check.name)),
112
111
  },
113
112
  };
114
- const { minimizeIds, selfMinimizeIds, firstLookSummaries, editedSummaries, surfacedApprovals } = classifyReviewSummaries({
115
- firstLook: report.firstLookSummaries,
116
- seen: report.reviewSummaries,
117
- edited: report.editedSummaries,
118
- }, report.approvedReviews, config.iterate["minimize-approvals"], config.iterate["minimize-comments"], botUsernames, [
113
+ const blockedThreadRefs = [
119
114
  ...report.threads.actionable,
120
115
  ...report.threads.resolutionOnly,
121
116
  ...(report.heldThreadReviewIds ?? []).map((reviewId) => ({ reviewId })),
122
- ], report.ruleAutoResolveReviewSummaryIds);
123
- // Minimize already-seen review summaries in-process so they never become agent-facing work.
124
- // GitHub can still return a null/error/rate-limit result per ID without
125
- // throwing (autoMinimizeComments reports this via `errors`, not a rejection);
126
- // any ID it did not confirm minimized falls back into the agent-facing set so
127
- // the apply command remains a working fallback instead of silently dropping it.
128
- let reviewSummaryIds = minimizeIds;
129
- if (selfMinimizeIds.length > 0 && readOnly) {
130
- reviewSummaryIds = [...reviewSummaryIds, ...selfMinimizeIds];
131
- }
132
- else if (selfMinimizeIds.length > 0) {
133
- checkContext.invalidateReceiptSummary();
134
- const { minimized } = await autoMinimizeComments(selfMinimizeIds);
135
- const minimizedIds = new Set(minimized);
136
- const unminimized = selfMinimizeIds.filter((id) => !minimizedIds.has(id));
137
- if (unminimized.length > 0)
138
- reviewSummaryIds = [...reviewSummaryIds, ...unminimized];
139
- }
117
+ ...(report.unresolvedThreadReviewIds ?? []).map((reviewId) => ({ reviewId })),
118
+ ];
119
+ const blockedReviewIds = new Set(blockedThreadRefs.flatMap((thread) => (thread.reviewId !== undefined ? [thread.reviewId] : [])));
120
+ const { minimizeIds: reviewSummaryIds, firstLookSummaries, editedSummaries, surfacedApprovals, } = classifyReviewSummaries({
121
+ firstLook: report.firstLookSummaries,
122
+ seen: report.reviewSummaries,
123
+ edited: report.editedSummaries,
124
+ }, report.approvedReviews, config.iterate["minimize-approvals"], config.iterate["minimize-comments"], botUsernames, blockedThreadRefs, report.ruleAutoResolveReviewSummaryIds, {
125
+ minimizeSupersededApprovals: config.iterate["minimize-superseded-approvals"],
126
+ supersededApprovals: report.supersededApprovedReviews,
127
+ changesRequestedReviews: report.changesRequestedReviews,
128
+ });
140
129
  // A first look at an already-minimized comment is only an acknowledgment. Edited PR comments
141
130
  // (report.comments.edited) are neither: they never block readiness or restart the ready delay.
142
131
  // Review items held back by iterate.review-output-max-chars keep the PR out of ready/merge: a
@@ -218,6 +207,7 @@ async function runIterateCore(opts, tick) {
218
207
  repoOwner,
219
208
  repoName,
220
209
  botUsernames,
210
+ blockedReviewIds,
221
211
  releasedCheckNames: blockerGate?.releasedNames,
222
212
  releasedCheckBlockers: blockerGate?.releasedBlockers,
223
213
  ...((unreportedRepair.length > 0 || staleAncestry !== null) && {
@@ -241,6 +231,7 @@ async function runIterateCore(opts, tick) {
241
231
  editedSummaries,
242
232
  surfacedApprovals,
243
233
  botUsernames,
234
+ blockedReviewIds,
244
235
  releasedCheckNames: blockerGate?.releasedNames,
245
236
  releasedCheckBlockers: blockerGate?.releasedBlockers,
246
237
  repairInstructions: [...unreportedRepair, ...staleAncestry.instructions],
@@ -281,6 +272,7 @@ async function runIterateCore(opts, tick) {
281
272
  editedSummaries,
282
273
  surfacedApprovals,
283
274
  botUsernames,
275
+ blockedReviewIds,
284
276
  releasedCheckNames: blockerGate?.releasedNames,
285
277
  releasedCheckBlockers: blockerGate?.releasedBlockers,
286
278
  repairInstructions: [...unreportedRepair, ...staleAncestry.instructions],
@@ -1,15 +1,6 @@
1
1
  import type { AgentThread, AgentComment, AgentCheck, Review, ResolveCommand, FirstLookThread, FirstLookComment, ReviewThread } from "../../types.mts";
2
2
  import { type QueueEjectionRecovery } from "./queue-recovery-instructions.mts";
3
3
  import type { InstructionStyle } from "../../config/load.mts";
4
- /**
5
- * Render a resolve command as a shell snippet. Appends `--require-sha HEAD` when set: run after
6
- * the push step, the local HEAD is the pushed PR head, and `apply review` rejects the mutations
7
- * if it is not. `apply review` reads that HEAD itself with a read-only `git rev-parse HEAD`.
8
- */
4
+ /** Render a resolve command, appending `--require-sha HEAD` when `requiresHeadSha` is set. */
9
5
  export declare function renderResolveCommand(rc: ResolveCommand): string;
10
- export declare function buildFixInstructions(threads: AgentThread[], actionableComments: AgentComment[], checks: AgentCheck[], changesRequestedReviews: Review[], baseBranch: string, resolveCommand: ResolveCommand, hasConflicts: boolean, prReference: string | number, firstLookThreads?: FirstLookThread[], firstLookComments?: FirstLookComment[], firstLookSummaries?: Review[], editedSummaries?: Review[], resolutionOnlyThreads?: ReviewThread[], resolveOnlyCommand?: ResolveCommand, behindBaseHint?: string, // iterate.behind-base-hint — see buildBehindBaseHintInstruction
11
- isBehind?: boolean, _viewerCanUpdate?: boolean, hasExhaustedWorkflowRerun?: boolean, stackRebase?: string, // native stack layers rebase with gh-stack, not branch by branch
12
- queueEjection?: QueueEjectionRecovery, // current merge-queue removal with failing queue checks
13
- instructionStyle?: InstructionStyle, // see iterate.instructions
14
- dequeueCommand?: string, // a conflicting PR that is still a merge-queue entry
15
- cancelRunsStep?: string): string[];
6
+ export declare function buildFixInstructions(threads: AgentThread[], actionableComments: AgentComment[], checks: AgentCheck[], changesRequestedReviews: Review[], baseBranch: string, resolveCommand: ResolveCommand, hasConflicts: boolean, prReference: string | number, firstLookThreads?: FirstLookThread[], firstLookComments?: FirstLookComment[], firstLookSummaries?: Review[], editedSummaries?: Review[], resolutionOnlyThreads?: ReviewThread[], resolveOnlyCommand?: ResolveCommand, behindBaseHint?: string, isBehind?: boolean, _viewerCanUpdate?: boolean, hasExhaustedWorkflowRerun?: boolean, stackRebase?: string, queueEjection?: QueueEjectionRecovery, instructionStyle?: InstructionStyle, dequeueCommand?: string, cancelRunsStep?: string, dismissReviewsCommand?: ResolveCommand): string[];
@@ -1,27 +1,18 @@
1
1
  import { buildPrShepherdCommand, renderShellCommand } from "../../cli/runner.mjs";
2
- import { buildFailingCheckInstructions, buildCrStaleClause, buildBehindBaseHintInstruction, buildRepeatedWorkflowBranchRecoveryInstructions, buildResolveCommandInstruction, buildFixCompletionInstruction, QUEUED_CONFLICT_CONTINUATION, } from "./check-instructions.mjs";
2
+ import { buildFailingCheckInstructions, buildCrStaleClause, buildBehindBaseHintInstruction, buildRepeatedWorkflowBranchRecoveryInstructions, buildResolveCommandInstruction, buildDismissReviewsCommandInstruction, buildFixCompletionInstruction, QUEUED_CONFLICT_CONTINUATION, } from "./check-instructions.mjs";
3
3
  import { isFailingAgentCheck } from "../../checks/conclusions.mjs";
4
4
  import { buildCommitSuggestionInstruction } from "../commit-suggestion-instruction.mjs";
5
5
  import { partitionFixThreads } from "./fix-instruction-threads.mjs";
6
6
  import { buildBranchPushInstruction, buildConflictInstruction, buildQueuedConflictChoice, } from "./native-stack-rebase.mjs";
7
7
  import { queueEjectionSteps } from "./queue-recovery-instructions.mjs";
8
8
  import { buildPushSteps } from "./triage-loop-instruction.mjs";
9
- /**
10
- * Render a resolve command as a shell snippet. Appends `--require-sha HEAD` when set: run after
11
- * the push step, the local HEAD is the pushed PR head, and `apply review` rejects the mutations
12
- * if it is not. `apply review` reads that HEAD itself with a read-only `git rev-parse HEAD`.
13
- */
9
+ /** Render a resolve command, appending `--require-sha HEAD` when `requiresHeadSha` is set. */
14
10
  export function renderResolveCommand(rc) {
15
11
  const command = renderShellCommand(rc.argv);
16
12
  return rc.requiresHeadSha ? `${command} ${REQUIRE_HEAD_SHA}` : command;
17
13
  }
18
14
  const REQUIRE_HEAD_SHA = "--require-sha HEAD";
19
- export function buildFixInstructions(threads, actionableComments, checks, changesRequestedReviews, baseBranch, resolveCommand, hasConflicts, prReference, firstLookThreads = [], firstLookComments = [], firstLookSummaries = [], editedSummaries = [], resolutionOnlyThreads = [], resolveOnlyCommand, behindBaseHint = "", // iterate.behind-base-hint — see buildBehindBaseHintInstruction
20
- isBehind = false, _viewerCanUpdate = false, hasExhaustedWorkflowRerun = false, stackRebase, // native stack layers rebase with gh-stack, not branch by branch
21
- queueEjection, // current merge-queue removal with failing queue checks
22
- instructionStyle = "inline", // see iterate.instructions
23
- dequeueCommand, // a conflicting PR that is still a merge-queue entry
24
- cancelRunsStep) {
15
+ export function buildFixInstructions(threads, actionableComments, checks, changesRequestedReviews, baseBranch, resolveCommand, hasConflicts, prReference, firstLookThreads = [], firstLookComments = [], firstLookSummaries = [], editedSummaries = [], resolutionOnlyThreads = [], resolveOnlyCommand, behindBaseHint = "", isBehind = false, _viewerCanUpdate = false, hasExhaustedWorkflowRerun = false, stackRebase, queueEjection, instructionStyle = "inline", dequeueCommand, cancelRunsStep, dismissReviewsCommand) {
25
16
  const instructions = [];
26
17
  const { locatedThreads, unlocatedThreads } = partitionFixThreads(threads, resolveCommand, resolveOnlyCommand);
27
18
  const failingChecks = checks.filter((c) => isFailingAgentCheck(c));
@@ -33,20 +24,16 @@ cancelRunsStep) {
33
24
  hasAnnotations ||
34
25
  changesRequestedReviews.length > 0 ||
35
26
  actionableComments.length > 0;
36
- // Start with interpretation. The agent decides what raw feedback warrants a code change.
37
- // A queued conflict offers a wait path that publishes nothing, so fixes, branch updates,
38
- // pushes, and review mutations (which must follow a push) become path (a).
27
+ // A queued conflict offers a wait path that publishes nothing, so mutating steps become path (a).
39
28
  const pathA = (step) => (dequeueCommand ? `If you chose (a): ${step}` : step);
40
29
  if (cancelRunsStep)
41
30
  instructions.push(cancelRunsStep);
42
31
  if (hasNonConflictHints)
43
32
  instructions.push(pathA("Fix each warranted item."));
44
- // A conflicting native stack layer follows the printed gh-stack route, so it omits the hint.
45
33
  const branchUpdateHint = buildBehindBaseHintInstruction(baseBranch, behindBaseHint, {
46
34
  isBehind,
47
35
  hasConflicts: hasConflicts && !stackRebase,
48
36
  }).map(pathA);
49
- // The conflict hint belongs with the conflict step; otherwise it precedes the push step.
50
37
  const hintWithConflictStep = hasConflicts && !hasRepeatedWorkflowBranchRecovery;
51
38
  const branchRecovery = hasConflicts || hasRepeatedWorkflowBranchRecovery;
52
39
  if (hintWithConflictStep)
@@ -89,7 +76,9 @@ cancelRunsStep) {
89
76
  const journalCommand = buildPrShepherdCommand(["apply", "journal", String(prReference)]).text;
90
77
  instructions.push(`Optional: If you reject a code review suggestion, journal why: \`${journalCommand} '- <reason>'\`.`);
91
78
  }
92
- const hasReviewMutations = resolveCommand.hasMutations || resolveOnlyCommand?.hasMutations === true;
79
+ const hasReviewMutations = resolveCommand.hasMutations ||
80
+ resolveOnlyCommand?.hasMutations === true ||
81
+ dismissReviewsCommand?.hasMutations === true;
93
82
  const mutationSuffix = hasReviewMutations ? " before review mutations" : "";
94
83
  const genericPush = !(branchRecovery || queueEjection) && hasNonConflictHints;
95
84
  if (branchRecovery || queueEjection) {
@@ -98,6 +87,8 @@ cancelRunsStep) {
98
87
  instructions.push(...buildPushSteps(instructionStyle, genericPush));
99
88
  if (resolveOnlyCommand?.hasMutations)
100
89
  instructions.push(pathA(`Run: \`${renderResolveCommand(resolveOnlyCommand)}\``));
101
- instructions.push(...buildResolveCommandInstruction(resolveCommand, renderResolveCommand(resolveCommand)).map(pathA), dequeueCommand ? QUEUED_CONFLICT_CONTINUATION : buildFixCompletionInstruction());
90
+ instructions.push(...buildResolveCommandInstruction(resolveCommand, renderResolveCommand(resolveCommand)).map(pathA), ...(dismissReviewsCommand?.hasMutations
91
+ ? buildDismissReviewsCommandInstruction(dismissReviewsCommand, renderResolveCommand(dismissReviewsCommand)).map(pathA)
92
+ : []), dequeueCommand ? QUEUED_CONFLICT_CONTINUATION : buildFixCompletionInstruction());
102
93
  return instructions;
103
94
  }
@@ -17,6 +17,9 @@ function pendingReviewCommandsFromResult(result) {
17
17
  ...(result.triage.resolveCommand.hasMutations && {
18
18
  resolveCommand: result.triage.resolveCommand,
19
19
  }),
20
+ ...(result.triage.dismissReviewsCommand?.hasMutations && {
21
+ dismissReviewsCommand: result.triage.dismissReviewsCommand,
22
+ }),
20
23
  };
21
24
  return Object.keys(pending).length > 0 ? pending : undefined;
22
25
  }
@@ -19,6 +19,7 @@ interface HandleTriageContext {
19
19
  editedSummaries: Review[];
20
20
  surfacedApprovals: Review[];
21
21
  botUsernames: NormalizedBotUsernames;
22
+ blockedReviewIds?: ReadonlySet<string>;
22
23
  /** Failing checks whose external blocker has merged or closed. */
23
24
  releasedCheckNames?: ReadonlySet<string>;
24
25
  /** Released check name → the blocker that merged or closed, shown on the check. */
@@ -59,10 +59,11 @@ function previousFixAttempts(stored, threads) {
59
59
  }
60
60
  return attempts;
61
61
  }
62
- function pendingReviewCommands(resolveCommand, resolveOnlyCommand) {
62
+ function pendingReviewCommands(resolveCommand, resolveOnlyCommand, dismissReviewsCommand) {
63
63
  const pending = {
64
64
  ...(resolveOnlyCommand?.hasMutations && { resolveOnlyCommand }),
65
65
  ...(resolveCommand.hasMutations && { resolveCommand }),
66
+ ...(dismissReviewsCommand?.hasMutations && { dismissReviewsCommand }),
66
67
  };
67
68
  return Object.keys(pending).length > 0 ? pending : undefined;
68
69
  }
@@ -75,7 +76,7 @@ export async function handleTriage(ctx) {
75
76
  return { ...result, escalate: { ...result.escalate, reviewItems } };
76
77
  }
77
78
  async function handleTriageTick(ctx) {
78
- const { base, report, opts, headSha, stallKey, prNumber, stallTimeoutSeconds, repoOwner, repoName, reviewSummaryIds, firstLookSummaries, editedSummaries, surfacedApprovals, botUsernames, releasedCheckNames = EMPTY_RELEASED, releasedCheckBlockers, ruleAutoResolveThreadIds, repairInstructions, } = ctx;
79
+ const { base, report, opts, headSha, stallKey, prNumber, stallTimeoutSeconds, repoOwner, repoName, reviewSummaryIds, firstLookSummaries, editedSummaries, surfacedApprovals, botUsernames, blockedReviewIds, releasedCheckNames = EMPTY_RELEASED, releasedCheckBlockers, ruleAutoResolveThreadIds, repairInstructions, } = ctx;
79
80
  const prReference = formatPrUrl(report.repo, prNumber);
80
81
  const failingChecks = report.checks.failing;
81
82
  const annotatedExtra = checksWithActionableAnnotations(report).filter((c) => c.category !== "failing");
@@ -110,16 +111,17 @@ async function handleTriageTick(ctx) {
110
111
  const changesRequestedReviewsForWork = actionableChangesRequestedReviews.filter((review) => !unauthorizedDismissals.some((candidate) => candidate.id === review.id));
111
112
  const buildReviewCommands = (checks) => buildResolveCommand(report.threads.actionable
112
113
  .filter((thread) => mutationActionableThreads.some((candidate) => candidate.id === thread.id))
113
- .map(toAgentThread), resolutionOnlyThreadsForWork, [
114
- ...(report.comments.minimizeIds ?? report.comments.actionable.map((comment) => comment.id)),
115
- ...reviewSummaryIds,
116
- ], changesRequestedReviewsForWork, checks, prReference, botUsernames, ruleAutoResolveThreadIds, report.viewerAuthorization, allThreads, resolveOtherHumanThreads);
114
+ .map(toAgentThread), resolutionOnlyThreadsForWork, report.comments.minimizeIds ?? report.comments.actionable.map((comment) => comment.id), changesRequestedReviewsForWork, checks, prReference, botUsernames, ruleAutoResolveThreadIds, report.viewerAuthorization, allThreads, resolveOtherHumanThreads, {
115
+ reviewMinimizeIds: reviewSummaryIds,
116
+ blockedReviewIds,
117
+ minimizeComments: loadConfig().iterate["minimize-comments"],
118
+ });
117
119
  const escalateTriggers = countTriageAttempt
118
120
  ? checkEscalateTriggers(retryableActionableThreads, priorThreadAttempts)
119
121
  : { triggers: [], thrashHistory: undefined };
120
122
  if (escalateTriggers.triggers.length > 0) {
121
- const { resolveCommand, resolveOnlyCommand } = buildReviewCommands(toAgentChecks(failingChecks));
122
- const pending = pendingReviewCommands(resolveCommand, resolveOnlyCommand);
123
+ const { resolveCommand, resolveOnlyCommand, dismissReviewsCommand } = buildReviewCommands(toAgentChecks(failingChecks));
124
+ const pending = pendingReviewCommands(resolveCommand, resolveOnlyCommand, dismissReviewsCommand);
123
125
  const escalateBase = {
124
126
  triggers: escalateTriggers.triggers,
125
127
  unresolvedThreads: [...report.threads.actionable, ...report.threads.resolutionOnly].map(toAgentThread),
@@ -189,7 +191,9 @@ async function handleTriageTick(ctx) {
189
191
  annotationOnly: true,
190
192
  }));
191
193
  const checks = [...failingAgentChecks, ...annotatedAgentChecks];
192
- const { changesRequestedReviews } = report;
194
+ const changesRequestedReviews = report.changesRequestedReviews.map((review) => review.staleBotCr && blockedReviewIds?.has(review.id)
195
+ ? { ...review, pendingInlineThreads: true }
196
+ : review);
193
197
  const hasConflicts = report.mergeStatus.status === "CONFLICTS";
194
198
  const queuedConflict = isQueuedConflict(report.mergeQueue?.inQueue, report.mergeStatus.status);
195
199
  const isBehind = report.mergeStatus.status === "BEHIND";
@@ -239,8 +243,8 @@ async function handleTriageTick(ctx) {
239
243
  !hasAutonomousWork &&
240
244
  !investigated;
241
245
  if (terminalChecks.length > 0 && !hasAutonomousWork && investigated) {
242
- const { resolveCommand, resolveOnlyCommand } = buildReviewCommands(failingAgentChecks);
243
- const pending = pendingReviewCommands(resolveCommand, resolveOnlyCommand);
246
+ const { resolveCommand, resolveOnlyCommand, dismissReviewsCommand } = buildReviewCommands(failingAgentChecks);
247
+ const pending = pendingReviewCommands(resolveCommand, resolveOnlyCommand, dismissReviewsCommand);
244
248
  const terminalExhausted = exhaustedAttempts.filter((check) => terminalChecks.includes(check));
245
249
  const checkSuggestion = terminalExhausted.length > 0
246
250
  ? `GitHub reports a later workflow attempt (${terminalExhausted
@@ -285,7 +289,7 @@ async function handleTriageTick(ctx) {
285
289
  }
286
290
  // Push access to the PR head branch is a usage precondition. Build review mutations for
287
291
  // conflict ticks normally so the caller can push and complete the same triage cycle.
288
- const { resolveCommand, resolveOnlyCommand } = buildReviewCommands(failingAgentChecks);
292
+ const { resolveCommand, resolveOnlyCommand, dismissReviewsCommand } = buildReviewCommands(failingAgentChecks);
289
293
  const firstLookThreads = report.threads.firstLook;
290
294
  const firstLookComments = report.comments.firstLook;
291
295
  const stack = report.mergeStatus.mergeRequirements?.stack;
@@ -358,7 +362,7 @@ async function handleTriageTick(ctx) {
358
362
  ? renderShellCommand(buildDequeueCommand(report.nodeId))
359
363
  : undefined;
360
364
  const inProgressRuns = await buildInProgressRuns(report, rerunAuthorized);
361
- const instructions = buildFixInstructions(threads, actionableComments, triageChecks.filter((check) => !releasedCheckNames.has(check.name)), changesRequestedReviews, baseLookup.branch, resolveCommand, hasConflicts, prReference, firstLookThreads, firstLookComments, firstLookSummaries, editedSummaries, resolutionOnlyThreads, resolveOnlyCommand, behindBaseHint, isBehind, canGenerateGithubMutation(report.viewerAuthorization?.viewerCanUpdate, "ready"), exhaustedAttempts.length > 0, stackRebase, queueEjection, opts.instructions ?? configuredInstructions, dequeueCommand, buildCancelRunsInstruction(inProgressRuns));
365
+ const instructions = buildFixInstructions(threads, actionableComments, triageChecks.filter((check) => !releasedCheckNames.has(check.name)), changesRequestedReviews, baseLookup.branch, resolveCommand, hasConflicts, prReference, firstLookThreads, firstLookComments, firstLookSummaries, editedSummaries, resolutionOnlyThreads, resolveOnlyCommand, behindBaseHint, isBehind, canGenerateGithubMutation(report.viewerAuthorization?.viewerCanUpdate, "ready"), exhaustedAttempts.length > 0, stackRebase, queueEjection, opts.instructions ?? configuredInstructions, dequeueCommand, buildCancelRunsInstruction(inProgressRuns), dismissReviewsCommand);
362
366
  if (investigate) {
363
367
  // The failing-checks pointer is replaced: these checks have no excerpt for the CI playbook.
364
368
  const triageStep = instructions.findIndex((step) => step.startsWith("Triage `## Failing checks`."));
@@ -450,6 +454,7 @@ async function handleTriageTick(ctx) {
450
454
  changesRequestedReviews,
451
455
  resolveCommand,
452
456
  ...(resolveOnlyCommand !== undefined ? { resolveOnlyCommand } : undefined),
457
+ ...(dismissReviewsCommand !== undefined ? { dismissReviewsCommand } : undefined),
453
458
  instructions,
454
459
  firstLookThreads,
455
460
  firstLookComments,