pr-shepherd 0.32.3 → 0.32.5
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.
|
@@ -14,16 +14,21 @@ function dedupeIds(ids) {
|
|
|
14
14
|
}
|
|
15
15
|
export function classifyReviewSummaries(summaries, approvals, minimizeApprovals, minimizeComments = "all", botUsernames = new Set(), unresolvedThreads = [], ruleAutoResolveIds = []) {
|
|
16
16
|
const blockedReviewIds = new Set(unresolvedThreads.flatMap((t) => (t.reviewId !== undefined ? [t.reviewId] : [])));
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
// First-look
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
//
|
|
17
|
+
const eligible = (r) => shouldMinimizeAuthor(r.authorType, minimizeComments, r.author, botUsernames) &&
|
|
18
|
+
!blockedReviewIds.has(r.id);
|
|
19
|
+
// First-look summaries still need one tick to surface their body to the agent,
|
|
20
|
+
// so their minimize IDs ride in the agent-facing resolve command. Seen summaries
|
|
21
|
+
// (already surfaced in a prior tick) have no new content to show — the CLI
|
|
22
|
+
// self-minimizes them in-process (selfMinimizeIds) instead of routing a
|
|
23
|
+
// cosmetic-only mutation through fix_code (issue #313). Edited summaries are
|
|
24
|
+
// excluded entirely: they are already minimized server-side (body changed after
|
|
25
|
+
// minimize was applied).
|
|
26
|
+
const minimizeIds = summaries.firstLook.filter(eligible).map((r) => r.id);
|
|
27
|
+
const selfMinimizeIds = summaries.seen.filter(eligible).map((r) => r.id);
|
|
28
|
+
// Rule-matched summaries are already suppressed from agent output; bypass normal
|
|
29
|
+
// policy gates. Keep the two sets disjoint.
|
|
25
30
|
for (const id of ruleAutoResolveIds) {
|
|
26
|
-
if (!minimizeIds.includes(id))
|
|
31
|
+
if (!minimizeIds.includes(id) && !selfMinimizeIds.includes(id))
|
|
27
32
|
minimizeIds.push(id);
|
|
28
33
|
}
|
|
29
34
|
if (minimizeApprovals) {
|
|
@@ -36,6 +41,7 @@ export function classifyReviewSummaries(summaries, approvals, minimizeApprovals,
|
|
|
36
41
|
}
|
|
37
42
|
return {
|
|
38
43
|
minimizeIds,
|
|
44
|
+
selfMinimizeIds,
|
|
39
45
|
firstLookSummaries: summaries.firstLook,
|
|
40
46
|
editedSummaries: summaries.edited,
|
|
41
47
|
surfacedApprovals,
|
|
@@ -43,6 +49,7 @@ export function classifyReviewSummaries(summaries, approvals, minimizeApprovals,
|
|
|
43
49
|
}
|
|
44
50
|
return {
|
|
45
51
|
minimizeIds,
|
|
52
|
+
selfMinimizeIds,
|
|
46
53
|
firstLookSummaries: summaries.firstLook,
|
|
47
54
|
editedSummaries: summaries.edited,
|
|
48
55
|
surfacedApprovals: approvals,
|
|
@@ -10,6 +10,7 @@ import { applyStallGuard } from "./stall.mjs";
|
|
|
10
10
|
import { clearStallState } from "../../state/iterate-stall.mjs";
|
|
11
11
|
import { handleFixCode } from "./fix-code.mjs";
|
|
12
12
|
import { normalizeBotUsernames } from "../../comments/authors.mjs";
|
|
13
|
+
import { autoMinimizeComments } from "../../comments/resolve.mjs";
|
|
13
14
|
export async function runIterate(opts) {
|
|
14
15
|
const config = loadConfig();
|
|
15
16
|
const botUsernames = normalizeBotUsernames(config.botUsernames);
|
|
@@ -35,11 +36,25 @@ export async function runIterate(opts) {
|
|
|
35
36
|
await clearStallState(stallKey);
|
|
36
37
|
return buildTerminalCancelResult(report);
|
|
37
38
|
}
|
|
38
|
-
const { minimizeIds
|
|
39
|
+
const { minimizeIds, selfMinimizeIds, firstLookSummaries, editedSummaries, surfacedApprovals } = classifyReviewSummaries({
|
|
39
40
|
firstLook: report.firstLookSummaries,
|
|
40
41
|
seen: report.reviewSummaries,
|
|
41
42
|
edited: report.editedSummaries,
|
|
42
43
|
}, report.approvedReviews, config.iterate.minimizeApprovals, config.iterate.minimizeComments, botUsernames, [...report.threads.actionable, ...report.threads.resolutionOnly], report.ruleAutoResolveReviewSummaryIds);
|
|
44
|
+
// Already-seen review summaries have no new content to surface — minimize them
|
|
45
|
+
// in-process so they never register as agent-facing actionable work (#313).
|
|
46
|
+
// GitHub can still return a null/error/rate-limit result per ID without
|
|
47
|
+
// throwing (autoMinimizeComments reports this via `errors`, not a rejection);
|
|
48
|
+
// any ID it did not confirm minimized falls back into the agent-facing set so
|
|
49
|
+
// the resolve command remains a working fallback instead of silently dropping it.
|
|
50
|
+
let reviewSummaryIds = minimizeIds;
|
|
51
|
+
if (selfMinimizeIds.length > 0) {
|
|
52
|
+
const { minimized } = await autoMinimizeComments(selfMinimizeIds);
|
|
53
|
+
const minimizedIds = new Set(minimized);
|
|
54
|
+
const unminimized = selfMinimizeIds.filter((id) => !minimizedIds.has(id));
|
|
55
|
+
if (unminimized.length > 0)
|
|
56
|
+
reviewSummaryIds = [...reviewSummaryIds, ...unminimized];
|
|
57
|
+
}
|
|
43
58
|
const hasActionableWork = report.threads.actionable.length > 0 ||
|
|
44
59
|
report.threads.resolutionOnly.length > 0 ||
|
|
45
60
|
report.threads.firstLook.length > 0 ||
|
package/bin/commands/poll.mjs
CHANGED
|
@@ -66,9 +66,16 @@ export async function runPoll(opts) {
|
|
|
66
66
|
const untilTerminal = untilTerminalOpt === true;
|
|
67
67
|
let dotsPrinted = false;
|
|
68
68
|
let lastWaitSignature = null;
|
|
69
|
+
// When prNumber is omitted, iterateOpts.prNumber starts undefined and each tick would otherwise
|
|
70
|
+
// re-infer the PR from the current branch. That inference query only matches OPEN PRs, so once
|
|
71
|
+
// the monitored PR merges it returns nothing and runIterate throws instead of reporting the
|
|
72
|
+
// terminal CANCEL/merged result. Pin the PR resolved by the first tick so later ticks target it
|
|
73
|
+
// directly and never re-run branch discovery.
|
|
74
|
+
let prNumber = opts.prNumber;
|
|
69
75
|
while (true) {
|
|
70
76
|
tick += 1;
|
|
71
|
-
lastResult = await runIterate(iterateOpts);
|
|
77
|
+
lastResult = await runIterate({ ...iterateOpts, prNumber });
|
|
78
|
+
prNumber ??= lastResult.pr;
|
|
72
79
|
if (lastResult.action !== "wait" && !(untilTerminal && lastResult.action === "mark_ready")) {
|
|
73
80
|
break;
|
|
74
81
|
}
|
package/package.json
CHANGED