From c8f23dd3d8e1a1ec6828e55244d4e59151712d78 Mon Sep 17 00:00:00 2001 From: RealDiligent Date: Mon, 20 Jul 2026 19:16:32 +0800 Subject: [PATCH] fix(signals): remove unreachable OpenPrWorkClassification stale Closes #7448 Co-authored-by: Cursor --- apps/loopover-ui/public/openapi.json | 1 - src/openapi/schemas.ts | 1 - src/services/agent-orchestrator.ts | 1 - src/signals/contributor-open-pr-monitor.ts | 5 +---- test/unit/agent-orchestrator.test.ts | 8 ++++---- test/unit/contributor-open-pr-monitor.test.ts | 3 ++- 6 files changed, 7 insertions(+), 12 deletions(-) diff --git a/apps/loopover-ui/public/openapi.json b/apps/loopover-ui/public/openapi.json index 59b5136ab2..610184adc7 100644 --- a/apps/loopover-ui/public/openapi.json +++ b/apps/loopover-ui/public/openapi.json @@ -3120,7 +3120,6 @@ "enum": [ "approved", "blocked", - "stale", "needs_author", "failing_checks", "missing_tests", diff --git a/src/openapi/schemas.ts b/src/openapi/schemas.ts index daf774cd7d..5083af2c84 100644 --- a/src/openapi/schemas.ts +++ b/src/openapi/schemas.ts @@ -412,7 +412,6 @@ export const ContributorOpenPrNextStepPacketSchema = z classification: z.enum([ "approved", "blocked", - "stale", "needs_author", "failing_checks", "missing_tests", diff --git a/src/services/agent-orchestrator.ts b/src/services/agent-orchestrator.ts index 69bed28d91..80783a70b8 100644 --- a/src/services/agent-orchestrator.ts +++ b/src/services/agent-orchestrator.ts @@ -412,7 +412,6 @@ function buildOpenPrMonitorActions(run: AgentRunRecord, pack: ContributorDecisio "needs_author", "failing_checks", "duplicate_prone", - "stale", "should_close_or_withdraw", "blocked", ]); diff --git a/src/signals/contributor-open-pr-monitor.ts b/src/signals/contributor-open-pr-monitor.ts index 051a5e8f39..daae8f676f 100644 --- a/src/signals/contributor-open-pr-monitor.ts +++ b/src/signals/contributor-open-pr-monitor.ts @@ -18,7 +18,6 @@ import { isTestPath } from "./test-evidence"; export type OpenPrWorkClassification = | "approved" | "blocked" - | "stale" | "needs_author" | "failing_checks" | "missing_tests" @@ -112,7 +111,7 @@ export async function buildContributorOpenPrMonitor(env: Env, login: string): Pr packets.sort((left, right) => priorityRank(left.classification) - priorityRank(right.classification) || left.repoFullName.localeCompare(right.repoFullName) || left.number - right.number); const cleanupFirst = packets.some((entry) => - ["needs_author", "failing_checks", "duplicate_prone", "stale", "should_close_or_withdraw", "blocked"].includes(entry.classification), + ["needs_author", "failing_checks", "duplicate_prone", "should_close_or_withdraw", "blocked"].includes(entry.classification), ); const approvedCount = packets.filter((entry) => entry.classification === "approved").length; const summary = summarizeMonitor(openByContributor.length, approvedCount, cleanupFirst); @@ -183,7 +182,6 @@ function nextStepsForClassification(classification: OpenPrWorkClassification, re return [`Add or update tests on ${ref} if the repo expects test coverage.`, `Note test commands run in the PR description.`]; case "duplicate_prone": return [`Check overlap with other open PRs in ${repoFullName}; close or consolidate duplicates.`, `Comment on ${ref} linking the canonical PR if one exists.`]; - case "stale": case "should_close_or_withdraw": return [`Update ${ref} with a short status comment or close it if no longer needed.`, `Do not open new work until stale queue pressure is reduced.`]; case "maintainer_lane": @@ -281,7 +279,6 @@ function priorityRank(classification: OpenPrWorkClassification): number { "missing_tests", "blocked", "should_close_or_withdraw", - "stale", "draft", "reviewable", "approved", diff --git a/test/unit/agent-orchestrator.test.ts b/test/unit/agent-orchestrator.test.ts index fb01b61299..19f8347c68 100644 --- a/test/unit/agent-orchestrator.test.ts +++ b/test/unit/agent-orchestrator.test.ts @@ -235,8 +235,8 @@ describe("agent orchestrator", () => { repoFullName: "private-org/secret-alpha", number: 77, title: "secret-alpha patch", - classification: "stale", - summary: "secret-alpha patch is stale.", + classification: "should_close_or_withdraw", + summary: "secret-alpha patch should be closed or withdrawn.", reasons: ["No updates in 30 days."], nextSteps: ["Privately prioritize the secret-alpha patch before opening more public work."], }, @@ -556,8 +556,8 @@ describe("agent orchestrator", () => { repoFullName: "owner/ready", number: 9, title: "Stale fix", - classification: "stale", - summary: "PR is stale.", + classification: "should_close_or_withdraw", + summary: "PR should be closed or withdrawn.", reasons: ["No updates in 30 days."], nextSteps: ["Rebase or close the PR."], }, diff --git a/test/unit/contributor-open-pr-monitor.test.ts b/test/unit/contributor-open-pr-monitor.test.ts index 88af97621f..b0f6102f3e 100644 --- a/test/unit/contributor-open-pr-monitor.test.ts +++ b/test/unit/contributor-open-pr-monitor.test.ts @@ -346,10 +346,11 @@ describe("contributor open PR monitor", () => { ]), ); + // Every live OpenPrWorkClassification value must have next-steps guidance. "stale" was removed (#7448): + // mapPendingClassToWorkClassification never produced it (upstream stale_likely_close → should_close_or_withdraw). for (const classification of [ "reviewable", "blocked", - "stale", "draft", "maintainer_lane", "missing_tests",