Skip to content

Commit 1bcf6fc

Browse files
committed
Require proof-positive superseded PR targets
1 parent fbb0a94 commit 1bcf6fc

4 files changed

Lines changed: 77 additions & 3 deletions

File tree

‎README.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ Open issue/PR pairs from the same author stay open together unless the paired
149149
item is already resolved or a maintainer explicitly asks to close one side.
150150
PR-to-PR duplicate/superseded closes also require a safe canonical target:
151151
ClawSweeper refuses to close one PR as replaced by another PR that is closed
152-
unmerged, still waiting for real behavior proof, F-rated, already proposed for
152+
unmerged, missing positive real behavior proof, F-rated, already proposed for
153153
close, not cleanly mergeable, or otherwise not a viable landing path.
154154

155155
Repository profiles can further narrow apply. ClawHub and ClawSweeper self-review

‎prompts/review-item.md‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -367,7 +367,7 @@ Use reason-specific anchors:
367367
the decision. Keep the PR open when a meaningful unique fix, feature,
368368
security hardening, test, doc, migration, or product decision remains.
369369
- For `clawhub`, inspect `VISION.md` and the relevant plugin/skill/MCP/channel/provider docs or APIs, then confirm the request can be satisfied outside core without a missing extension API.
370-
- For `duplicate_or_superseded`, read the canonical related report/PR from the provided context or `gh`, and explain whether it is open, closed, merged, or already shipped. For pull requests, do not close a PR as superseded by another PR unless the replacement is merged, or it is still open and appears to be a safe landing path. Keep the source PR open when the proposed replacement PR is closed unmerged, still waiting for real behavior proof, F-rated, proposed for close, not cleanly mergeable, or otherwise not a safe canonical target.
370+
- For `duplicate_or_superseded`, read the canonical related report/PR from the provided context or `gh`, and explain whether it is open, closed, merged, or already shipped. For pull requests, do not close a PR as superseded by another PR unless the replacement is merged, or it is still open and appears to be a safe landing path with positive real behavior proof. Keep the source PR open when the proposed replacement PR is closed unmerged, missing positive real behavior proof, F-rated, proposed for close, not cleanly mergeable, or otherwise not a safe canonical target.
371371
- For `low_signal_unmergeable_pr`, inspect the PR title/body, diff, touched files, comments, current docs/code ownership, and any maintainer review notes. Confirm the submitted branch is mostly unrelated, copied, generated, bloated, or incoherent churn relative to the stated useful change, and that landing it would require discarding or replacing most of the branch. Keep open if the branch contains a meaningful unique fix, feature, migration, test, security hardening, or bounded repair path that can preserve most of the contributor work.
372372
- For `not_actionable_in_repo`, read enough discussion/context to confirm the action belongs to repo/project administration, third-party setup, external ownership, or historical cleanup rather than OpenClaw code/docs.
373373
- For `stale_insufficient_info`, confirm the missing reproduction data is the blocker after checking current code/docs for an obvious known fix or active path.
@@ -384,7 +384,7 @@ Close only when the evidence is strong and the repository policy allows it. Allo
384384
- `mostly_implemented_on_main`: an older PR is more than 60 days old, current `main` already implements the central useful part of the PR, and no meaningful unique remainder should be merged from the branch. Use only for pull requests, not issues. The close comment must say what part is already on `main`, what leftover part is minor/obsolete/superseded or separately tracked, and why keeping the stale branch open is not useful.
385385
- `cannot_reproduce`: you tried a reasonable reproduction path against current `main` and it does not reproduce, or the report is obsolete and no longer matches current behavior.
386386
- `clawhub`: useful idea, but it belongs as a ClawHub skill/plugin rather than OpenClaw core. Use `VISION.md` as the scope anchor. Prefer this when the requested capability is optional integration/provider/channel/skill/bundle/MCP work, can be built with current skill/MCP/plugin surfaces, has no concrete missing core extension API, and has no protected maintainer signal. This includes service-specific channels, providers, optional skills, and plugin-discovery/publishing ideas when the current plugin or bundle-style interface is sufficient. For OpenClaw PRs that only add bundled skills under paths like `skills/<vendor>/**`, set `itemCategory: "skill"` and prefer `closeReason: "clawhub"` with high confidence; the close comment should ask the contributor to upload or publish it through ClawHub.com instead of bundling it in OpenClaw core. Keep open when the item reports a regression in bundled core behavior, identifies a missing plugin API needed before external implementation is possible, involves security/core hardening, or clearly needs explicit maintainer product judgment.
387-
- `duplicate_or_superseded`: another issue/PR already tracks the same remaining work, or the linked discussion/PR clearly supersedes this item. Link the canonical item and explain whether it is open or closed/merged. For clusters with the same root cause, keep one canonical issue open and close satellites when their unique logs, platforms, or context can be preserved by linking them in the close comment. For PR-to-PR supersession, the canonical PR must be merged or still open and viable; do not treat a closed-unmerged, F/no-proof, proposed-close, not-cleanly-mergeable, or otherwise unsafe PR as a reason to close another PR. Unique evidence blocks duplicate close only when it implies a distinct root cause, platform-specific fix, or separate remaining product behavior.
387+
- `duplicate_or_superseded`: another issue/PR already tracks the same remaining work, or the linked discussion/PR clearly supersedes this item. Link the canonical item and explain whether it is open or closed/merged. For clusters with the same root cause, keep one canonical issue open and close satellites when their unique logs, platforms, or context can be preserved by linking them in the close comment. For PR-to-PR supersession, the canonical PR must be merged or still open, proof-positive, and viable; do not treat a closed-unmerged, F/no-proof, proposed-close, not-cleanly-mergeable, or otherwise unsafe PR as a reason to close another PR. Unique evidence blocks duplicate close only when it implies a distinct root cause, platform-specific fix, or separate remaining product behavior.
388388
- `low_signal_unmergeable_pr`: a pull request may contain a small useful idea, but the submitted branch is net-negative and should not stay open as a landing candidate because most of the diff is unrelated, copied, generated, bloated, internally incoherent, or conflicts with the repository's existing structure. Use this for PRs like a narrow docs title that inserts a large unrelated reference block, a tiny bug fix mixed with broad unrelated rewrites, or generated/vendor/config churn unrelated to the stated purpose. The close comment must acknowledge any useful part, explain the concrete unmergeable diff, and invite a new narrow PR for the useful change. Do not use this when the PR has meaningful unique work that can be repaired without throwing away most of the branch, when maintainers asked to preserve/adopt the branch, when a protected label or maintainer author requires human judgment, or when the only issue is ordinary missing proof, test coverage, style, or review follow-up.
389389
- `not_actionable_in_repo`: the request is concrete enough to understand, but the action belongs outside the OpenClaw source repository, such as GitHub/project administration, external hosted setup, third-party service configuration, domain/account ownership, or historical comment/issue cleanup that cannot be fixed by changing OpenClaw code or docs. Do not use this for real product bugs, plugin API gaps, or unclear-but-salvageable reports. Use this for setup/support reports, one-line reports, screenshot-only reports, or credential-redaction incidents only when current code/docs show the behavior is expected or externally configured and the item lacks a concrete source-level reproduction. Do not keep these open only to collect support logs; the close comment should ask for credential rotation/redaction when relevant and point to the exact diagnostic command or docs page needed for a new actionable report.
390390
- `incoherent`: the item is too unclear or internally contradictory after reading the title/body/comments.

‎src/clawsweeper.ts‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10263,6 +10263,9 @@ function unsafeCanonicalPullRequestReason(
1026310263
return `linked canonical PR #${linkedPull.number} is F-rated`;
1026410264
}
1026510265
}
10266+
if (!proofPassed) {
10267+
return `linked canonical PR #${linkedPull.number} has no positive real behavior proof`;
10268+
}
1026610269

1026710270
return null;
1026810271
}

‎test/clawsweeper.test.ts‎

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7958,6 +7958,7 @@ test("apply-decisions promotes PRs superseded by linked pull requests", () => {
79587958
state: "open",
79597959
merged_at: null,
79607960
mergeable_state: "clean",
7961+
labels: ["proof: sufficient"],
79617962
},
79627963
},
79637964
}),
@@ -7997,6 +7998,76 @@ test("apply-decisions promotes PRs superseded by linked pull requests", () => {
79977998
}
79987999
});
79998000

8001+
test("apply-decisions does not promote PRs superseded by no-proof linked pull requests", () => {
8002+
const root = mkdtempSync(tmpPrefix);
8003+
try {
8004+
const itemsDir = join(root, "items");
8005+
const closedDir = join(root, "closed");
8006+
const plansDir = join(root, "plans");
8007+
const reportPath = join(root, "apply-report.json");
8008+
mkdirSync(itemsDir, { recursive: true });
8009+
mkdirSync(plansDir, { recursive: true });
8010+
const synced = reportWithSyncedReviewComment(
8011+
stalePullRequestReport({
8012+
number: 334,
8013+
title: "Old activity PR",
8014+
pr_rating_overall: "D",
8015+
pr_rating_proof: "D",
8016+
work_cluster_refs: JSON.stringify([
8017+
"Superseded by https://github.com/openclaw/openclaw/pull/400",
8018+
]),
8019+
}),
8020+
334,
8021+
"none",
8022+
);
8023+
writeFileSync(join(itemsDir, "334.md"), synced.report, "utf8");
8024+
8025+
withMockGh(
8026+
root,
8027+
promotionGhMock({
8028+
number: 334,
8029+
title: "Old activity PR",
8030+
comment: synced.comment,
8031+
linkedPulls: {
8032+
400: {
8033+
number: 400,
8034+
title: "Canonical activity PR without proof",
8035+
html_url: "https://github.com/openclaw/openclaw/pull/400",
8036+
state: "open",
8037+
merged_at: null,
8038+
mergeable_state: "clean",
8039+
},
8040+
},
8041+
}),
8042+
() => {
8043+
runApplyDecisionsForTest({
8044+
itemsDir,
8045+
closedDir,
8046+
plansDir,
8047+
reportPath,
8048+
extraArgs: [
8049+
"--target-repo",
8050+
"openclaw/openclaw",
8051+
"--dry-run",
8052+
"--apply-kind",
8053+
"all",
8054+
"--processed-limit",
8055+
"3",
8056+
],
8057+
});
8058+
},
8059+
);
8060+
8061+
const report = JSON.parse(readFileSync(reportPath, "utf8")) as Array<{ action: string }>;
8062+
assert.equal(
8063+
report.some((entry) => entry.action === "closed"),
8064+
false,
8065+
);
8066+
} finally {
8067+
rmSync(root, { recursive: true, force: true });
8068+
}
8069+
});
8070+
80008071
test("apply-decisions does not promote PRs superseded by unsafe linked pull requests", () => {
80018072
const root = mkdtempSync(tmpPrefix);
80028073
try {

0 commit comments

Comments
 (0)