Skip to content

Commit f4c2bb3

Browse files
committed
fix(sweep): keep recovery comments non-actionable
1 parent b799686 commit f4c2bb3

4 files changed

Lines changed: 39 additions & 5 deletions

File tree

‎src/clawsweeper.ts‎

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -645,6 +645,7 @@ interface ReviewCommentRenderOptions {
645645
previousLabels?: readonly string[];
646646
hasOpenLinkedPullRequest?: boolean;
647647
previousReviewCommentBody?: string;
648+
suppressAutomationMarkers?: boolean;
648649
}
649650

650651
interface Decision {
@@ -17787,7 +17788,9 @@ export function renderReviewCommentFromReport(
1778717788
(!requiresMaintainerDecision || reason === "unsponsored_feature_request")
1778817789
? renderCloseCommentFromReport(markdown, reason)
1778917790
: renderKeepOpenCommentFromReport(markdown, options);
17790-
const markers = reviewAutomationMarkersFromReport(markdown);
17791+
const markers = options.suppressAutomationMarkers
17792+
? ""
17793+
: reviewAutomationMarkersFromReport(markdown);
1779117794
return [body.trimEnd(), markers, reviewVersionMarkerFromReport(markdown)]
1779217795
.filter(Boolean)
1779317796
.join("\n\n");
@@ -24845,6 +24848,7 @@ function applyDecisionsCommandInner(args: Args, runtimeBudget: GitHubRuntimeBudg
2484524848
args.require_precomputed_pr_close_coverage_proof,
2484624849
);
2484724850
const syncCommentsOnly = boolArg(args.sync_comments_only);
24851+
const suppressAutomationMarkers = boolArg(args.suppress_automation_markers);
2484824852
const emitEventApplyProof = boolArg(args.event_apply_proof);
2484924853
const commentSyncMinAgeDays = numberArg(args.comment_sync_min_age_days, 0);
2485024854
const maxRuntimeMs = numberArg(args.max_runtime_ms, 0);
@@ -25074,7 +25078,7 @@ function applyDecisionsCommandInner(args: Args, runtimeBudget: GitHubRuntimeBudg
2507425078
return;
2507525079
}
2507625080
logProgress(
25077-
`starting apply: files=${files.length} dry_run=${dryRun} apply_kind=${applyKind} min_age=${minAgeDescription} apply_close_reasons=${closeReasonFilterText(applyCloseReasons)} stale_min_age_days=${staleMinAgeDays} close_delay_ms=${closeDelayMs} sync_comments_only=${syncCommentsOnly} comment_sync_min_age_days=${commentSyncMinAgeDays} max_runtime_ms=${maxRuntimeMs} item_numbers=${requestedItemNumbers.join(",") || "all"}`,
25081+
`starting apply: files=${files.length} dry_run=${dryRun} apply_kind=${applyKind} min_age=${minAgeDescription} apply_close_reasons=${closeReasonFilterText(applyCloseReasons)} stale_min_age_days=${staleMinAgeDays} close_delay_ms=${closeDelayMs} sync_comments_only=${syncCommentsOnly} suppress_automation_markers=${suppressAutomationMarkers} comment_sync_min_age_days=${commentSyncMinAgeDays} max_runtime_ms=${maxRuntimeMs} item_numbers=${requestedItemNumbers.join(",") || "all"}`,
2507825082
);
2507925083
// oxfmt-ignore
2508025084
for (const entry of fileEntries) {
@@ -26213,7 +26217,10 @@ function applyDecisionsCommandInner(args: Args, runtimeBudget: GitHubRuntimeBudg
2621326217
}
2621426218
}
2621526219
existingReviewComment ??= issueReviewComment(number, [
26216-
renderReviewCommentFromReport(markdown, closeReason ?? "none", { previousLabels }),
26220+
renderReviewCommentFromReport(markdown, closeReason ?? "none", {
26221+
previousLabels,
26222+
suppressAutomationMarkers,
26223+
}),
2621726224
reviewSectionValue(markdown, "closeComment"),
2621826225
]);
2621926226
const markedReviewCommentForApply = (body: string): string =>
@@ -26451,6 +26458,7 @@ function applyDecisionsCommandInner(args: Args, runtimeBudget: GitHubRuntimeBudg
2645126458
const renderOptions: ReviewCommentRenderOptions = {
2645226459
prStatusKind: currentPrStatusKind,
2645326460
previousLabels,
26461+
suppressAutomationMarkers,
2645426462
};
2645526463
if (item.kind === "issue" && currentClosingPullRequests) {
2645626464
renderOptions.hasOpenLinkedPullRequest =

‎src/repair/publish-event-result.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,7 @@ function runApplyDecisions(options: EventOptions): void {
242242
"all",
243243
"--apply-close-reasons",
244244
options.closeReasons,
245-
...(options.reviewOnly ? ["--sync-comments-only"] : []),
245+
...(options.reviewOnly ? ["--sync-comments-only", "--suppress-automation-markers"] : []),
246246
"--stale-min-age-days",
247247
"30",
248248
"--limit",

‎test/clawsweeper.test.ts‎

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,24 @@ test("close proposals that require maintainer decisions render as kept open", ()
122122
assert.doesNotMatch(comment, /clawsweeper-action:close-required/);
123123
});
124124

125+
test("review-only comments omit actionable automation markers", () => {
126+
const report = implementedCloseReport({
127+
repository: "openclaw/openclaw",
128+
type: "pull_request",
129+
pull_head_sha: "abc123def456",
130+
});
131+
const routableComment = renderReviewCommentFromReport(report, "implemented_or_shipped");
132+
const comment = renderReviewCommentFromReport(report, "implemented_or_shipped", {
133+
suppressAutomationMarkers: true,
134+
});
135+
136+
assert.match(routableComment, /clawsweeper-(?:verdict|action):/);
137+
assert.match(comment, /Review details/);
138+
assert.match(comment, /clawsweeper-review-version/);
139+
assert.doesNotMatch(comment, /clawsweeper-verdict:/);
140+
assert.doesNotMatch(comment, /clawsweeper-action:/);
141+
});
142+
125143
test("apply-decisions archives live-closed skipped records without reopening close gates", () => {
126144
const root = mkdtempSync(tmpPrefix);
127145
try {
@@ -2591,7 +2609,10 @@ test("sweep review recovery uses explicit failed shard artifacts", () => {
25912609
/Export exact review primary result[\s\S]*REVIEW_ONLY:[\s\S]*\[ "\$REVIEW_ONLY" = "true" \]/,
25922610
);
25932611
assert.match(publishEventResult, /reviewOnly: process\.env\.REVIEW_ONLY === "true"/);
2594-
assert.match(publishEventResult, /options\.reviewOnly \? \["--sync-comments-only"\] : \[\]/);
2612+
assert.match(
2613+
publishEventResult,
2614+
/options\.reviewOnly \? \["--sync-comments-only", "--suppress-automation-markers"\] : \[\]/,
2615+
);
25952616
});
25962617

25972618
test("sweep failed-review retry lane defaults to dry-run exact-item dispatch", () => {

‎test/sweep-workflow.test.ts‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1981,6 +1981,7 @@ test("sweep review continuations stay workflow-dispatch compatible", () => {
19811981

19821982
test("failed review recovery waits for durable exact-review queue acknowledgement", () => {
19831983
const workflow = readText(".github/workflows/sweep.yml");
1984+
const publisher = readText("src/repair/publish-event-result.ts");
19841985
const recoveryBlock = workflow.slice(
19851986
workflow.indexOf("\n recover-review-failures:"),
19861987
workflow.indexOf("\n\n retry-failed-reviews:"),
@@ -1994,6 +1995,10 @@ test("failed review recovery waits for durable exact-review queue acknowledgemen
19941995
assert.match(recoveryBlock, /sourceAction: "failed_review_shard_recovery"/);
19951996
assert.match(recoveryBlock, /delivery_id: \("router:" \+ \$dispatch_key\)/);
19961997
assert.match(recoveryBlock, /\/internal\/exact-review\/enqueue/);
1998+
assert.match(
1999+
publisher,
2000+
/options\.reviewOnly \? \["--sync-comments-only", "--suppress-automation-markers"\] : \[\]/,
2001+
);
19972002
assert.match(
19982003
recoveryBlock,
19992004
/\.ok == true and \(\.queued == true or \.deduped == true or \.accepted == false\)/,

0 commit comments

Comments
 (0)