Skip to content

fix(agent): live-verify install-wide contributor cap siblings, report mixed item kind#2704

Merged
JSONbored merged 1 commit into
mainfrom
fix/global-cap-live-verify-and-itemkind
Jul 3, 2026
Merged

fix(agent): live-verify install-wide contributor cap siblings, report mixed item kind#2704
JSONbored merged 1 commit into
mainfrom
fix/global-cap-live-verify-and-itemkind

Conversation

@JSONbored

Copy link
Copy Markdown
Owner

Summary

  • Live-verifies every OTHER counted sibling PR/issue against GitHub before trusting it toward the install-wide contributor open-item cap, instead of trusting a DB cache that can lag reality (mirrors the existing per-repo issue-cap's own sibling live-verification, feat(agent-actions): auto-close a contributor's PR over the open-PR cap (#2270) #2479).
  • Reports the close reason as "pull requests and issues" (not just one or the other) since the install-wide cap sums both kinds across every repo the installation gates.
  • Bounded-concurrency (10) fan-out for the live-verify reads so a large contributor's item list can't exhaust the installation's rate limit.

Advances #2562

Test plan

  • npm run typecheck
  • npx vitest run test/unit/global-contributor-cap.test.ts test/unit/queue.test.ts test/unit/agent-actions.test.ts (545 passed)

… mixed item kind (#2562)

The install-wide open-item cap trusted a stale DB count without confirming each
counted sibling PR/issue was still open on GitHub, and always labeled the
close reason as either "pull requests" or "issues" even though the cap sums
both across every repo the installation gates.
@JSONbored JSONbored self-assigned this Jul 3, 2026
@codecov

codecov Bot commented Jul 3, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 88.09524% with 5 lines in your changes missing coverage. Please review.
✅ Project coverage is 96.11%. Comparing base (7a4016a) to head (612f31d).
⚠️ Report is 6 commits behind head on main.
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
src/db/repositories.ts 69.23% 3 Missing and 1 partial ⚠️
src/queue/processors.ts 96.55% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2704      +/-   ##
==========================================
- Coverage   96.13%   96.11%   -0.02%     
==========================================
  Files         240      240              
  Lines       26976    27019      +43     
  Branches     9790     9798       +8     
==========================================
+ Hits        25934    25970      +36     
- Misses        432      436       +4     
- Partials      610      613       +3     
Files with missing lines Coverage Δ
src/settings/agent-actions.ts 94.32% <ø> (ø)
src/queue/processors.ts 92.72% <96.55%> (-0.02%) ⬇️
src/db/repositories.ts 96.32% <69.23%> (-0.29%) ⬇️
🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@gittensory-orb

gittensory-orb Bot commented Jul 3, 2026

Copy link
Copy Markdown

Caution

🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥

🛑 Gittensory review result - fixes required

Review updated: 2026-07-03 07:17:31 UTC

5 files · 1 AI reviewer · no blockers · readiness 93/100 · CI failing · unstable

🛑 Suggested Action - Manual Review

  • Touches a guarded path — held for manual review

Review summary
The diff moves the install-wide contributor cap from a cached aggregate to row enumeration plus bounded live verification, then fixes the close-message noun for mixed PR/issue totals. The changed queue paths and repository helper stay installation-scoped, count the current webhook item explicitly, and verify sibling rows through the appropriate GitHub endpoint. I do not see a reachable correctness break in the visible diff, but the most important behavior added here is under-tested on the negative live-verification paths.

Nits — 6 non-blocking
  • nit: src/queue/processors.ts:3941 adds the core stale-cache protection, but the updated queue tests only cover confirmed-open siblings and should also cover a sibling that live-fetches as closed or fails to fetch so the advertised fail-safe exclusion is pinned.
  • nit: src/db/repositories.ts:3150 adds `AUTHOR_OPEN_ITEM_LIST_LIMIT` truncation audits, but the queue-level cap path has no test showing an author at/over the cap is not closed from unverified or truncated rows alone.
  • nit: src/queue/processors.ts:3962 introduces a generic `mapWithConcurrency` in a large processor module; if there is an existing shared bounded-concurrency helper in the repo, prefer reusing it to avoid another subtly different implementation.
  • Add a queue regression test where one sibling row is cached open but GitHub returns `closed`, and assert the current item is not closed unless the remaining confirmed-open count still exceeds the cap.
  • Add a queue regression test where `createInstallationToken` or a sibling live fetch fails, and assert that unconfirmed sibling is excluded from `verifiedGlobalOpenItemCount`.
  • Touches a guarded path — held for manual review — A maintainer must review and merge this change.

CI checks failing

  • codecov/patch — 88.09% of diff hit (target 99.00%)
Signal Result Evidence
Code review ✅ No blockers 1 reviewer
Linked issue ⚠️ Missing No linked issue or no-issue rationale found.
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 (no linked issue context).
Validation posture ✅ 25/25 PR body includes validation/test evidence.
Contributor workload ✅ 10/10 Author activity: 61 registered-repo PR(s), 52 merged, 489 issue(s).
Contributor context ✅ Confirmed Gittensor contributor JSONbored; Gittensor profile; 61 PR(s), 489 issue(s).
Gate result ⚠️ Not blocking Advisory; not blocking this PR.
Review context
  • Author: JSONbored
  • Role context: owner (maintainer lane)
  • Public audience mode: oss maintainer
  • Lane context: Repository registration is not available in the local Gittensory cache.
  • Public profile languages: Python, TypeScript, JavaScript, Ruby, Go, Kotlin, MDX, Shell
  • Official Gittensor activity: 61 PR(s), 489 issue(s).
  • PR-specific overlap: none found.
Contributor next steps
  • Treat this as maintainer-lane context rather than normal contributor-lane activity.
  • Explain no-issue PR.
  • No action.
  • Link the issue being solved, or explicitly explain why this is a no-issue PR.
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.

🟩 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 Gittensory, a quiet PR intelligence layer for OSS maintainers.

  • Re-run Gittensory review

@gittensory-orb gittensory-orb Bot added gittensor Gittensor contributor context gittensor:bug Gittensor-scored bug fix — scores a 0.5x multiplier. labels Jul 3, 2026
@JSONbored JSONbored merged commit 82c697a into main Jul 3, 2026
11 of 12 checks passed
@JSONbored JSONbored deleted the fix/global-cap-live-verify-and-itemkind branch July 3, 2026 07:40
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.5x multiplier. gittensor Gittensor contributor context

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant