Skip to content

Commit b26b1e5

Browse files
committed
fix: align low-signal promotion selection
1 parent 7da012a commit b26b1e5

2 files changed

Lines changed: 79 additions & 9 deletions

File tree

‎src/repair/workflow-utils.ts‎

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1482,7 +1482,8 @@ function hasPullRequestClosePromotionSignal(
14821482
): boolean {
14831483
return (
14841484
hasLinkedPullRequestSupersessionSignal(markdown, targetRepo) ||
1485-
((hasRecommendedPauseOrCloseOption(markdown) || hasStaleFRatedPullRequestSignal(markdown)) &&
1485+
((hasRecommendedPauseOrCloseOption(markdown) ||
1486+
hasLowSignalPullRequestPromotionSignal(markdown)) &&
14861487
olderThan(frontMatterValue(markdown, "item_created_at"), options.staleMinAgeMs))
14871488
);
14881489
}
@@ -1501,7 +1502,7 @@ function pullRequestClosePromotionReasons(
15011502
// to the low-signal promotion when that linked candidate does not cover it.
15021503
if (
15031504
!recommendedPauseOrClose &&
1504-
hasStaleFRatedPullRequestSignal(markdown) &&
1505+
hasLowSignalPullRequestPromotionSignal(markdown) &&
15051506
olderThan(frontMatterValue(markdown, "item_created_at"), options.staleMinAgeMs)
15061507
) {
15071508
reasons.push("low_signal_unmergeable_pr");
@@ -1560,12 +1561,20 @@ function hasRecommendedPauseOrCloseOption(markdown: string): boolean {
15601561
});
15611562
}
15621563

1563-
function hasStaleFRatedPullRequestSignal(markdown: string): boolean {
1564+
function hasLowSignalPullRequestPromotionSignal(markdown: string): boolean {
1565+
const ratingSection = sectionValue(markdown, "PR Rating");
1566+
const proofSection = sectionValue(markdown, "Real Behavior Proof");
1567+
const overallTier =
1568+
sectionLineValue(ratingSection, "Overall tier") ||
1569+
frontMatterValue(markdown, "pr_rating_overall");
1570+
const proofTier =
1571+
sectionLineValue(ratingSection, "Proof tier") || frontMatterValue(markdown, "pr_rating_proof");
1572+
const proofStatus =
1573+
sectionLineValue(proofSection, "Status") ||
1574+
frontMatterValue(markdown, "real_behavior_proof_status");
15641575
return (
1565-
frontMatterValue(markdown, "pr_rating_overall") === "F" ||
1566-
frontMatterValue(markdown, "pr_rating_proof") === "F" ||
1567-
sectionLineValue(markdown, "Overall tier") === "F" ||
1568-
sectionLineValue(markdown, "Proof tier") === "F"
1576+
overallTier === "F" &&
1577+
(proofTier === "F" || ["missing", "mock_only", "insufficient"].includes(proofStatus))
15691578
);
15701579
}
15711580

‎test/repair/workflow-utils.test.ts‎

Lines changed: 63 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1134,6 +1134,7 @@ test("workflow utilities select eligible proposed close records", () => {
11341134
"action_taken: kept_open",
11351135
"close_reason: none",
11361136
"pr_rating_overall: F",
1137+
"pr_rating_proof: F",
11371138
`item_created_at: ${oldDate}`,
11381139
"---",
11391140
"",
@@ -1292,12 +1293,70 @@ test("workflow utilities select eligible proposed close records", () => {
12921293
"action_taken: kept_open",
12931294
"close_reason: none",
12941295
"pr_rating_overall: F",
1296+
"pr_rating_proof: F",
12951297
`item_created_at: ${oldDate}`,
12961298
`work_cluster_refs: ${JSON.stringify(["Superseded by #400"])}`,
12971299
"---",
12981300
"",
12991301
].join("\n"),
13001302
);
1303+
write(
1304+
path.join(root, "records/openclaw-openclaw/items/openclaw-openclaw-33.md"),
1305+
[
1306+
"---",
1307+
"repository: openclaw/openclaw",
1308+
"type: pull_request",
1309+
"decision: keep_open",
1310+
"review_status: complete",
1311+
"local_checkout_access: verified",
1312+
"action_taken: kept_open",
1313+
"close_reason: none",
1314+
"pr_rating_overall: B",
1315+
"pr_rating_proof: F",
1316+
"real_behavior_proof_status: missing",
1317+
`item_created_at: ${oldDate}`,
1318+
"---",
1319+
"",
1320+
].join("\n"),
1321+
);
1322+
write(
1323+
path.join(root, "records/openclaw-openclaw/items/openclaw-openclaw-34.md"),
1324+
[
1325+
"---",
1326+
"repository: openclaw/openclaw",
1327+
"type: pull_request",
1328+
"decision: keep_open",
1329+
"review_status: complete",
1330+
"local_checkout_access: verified",
1331+
"action_taken: kept_open",
1332+
"close_reason: none",
1333+
"pr_rating_overall: F",
1334+
"pr_rating_proof: A",
1335+
"real_behavior_proof_status: sufficient",
1336+
`item_created_at: ${oldDate}`,
1337+
"---",
1338+
"",
1339+
].join("\n"),
1340+
);
1341+
write(
1342+
path.join(root, "records/openclaw-openclaw/items/openclaw-openclaw-35.md"),
1343+
[
1344+
"---",
1345+
"repository: openclaw/openclaw",
1346+
"type: pull_request",
1347+
"decision: keep_open",
1348+
"review_status: complete",
1349+
"local_checkout_access: verified",
1350+
"action_taken: kept_open",
1351+
"close_reason: none",
1352+
"pr_rating_overall: F",
1353+
"pr_rating_proof: A",
1354+
"real_behavior_proof_status: insufficient",
1355+
`item_created_at: ${oldDate}`,
1356+
"---",
1357+
"",
1358+
].join("\n"),
1359+
);
13011360

13021361
const selected = withCwd(root, () =>
13031362
proposedItemNumbers({
@@ -1310,7 +1369,7 @@ test("workflow utilities select eligible proposed close records", () => {
13101369
}),
13111370
);
13121371

1313-
assert.deepEqual(selected, [5, 12, 15, 17, 18, 21, 22, 24, 25, 26, 27, 30, 31, 32]);
1372+
assert.deepEqual(selected, [5, 12, 15, 17, 18, 21, 22, 24, 25, 26, 27, 30, 31, 32, 35]);
13141373
assert.deepEqual(
13151374
withCwd(root, () =>
13161375
proposedItemNumbers({
@@ -1322,7 +1381,7 @@ test("workflow utilities select eligible proposed close records", () => {
13221381
minAgeMinutes: null,
13231382
}),
13241383
),
1325-
[15, 22, 32],
1384+
[15, 22, 32, 35],
13261385
);
13271386
assert.deepEqual(
13281387
withCwd(root, () =>
@@ -1592,6 +1651,7 @@ test("workflow utilities select proposed PR closes that can need coverage proof"
15921651
"close_reason: none",
15931652
`item_created_at: ${oldDate}`,
15941653
"pr_rating_overall: F",
1654+
"pr_rating_proof: F",
15951655
"---",
15961656
"",
15971657
].join("\n"),
@@ -1754,6 +1814,7 @@ test("workflow utilities run a bounded confirmed prefix before proof and defer p
17541814
"close_reason: none",
17551815
`item_created_at: ${oldDate}`,
17561816
"pr_rating_overall: F",
1817+
"pr_rating_proof: F",
17571818
"---",
17581819
"",
17591820
].join("\n"),

0 commit comments

Comments
 (0)