Skip to content

fix(orb): align derivePublicCommentMergeFacts' neverClosed with the planner's close-eligibility formula - #8786

Merged
JSONbored merged 1 commit into
JSONbored:mainfrom
kai392:fix/critical-issue-public-comment-never-closed
Jul 26, 2026
Merged

fix(orb): align derivePublicCommentMergeFacts' neverClosed with the planner's close-eligibility formula#8786
JSONbored merged 1 commit into
JSONbored:mainfrom
kai392:fix/critical-issue-public-comment-never-closed

Conversation

@kai392

@kai392 kai392 commented Jul 26, 2026

Copy link
Copy Markdown
Contributor

Summary

derivePublicCommentMergeFacts computed neverClosed from only authorLogin === repoOwner || isProtectedAutomationAuthor, diverging from the real close-eligibility formula the planner uses
(closeWithheldReason in this file, and agent-actions.ts's closeEligible):
(authorIsOwner || authorIsAdmin) && closeOwnerAuthors !== true.

Two consequences fixed:

  • A per-repo admin (non-owner) author was wrongly shown as closable, even though the planner
    protects them the same as the owner.
  • An owner-authored PR on a closeOwnerAuthors: true repo was wrongly shown as un-closable
    ("held"), even though the planner can actually close it.

The caller resolves the author's live per-repo admin status via isPerTenantAdmin (the same source
the freeze-exemption check already uses) and threads it plus closeOwnerAuthors (through the
existing settings) into the pure function.

Test plan

  • New: neverClosed is false for an owner-authored PR once closeOwnerAuthors: true (was true)
  • New: neverClosed is true for a per-repo admin (non-owner) author without closeOwnerAuthors
  • Existing neverClosed cases (contributor, plain owner, protected automation, missing login) unchanged
  • Non-vacuity verified: reverting the formula makes both new tests fail
  • Full branch coverage of the new formula; tsc --noEmit clean; all touched unit tests green

Closes #8683

@kai392
kai392 requested a review from JSONbored as a code owner July 26, 2026 05:44
@superagent-security

Copy link
Copy Markdown
Contributor

Superagent didn't find any vulnerabilities or security issues in this PR.

…lanner's close-eligibility formula

derivePublicCommentMergeFacts computed neverClosed from only `authorLogin === repoOwner ||
isProtectedAutomationAuthor`, diverging from the real close-eligibility formula the planner uses
(closeWithheldReason, agent-actions.ts): `(authorIsOwner || authorIsAdmin) && closeOwnerAuthors !== true`.

Two consequences fixed:
- A per-repo admin (non-owner) author was wrongly shown as closable (planner protects them like the owner).
- An owner-authored PR on a `closeOwnerAuthors: true` repo was wrongly shown as un-closable ("held")
  even though the planner can actually close it.

The caller resolves the author's live per-repo admin status via isPerTenantAdmin (the same source the
freeze-exemption check already uses) and threads it plus closeOwnerAuthors into the pure function.

Closes JSONbored#8683

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@codecov

codecov Bot commented Jul 26, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 91.19%. Comparing base (476b98d) to head (cdc8762).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #8786      +/-   ##
==========================================
+ Coverage   90.56%   91.19%   +0.63%     
==========================================
  Files          96       97       +1     
  Lines       22490    25690    +3200     
  Branches     3884     5022    +1138     
==========================================
+ Hits        20367    23429    +3062     
- Misses       1945     1994      +49     
- Partials      178      267      +89     
Flag Coverage Δ
backend 95.68% <100.00%> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
src/queue/processors.ts 95.68% <100.00%> (ø)

@loopover-orb loopover-orb Bot added the gittensor:bug Gittensor-scored bug fix — scores a 0.05x multiplier. label Jul 26, 2026
@loopover-orb

loopover-orb Bot commented Jul 26, 2026

Copy link
Copy Markdown
Contributor

Tip

✅ LoopOver review result - approve/merge recommended

Review updated: 2026-07-26 05:53:05 UTC

3 files · 1 AI reviewer · no blockers · readiness 100/100 · CI green · clean

✅ Suggested Action - Approve/Merge

  • safe to merge

Review summary
This PR aligns derivePublicCommentMergeFacts' neverClosed formula with the planner's real close-eligibility logic by threading in a caller-resolved authorIsAdmin flag and the closeOwnerAuthors setting, fixing two divergence cases: non-owner admins wrongly shown as closable, and closeOwnerAuthors-opted-in owners wrongly shown as held. The caller wiring resolves authorIsAdmin via isPerTenantAdmin (the same source the freeze-exemption check already uses), and the accompanying tests cover both new branches plus regression-check the prior cases, closing issue #8683.

Nits — 3 non-blocking
  • src/queue/processors.ts: `String(author)` is used to coerce a possibly-null author into isPerTenantAdmin — worth confirming isPerTenantAdmin treats the literal string "null"/"undefined" as a safe not-admin rather than accidentally matching a real login named that way.
  • The new isPerTenantAdmin call adds a network/DB round trip on every maybePublishPrPublicSurface invocation; since this only affects the public comment's neverClosed framing rather than the merge/close decision itself, consider whether this needs to be as eager as the freeze-exemption check it piggybacks on.
  • src/queue/processors.ts: consider caching or batching the isPerTenantAdmin lookup if it's already computed for the freeze-exemption check nearby, to avoid a duplicate lookup for the same author/repo pair.

Decision drivers

  • ✅ Code review — No blockers (1 reviewer)
  • ✅ Gate result — Passing (No configured blocker found.)
Context & advisory signals — never blocks the verdict
Signal Result Evidence
Linked issue ✅ Linked #8683
Related work ✅ No active overlap found No same-issue or scoped active PR overlap found.
Change scope ✅ 20/20 Low review scope from cached public metadata (1 linked issue).
Validation posture ✅ 25/25 PR body includes validation/test evidence.
Contributor workload ✅ 10/10 Author activity: 153 registered-repo PR(s), 81 merged, 6 issue(s).
Contributor context ✅ Confirmed Gittensor contributor kai392; Gittensor profile; 153 PR(s), 6 issue(s).
Improvement ✅ Minor risk: clean · value: minor · LLM: moderate
Linked issue satisfaction

Addressed
The diff updates derivePublicCommentMergeFacts's neverClosed formula to (authorIsOwner || authorIsAdmin) && closeOwnerAuthors !== true, matching closeWithheldReason, threads a caller-resolved authorIsAdmin via isPerTenantAdmin, and adds the two required tests plus preserves existing cases.

Review context
  • Author: kai392
  • Role context: outside_contributor
  • Public audience mode: oss maintainer
  • Lane context: Repository is configured for direct PR review.
  • Public profile languages: Python, Cuda, JavaScript, Kotlin, Perl, TypeScript, Vue
  • Official Gittensor activity: 153 PR(s), 6 issue(s).
  • PR-specific overlap: none found.
Contributor next steps
  • Keep the PR focused and include validation evidence before maintainer review.
Signal definitions
  • Related work = same linked issue, overlapping active PRs, or title/path similarity.
  • Change scope = cached public metadata such as size labels, draft state, and review-burden hints.
  • Validation posture = whether the PR provides enough public validation/test evidence for maintainer review.
  • Contributor workload = public contributor activity and cleanup pressure, not a repo-wide quality failure.
  • Contributor context = public GitHub/Gittensor identity context; non-Gittensor status is not a blocker.
🧪 Chat with LoopOver

Ask LoopOver a question about this PR directly in a comment — grounded only in the same cached, public-safe facts shown above, never a new claim.

  • @loopover ask &lt;question&gt; answers contribution-quality Q&A with source citations and freshness.
  • @loopover chat &lt;question&gt; answers in natural prose from cached decision-pack facts via local inference (maintainer/collaborator; read-only).
  • A plain-language @loopover mention with a real question is routed to the closest matching read-only command automatically — no exact syntax required.

Full command reference: https://loopover.ai/docs/loopover-commands

🧪 Experimental — new and may change.

🟩 Safe / merged · 🟦 Advisory · 🟨 Held for review · 🟥 Blocked / closed


💰 Earn for open-source contributions like this. Gittensor lets GitHub contributors earn for the work they already do — register to start earning →.

Checked by LoopOver, a quiet PR intelligence layer for OSS maintainers.

  • Re-run LoopOver review

@loopover-orb loopover-orb Bot added the manual-review Gittensor contributor context label Jul 26, 2026
@JSONbored
JSONbored merged commit 3e48bc3 into JSONbored:main Jul 26, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gittensor:bug Gittensor-scored bug fix — scores a 0.05x multiplier. manual-review Gittensor contributor context

Projects

None yet

Development

Successfully merging this pull request may close these issues.

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

3 participants