Skip to content

fix(agent-actions): apply account-age throttle on issue contributor-cap path - #3374

Closed
RealDiligent wants to merge 2 commits into
JSONbored:mainfrom
RealDiligent:fix/account-age-throttle-issue-path
Closed

fix(agent-actions): apply account-age throttle on issue contributor-cap path#3374
RealDiligent wants to merge 2 commits into
JSONbored:mainfrom
RealDiligent:fix/account-age-throttle-issue-path

Conversation

@RealDiligent

Copy link
Copy Markdown
Contributor

Summary

Completes the issue-path half of the account-age throttle (#2561): repos with accountAgeThresholdDays configured now get the same anti-ban-evasion friction on issues as on PRs.

Supersedes closed #3179 and #3367 (codecov/CI failures on stale base).

Problem

#2561 tightened PR caps and applied newAccountLabel for young accounts, but RepositorySettings documented that the issue path did not read accountAgeThresholdDays. Contributors could bypass the tightened cap by opening issues instead of PRs.

Implementation

  • maybeCloseIssueOverContributorCap: half-cap for below-threshold authors; fail-open on lookup failure
  • Issue opened webhook: apply newAccountLabel when review_state_label autonomy is auto
  • Five regression tests covering tighten, established account, off-by-default, non-auto label, lookup fail-open

Testing

  • npm run typecheck
  • npm run selfhost:env-reference:check
  • Issue-path account-age unit tests (5)

Compatibility

Default unchanged (accountAgeThresholdDays: null).

RealDiligent and others added 2 commits July 5, 2026 13:23
…ap path

Wire accountAgeThresholdDays into maybeCloseIssueOverContributorCap and
label newly opened issues from below-threshold accounts, completing the

Co-authored-by: Cursor <cursoragent@cursor.com>
JSONbored#2561 issue-path gap documented in RepositorySettings.
…ap path

Wire accountAgeThresholdDays into maybeCloseIssueOverContributorCap and
label newly opened issues from below-threshold accounts, completing the

Co-authored-by: Cursor <cursoragent@cursor.com>
JSONbored#2561 issue-path gap documented in RepositorySettings.
@RealDiligent
RealDiligent requested a review from JSONbored as a code owner July 5, 2026 05:28
@superagent-security

Copy link
Copy Markdown
Contributor

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

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

loopover-orb Bot commented Jul 5, 2026

Copy link
Copy Markdown
Contributor

Caution

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

🛑 Gittensory review result - fixes required

Review updated: 2026-07-05 05:33:28 UTC

3 files · 1 AI reviewer · no blockers · readiness 80/100 · CI failing · unstable

🛑 Suggested Action - Fix Blockers

Review summary
The change wires `accountAgeThresholdDays` into the issue contributor-cap path and adds the issue-open label parity path, with tests covering the main configured/off/established/non-auto/fail-open cases. The cap calculation itself is consistent with the PR-path intent: below-threshold accounts use `ceil(cap / 2)` with a floor of 1, while default settings preserve the old full-cap behavior. The most notable maintainability issue is that the account-age lookup and age calculation are now duplicated in two hot-path branches in `src/queue/processors.ts`, which makes future parity fixes easier to miss.

Nits — 5 non-blocking
  • nit: `src/queue/processors.ts:4827` and `src/queue/processors.ts:5631` duplicate the same exemption, lookup, and age-day calculation; extract or reuse a small helper so PR/issue parity does not drift again.
  • nit: `src/queue/processors.ts:4832` and `src/queue/processors.ts:5649` inline the milliseconds-per-day expression twice; use an existing constant/helper if one exists, or add a local `MS_PER_DAY` for readability.
  • nit: `test/unit/queue.test.ts:10241` hard-codes the shared fetch stub around the `newbie` login, which makes the established-account case less clear because it exercises an `oldbie` payload with a generic `/users/` response.
  • In `src/queue/processors.ts`, factor the repeated account-age check into a helper such as `isBelowAccountAgeThreshold(env, installationId, authorLogin, thresholdDays)` that returns false on unresolved `created_at`, then call it from both the label and cap branches.
  • In `test/unit/queue.test.ts`, make `stubIssueAccountAgeFetch` accept the expected login or derive it from the URL so the tests prove the real author lookup path more explicitly.

CI checks failing

  • codecov/patch — 92.59% of diff hit (target 99.00%)
Signal Result Evidence
Code review ✅ No blockers 1 reviewer
Linked issue ✅ Linked #3179
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 ❌ 5/25 Preflight is holding this PR: the review lane is unavailable, so it is not ready for automated review.
Contributor workload ✅ 10/10 Author activity: 129 registered-repo PR(s), 17 merged, 0 issue(s).
Contributor context ✅ Confirmed Gittensor contributor RealDiligent; Gittensor profile; 129 PR(s), 0 issue(s).
Gate result ✅ Passing No configured blocker found.
Review context
  • Author: RealDiligent
  • Role context: outside_contributor
  • Public audience mode: oss maintainer
  • Lane context: Repository registration is not available in the local Gittensory cache.
  • Public profile languages: not available
  • Official Gittensor activity: 129 PR(s), 0 issue(s).
  • PR-specific overlap: none found.
Contributor next steps
  • Await review-lane availability.
  • Refresh registry data or choose a registered active repo.
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

@codecov

codecov Bot commented Jul 5, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 92.59259% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 93.88%. Comparing base (113da08) to head (191a6a1).
⚠️ Report is 8 commits behind head on main.

Files with missing lines Patch % Lines
src/queue/processors.ts 92.59% 1 Missing and 1 partial ⚠️

❌ Your patch check has failed because the patch coverage (92.59%) is below the target coverage (99.00%). You can increase the patch coverage or adjust the target coverage.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3374      +/-   ##
==========================================
- Coverage   93.89%   93.88%   -0.01%     
==========================================
  Files         283      283              
  Lines       30573    30599      +26     
  Branches    11138    11149      +11     
==========================================
+ Hits        28705    28729      +24     
- Misses       1211     1212       +1     
- Partials      657      658       +1     
Files with missing lines Coverage Δ
src/queue/processors.ts 92.93% <92.59%> (-0.01%) ⬇️
🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@loopover-orb

loopover-orb Bot commented Jul 5, 2026

Copy link
Copy Markdown
Contributor

Gittensory is closing this pull request on the maintainer's behalf (CI is failing (codecov/patch)). This is an automated maintenance action — to pursue this change, please open a new pull request with the issues resolved. Closed PRs may be analyzed later to improve review accuracy, but they are not automatically reopened or re-reviewed.

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.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant