Repository navigation
fix(forgejo): share complete Gitea PR scans across branches - #25569
maria-rcks wants to merge 2 commits into
Conversation
Co-authored-by: Tin Zeljar <35663757+Zheruel@users.noreply.github.com>
ApprovabilityVerdict: Approved at Macroscope's review found this PR approvable — This is a contained Forgejo/Gitea PR-discovery fix that shares complete repository scans for background lookups while preserving filtering and explicit refresh semantics. The production logic is narrowly scoped and accompanied by extensive regression coverage for pagination, cache expiry, failures, identity filtering, and concurrency. No code changes detected at You can add or adjust custom eligibility rules. Learn more. |
Thread transfer impact✅ Thread transfer remains within every enforced ceiling.
Baseline: Scenario and decoded snapshot size10 historical turns, 5 command tools per turn, 878.9 KiB retained MCP result per historical turn, and a 1.05 MiB retained result in the measured turn.
Updated in place by a trusted workflow. PR artifacts are strictly validated and never executed. |
|
Important Review skippedReview was skipped as selected files did not have any reviewable changes.
|
| Layer / File(s) | Summary |
|---|---|
Forgejo scan cache and filtering packages/source-control-core/src/server/SourceControlProvider.ts, packages/source-control-forgejo/src/server/ForgejoSourceControlProvider.ts, packages/source-control-forgejo/src/server/ForgejoSourceControlProvider.test.ts |
The provider caches successful complete scans for one minute, keyed by CLI command, server URL, login, and repository. It filters results by branch, optional source repository and owner, and requested state. Tests cover pagination, cache reuse and expiry, identity isolation, uncached reads, scan failures, and in-flight lookups. |
GitManager cache controls and lookup tests apps/server/src/git/GitManager.ts, apps/server/src/git/GitManager.test.ts |
GitManager passes cache preferences to provider lookups. Missing-PR and explicit refresh lookups disable provider caching. The Gitea-backed test checks paginated branch lookups and refresh results. |
Priority:
Estimated code review effort: 3 (Moderate) | ~25 minutes
Change: Bug fix
Sequence Diagram(s)
sequenceDiagram
participant GitManager
participant ForgejoSourceControlProvider
participant RepositoryPullsCache
participant ForgejoPullListAPI
GitManager->>ForgejoSourceControlProvider: listChangeRequests with allowCached
ForgejoSourceControlProvider->>RepositoryPullsCache: Look up repository scan
RepositoryPullsCache-->>ForgejoSourceControlProvider: Return cached scan when available
ForgejoSourceControlProvider->>ForgejoPullListAPI: Fetch pull requests in pages on cache miss
ForgejoPullListAPI-->>ForgejoSourceControlProvider: Return paginated pull requests
ForgejoSourceControlProvider-->>GitManager: Return filtered pull requests
Possibly related issues
- pingdotgg/t3code, issue 23551: This change detects ignored
headfilters by using a complete paginated scan and filtering the results by branch and source.
Suggested reviewers: juliusmarminge
Merge Risk: 
Minimal · previous review 80fc4
-
No confirmed issue prevents merging after normal checks.
Pre-merge checks: 
4
-
Full details: Description check
-
Explanation
The pull request description includes the required Problem, Change, Scope and approval, and Verification sections. It explains the issue, implementation, scope, approval context, test results, limitations, and agent usage. The approval reference is described through the linked takeover request and maintainer direction.
-
Finishing Touches: 💡 1
-
📝 Generate docstrings
-
- Commit to this branch
- Create a new PR
🧪 Generate unit tests (beta)
-
- Commit to this branch
- Create a new PR
🛠️ Fix failing CI checks: 💡
-
- Commit to this branch
- Create a new PR
-
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Comment @coderabbitai help to get the list of available commands.
|
Note Written by Verified in a real dev environmentverified unchanged head ran used real gitea 1.25.2, tea 0.16.0, and a disposable repository with 55 actual prs. gitea ignored the head filter. pr
short transcript summarized from the real gitea access log, inspected with inspected captures and verified uploaded video playback and seeking in t3 preview. this changes server behavior, so no visual before/after comparison applies. blacksmith: Not verifiednative ios/android and electron clients, macos/windows/wsl, installed |


Problem
Gitea ignores the
headfilter, so background branch PR discovery repeatedly scans the entire repository. Branch and worktree lookups cannot currently share those results.Change
Reuse successful complete scans for one minute, keyed by resolved server, account, CLI, and repository. Detect ignored head filters before taking this path; Forgejo's filtered queries stay unchanged. Preserve source identity, arbitrary bases, and open/closed/merged selection. Explicit refreshes, identity changes, and creation checks bypass cached scans. Failed and partial scans are never reused.
Retains the original implementation and regression coverage. The pagination fixture uses 75 PRs instead of 3,089 while still checking a match beyond page one. No production behavior was dropped or moved.
Verification
Readiness pass at
c02dc64347a0c9a10f054e31936ac4a3ccd57791:github/main(becf853defb6) cleanly with a merge commit. This includes main's removal of the inherited unused mobile import; no task source edits were necessary. The PR remains five files, +482/-11 against main.vp run check:changed becf853defb6127dbe4447860383777d69346b6f: passed formatting, lint, both knip checks, generated GraphQL, 18 affected package typechecks, and all 143 tests in three existing files.vp run lint: passed all 5,815 files, zero errors or warnings.Original takeover verification:
github/main(210b2e7c6a8b): six page requests instead of four.vp run check:changedthrough Blacksmith: passed format, lint, both knip checks, generated GraphQL, 17 affected package typechecks, and 143 tests across three existing files.80fc4ce670043ce78ff4cde824c284d78076d422with no findings.fj, WSL, and production forge credentials. Cold/expired lookups still scan the repository; background reads can add one minute of snapshot staleness to the existing branch cache.No UI changes or image evidence apply.
Scope and approval
Maria requested this maintainer takeover of https://git.cafe/pingdotgg/t3code/pulls/24853 and this readiness pass. It remains a focused fix for repeated Gitea branch-discovery scans, limited to the original five files. No UI or unrelated behavior changes.
Takeover
Replaces https://git.cafe/pingdotgg/t3code/pulls/24853, with thanks to @Zheruel for the original implementation.
Built with GPT-6.1-Sol in the Codex harness on T3 Code.