Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS
JavaScript ai-agentsdashboarddeveloper-toolsdigital-twinquantified-selfsecond-brainself-hostedtailscale
refactor: share the maintainer-targeted waiver between the eligibility gate and the pre-action recheck
[._.]/ Adam Eivy7f050c4eea46
diff --git a/server/lib/modelAbuseGuard.js b/server/lib/modelAbuseGuard.jsindex ab99a6b1ee..4324b70142 100644--- a/server/lib/modelAbuseGuard.js+++ b/server/lib/modelAbuseGuard.js@@ -205,6 +205,17 @@ export function normalizeEligibilityFacts(value) {};}+/**+ * Whether the linked-open-issue prerequisite is waived for this PR. The+ * server sets `maintainerTargeted` only for an explicit "Review this PR"+ * request: that prerequisite bounds UNATTENDED spend on unsolicited PRs, and+ * the request is the maintainer spending it. Both the eligibility gate and the+ * pre-action recheck read the waiver from here so they cannot disagree.+ */+export function issuePrerequisiteWaived(facts) {+ return normalizeEligibilityFacts(facts).maintainerTargeted;+}+const blockingFinding = (category, reason) => ({severity: 'blocking',category,diff --git a/server/services/issueWatcher.js b/server/services/issueWatcher.jsindex 3aba714517..3b5e53d9d7 100644--- a/server/services/issueWatcher.js+++ b/server/services/issueWatcher.js@@ -25,6 +25,7 @@ import { execGh, ensureForgeReachable } from './github.js';import { mergePR, resolveForgeForRepo } from './git.js';import { addNotification, NOTIFICATION_TYPES, PRIORITY_LEVELS } from './notifications.js';import { normalizeEligibilityFacts, runModelAbuseScan } from './modelAbuseGuard.js';+import { issuePrerequisiteWaived } from '../lib/modelAbuseGuard.js';const GH_TIMEOUT_MS = 60_000;const LIST_LIMIT = 100;@@ -294,12 +295,10 @@ async function eligibilityFactsStillCurrent(ctx, pr, target) {const expected = normalizeEligibilityFacts(target?.eligibilityFacts);const authorLogin = typeof target?.authorLogin === 'string' ? target.authorLogin.trim() : '';if (!authorLogin || !sameLogin(pr?.author?.login, authorLogin)) return false;- // A maintainer-targeted run ("Review this PR") waived the linked-open-issue- // prerequisite at the gate (see prReviewerPipeline's eligibilityFactsAllow);- // the waiver is the maintainer's explicit request, which cannot go stale, so- // re-requiring an open linked issue here would silently skip every action- // on a PR with none. Only the author identity is rechecked.- if (expected.maintainerTargeted) return true;+ // A waived prerequisite (the maintainer's explicit request) cannot go stale,+ // so only the author identity is rechecked for it; re-requiring an open+ // linked issue here would silently skip every action on a PR with none.+ if (issuePrerequisiteWaived(expected)) return true;if (!expected.issueLookupComplete) return false;if (expected.linkedIssueNumbers.length === 0) return false;diff --git a/server/services/prReviewerPipeline.js b/server/services/prReviewerPipeline.jsindex 2bf88c4268..03a9fc9f76 100644--- a/server/services/prReviewerPipeline.js+++ b/server/services/prReviewerPipeline.js@@ -9,7 +9,7 @@* response, and eligibility reasons can never cross into the action stage.*/-import { MODEL_ABUSE_GUARD_ID, normalizeEligibilityFacts } from '../lib/modelAbuseGuard.js';+import { MODEL_ABUSE_GUARD_ID, issuePrerequisiteWaived, normalizeEligibilityFacts } from '../lib/modelAbuseGuard.js';import { PUBLIC_REVIEW_ACTIONS_EXECUTION_PROFILE, PUBLIC_REVIEW_GATE_EXECUTION_PROFILE } from '../lib/agentExecutionProfiles.js';import { createPrReviewerDefaultStages } from './taskScheduleRegistry.js';import {@@ -103,11 +103,8 @@ function normalizedExpectedPullRequests(task) {// `facts` is already normalized by normalizedExpectedPullRequests.function eligibilityFactsAllow(facts) {- // A maintainer-targeted run ("Review this PR") waives the linked-open-issue- // prerequisite: that rule bounds unattended spend on unsolicited PRs, and an- // explicit request is the maintainer spending it. The model's own quality- // verdict still applies.- if (facts.maintainerTargeted) return true;+ // The model's own quality verdict still applies to a waived PR.+ if (issuePrerequisiteWaived(facts)) return true;if (!facts.issueLookupComplete) return false;const linked = new Set(facts.linkedIssueNumbers);const open = new Set(facts.openLinkedIssueNumbers);