Skip to content

fix(orb): derivePublicCommentMergeFacts's neverClosed ignores closeOwnerAuthors and admin authors #8683

Description

@JSONbored

⚠️ Definition of Done: this issue must be completed in full, in a single PR. Do not split this
work across multiple PRs, and do not defer any Deliverable below to a follow-up issue. A PR that
satisfies only some of the Deliverables, stubs a required test, or leaves a checkbox
partially-done does NOT resolve this issue and will be closed.

Context

src/queue/processors.ts:2071-2072's derivePublicCommentMergeFacts computes its neverClosed
flag using only two conditions: authorLogin === repoOwner or isProtectedAutomationAuthor.

The real close-eligibility formula used elsewhere in this same file (closeWithheldReason, lines
2226-2229) and in the canonical planner logic
(packages/loopover-engine/src/settings/agent-actions.ts:955) is:
closeEligible = isContributor || ((authorIsOwner || authorIsAdmin) && closeOwnerAuthors === true).

derivePublicCommentMergeFacts's neverClosed computation diverges from this in two ways:

  • It never checks authorIsAdmin (only the repo owner), so a per-repo admin author (non-owner) is
    incorrectly NOT flagged as neverClosed, when the planner actually protects them the same as the
    owner.
  • It never checks closeOwnerAuthors, so a repo with closeOwnerAuthors: true (explicitly opting
    in to closing owner-authored PRs) still shows neverClosed: true in the public comment for an
    owner-authored PR the planner can actually close.

test/unit/processors-public-comment-merge-facts.test.ts never exercises closeOwnerAuthors: true
or an admin (non-owner) author, confirming this divergence is untested.

Requirements

  • Update derivePublicCommentMergeFacts's neverClosed computation to match the real
    close-eligibility formula exactly: check authorIsAdmin in addition to authorIsOwner, and
    respect closeOwnerAuthors the same way closeWithheldReason already does.

Deliverables

  • neverClosed is false for an owner-authored PR when the repo has closeOwnerAuthors: true
    (currently true).
  • neverClosed is true for an admin (non-owner) author when the repo does not have
    closeOwnerAuthors: true for admins (currently false).
  • A new test for each of the two cases above, added to
    test/unit/processors-public-comment-merge-facts.test.ts.
  • Existing tests for the currently-covered cases (contributor author, plain owner author without
    closeOwnerAuthors) continue to pass unchanged.

All Deliverables above are required in the same PR.

Test Coverage Requirements

src/** is measured by codecov/patch (99%+ target, branch-counted). The two new tests must
exercise the previously-uncovered closeOwnerAuthors: true and admin-author branches directly.

Expected Outcome

The public comment's neverClosed claim matches the real close-eligibility formula the planner
actually uses, so the public-facing text is never wrong about whether a PR could be auto-closed.

Links & Resources

  • src/queue/processors.ts:2071-2072 (derivePublicCommentMergeFacts, the function to fix), :2226-2229
    (closeWithheldReason, the already-correct sibling to mirror)
  • packages/loopover-engine/src/settings/agent-actions.ts:955 (the canonical formula)
  • test/unit/processors-public-comment-merge-facts.test.ts (existing test file to extend)

Metadata

Metadata

Assignees

No one assigned

    Labels

    gittensor:bugGittensor-scored bug fix — scores a 0.05x multiplier.help wantedExtra attention is needed

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions