fix: bound issues-sweep cost with per-repo checkpoints and cooldown - #865
fix: bound issues-sweep cost with per-repo checkpoints and cooldown #865ionfwsrijan wants to merge 2 commits into
Conversation
|
@ionfwsrijan is attempting to deploy a commit to the codersogs-3057's projects Team on Vercel. A member of the Team first needs to authorize it. |
|
@Soumya-codr @codersogs-code Please review this |
jakharmonika364
left a comment
There was a problem hiding this comment.
Nice bounding overall - traced the budget logic through sweepRepo and it holds up, with one gap: issueBudget passed to sweepRepo is MAX_ISSUES_PER_SWEEP - totalIssuesSeen (sweep-wide remaining), not scoped to the install's remaining budget. So a repo entered late in an install's loop with little MAX_ISSUES_PER_INSTALL headroom left can still process up to ISSUES_PER_REPO_PAGE (30) issues, overshooting the per-install cap by up to 29. Suggest Math.min(MAX_ISSUES_PER_SWEEP - totalIssuesSeen, MAX_ISSUES_PER_INSTALL - issuesThisInstall) instead. Bounded/low-severity given it's capped by page size, but worth tightening given the "hard cost caps" framing.
|
@jakharmonika364 Please review now |
Fix: Bound Issues-Sweep Cost with Per-Repo Checkpoints and Cooldown (#860)
Problem
The
issues-sweepInngest job ran every 30 minutes and swept every install, every repo, and every issue with no caps. It re-scored every issue on each run (unbounded LLM spend), always re-read page 1 of large repos, re-scored forks whose upstream was already swept, and overlapping runs could double GitHub + LLM spend.Changes
src/inngest/functions/issues-sweep.tsconcurrency: { key: 'issues-sweep', limit: 1 }prevents overlapping runs.MAX_INSTALLS_PER_SWEEP = 50,MAX_REPOS_PER_INSTALL = 20,MAX_ISSUES_PER_INSTALL = 100,MAX_ISSUES_PER_SWEEP = 1000.getSyncCursor/setSyncCursor/clearSyncCursor) so a large repo is walked one page per sweep and resumes where it left off; the cursor is cleared once caught up.scored_atcooldown: issues attempted within the last day are skipped rather than re-scored.seenTargets) so a fork whose upstream was already swept this run is skipped.step.run(a failure retries only that repo), and the rate budget is re-checked per repo so a limited install stops mid-loop.Impact
GitHub API and LLM spend per sweep is strictly bounded, large repos are swept incrementally, and failed repos retry without redoing the whole sweep.
Closes #860