Skip to content

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

fix: honor the maintainer-targeted waiver in the pre-action eligibility recheck

[._.]/ Adam Eivy15518ec2d84c
diff --git a/server/services/issueWatcher.js b/server/services/issueWatcher.js
index 6e13a22b3e..3aba714517 100644
--- a/server/services/issueWatcher.js
+++ b/server/services/issueWatcher.js
@@ -293,7 +293,14 @@ function sameNumberList(left, right) {
async function eligibilityFactsStillCurrent(ctx, pr, target) {
const expected = normalizeEligibilityFacts(target?.eligibilityFacts);
const authorLogin = typeof target?.authorLogin === 'string' ? target.authorLogin.trim() : '';
- if (!expected.issueLookupComplete || !authorLogin || !sameLogin(pr?.author?.login, authorLogin)) return false;
+ 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;
+ if (!expected.issueLookupComplete) return false;
if (expected.linkedIssueNumbers.length === 0) return false;
const issues = await Promise.all(expected.linkedIssueNumbers.map((number) => (
diff --git a/server/services/issueWatcher.test.js b/server/services/issueWatcher.test.js
index eee5114d52..7057f8ab87 100644
--- a/server/services/issueWatcher.test.js
+++ b/server/services/issueWatcher.test.js
@@ -448,6 +448,57 @@ describe('processTaskOutput', () => {
expect(mergePrMock).not.toHaveBeenCalled();
});
+ // The gate waived the linked-issue prerequisite for a maintainer-targeted
+ // run; the pre-action recheck must honor the same waiver, or a "Review this
+ // PR" request on a PR with no linked issue is reviewed by the model and then
+ // silently never posted.
+ it('still acts on a maintainer-targeted PR that has no linked issue', async () => {
+ installDefaultGhMock();
+ mergePrMock.mockResolvedValue({ success: true });
+ const targetedMetadata = {
+ issueWatcher: {
+ ...eligibilityMetadata.issueWatcher,
+ pullRequests: [{
+ ...eligibilityMetadata.issueWatcher.pullRequests[0],
+ eligibilityFacts: {
+ linkedIssueNumbers: [], openLinkedIssueNumbers: [], openerAssignedIssueNumbers: [],
+ issueLookupComplete: true, maintainerTargeted: true,
+ },
+ }],
+ },
+ };
+ const payload = {
+ issueComments: [],
+ pullRequests: [{
+ number: 7, headSha: 'a'.repeat(40), verdict: 'approve', summary: 'No material issues found.', findings: [],
+ rebaseRequired: false, ciPolicy: 'required',
+ }],
+ };
+
+ const result = await processTaskOutput({
+ appId: APP.id,
+ success: true,
+ payload,
+ task: { metadata: targetedMetadata },
+ requireEligibilityFacts: true,
+ });
+
+ expect(result).toMatchObject({ reviewed: 1, merged: 1 });
+ // The author identity is still rechecked.
+ targetedMetadata.issueWatcher.pullRequests[0].authorLogin = 'someone-else';
+ execGhMock.mockClear();
+ mergePrMock.mockClear();
+ const swapped = await processTaskOutput({
+ appId: APP.id,
+ success: true,
+ payload,
+ task: { metadata: targetedMetadata },
+ requireEligibilityFacts: true,
+ });
+ expect(swapped).toMatchObject({ reviewed: 0, merged: 0 });
+ expect(mergePrMock).not.toHaveBeenCalled();
+ });
+
it('revalidates matching issue facts before approving and merging', async () => {
installDefaultGhMock({
issueDetails: {