Repository navigation
Conversation
… request Forgejo cannot filter pulls by head branch, so a branch without a PR scanned the whole repository on every status refresh. Search only the two most recently updated pages. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
ApprovabilityVerdict: Approved at Macroscope's review found this PR approvable — This is a focused Forgejo performance fix that bounds branch-status lookups to two pages and includes a regression test, with no broader API or infrastructure impact. Very old pull requests may no longer appear in branch status, but that tradeoff is explicit and contained. You can add or adjust custom eligibility rules. Learn more. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configuration
📒 Files selected for processing (2)
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review. 📝 WalkthroughWalkthroughForgejo pull-request listing now searches at most two pages when matching a requested head branch. A provider test checks that the search stops after two API requests when the requested branch has no matching pull requests. ChangesForgejo pull-request lookup
Priority: ➖ Normal Estimated code review effort: 2 (Simple) | ~10 minutes Change: Bug fix Merge Risk: ⚪ Minimal · up to The change bounds Forgejo branch-status lookups to the 100 most recently updated pull requests. Older pull requests may no longer appear as branch badges, which the PR states as intended. No merge-blocking risk was identified. Security Architecture ReviewSecurity architecture risk: 🔵 Low · up to The change limits slow Forgejo searches, but an older pull request may disappear from branch status and trigger an unnecessary creation attempt. Repository access still follows the existing Forgejo path; duplicate-request handling by the deployed server has not been verified. Retained concerns
Security review detailsSecurity Blast Radius
Security Findings and Attack Paths
Trust Boundaries and Controls
Resilience and Maintainability Implications
Hardening Proposals
🚥 Pre-merge checks | ✅ 4✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
|
Note Grok responding on behalf of Julius. Thanks for digging into this and for the measurements. The same unbounded Forgejo pull request scan in |
Problem
On a Forgejo repository with many pull requests, branch status refreshes take minutes and the "Some requests are slow" toast for
vcs.refreshStatusstays up permanently.The Forgejo pulls API has no head-branch filter, so
ForgejoSourceControlProvider.listChangeRequestspages through/pulls?state=alluntil it findslimit(20) matches or reaches the end. A branch has at most a few PRs, so a branch without a PR always reaches the end and requests every page. On a self-hosted Forgejo 15 server with 535 PRs, each 50-item page takes 13–17 s, and about half hit the 30 s timeout. The PR lookup takes 2–6 minutes per refresh and repeats when the 5-minute "no PR" cache expires.Change
Cap the head-branch scan at the two most recently updated pages (100 PRs). The list is already sorted by
recentupdate, so a branch that is being worked on finds its PR there. A PR on an old branch that is outside the 100 most recently updated is no longer shown as a badge. This affects bothfindLatestPrForHeadContext(state: "all") andfindOpenPr(state: "open"). If an open PR is missed, Forgejo still rejects a duplicate PR on creation.Scope and approval
This is a very small, focused fix for an obvious bug: an unbounded scan over every PR in the repository on each branch status refresh. It changes one loop bound in the Forgejo adapter and does not affect other providers, which filter by head branch on the server.
Verification
ForgejoSourceControlProvider.test.ts, which mocks a repository with five full pages and no matching PR. Without the fix, the lookup makes 6 API requests. With the fix, it makes 2.vp test run src/sourceControl/ForgejoSourceControlProvider.test.tspasses.vpr typecheckinapps/serverreports no errors.vp fmt --checkandvp lintpass on the changed files.GET /pulls?state=all&sort=recentupdate&limit=50takes about 15 s per page withX-Total-Count: 535. The server traces showedfindLatestPrForHeadContextat up to 217 s before the fix. I did not run a patched desktop build against that server.Written with Claude Opus 5.5 in Claude Code (running inside T3 Code).
🤖 Generated with Claude Code