fix: close stale PRs on Forgejo when pipeline DB marks them closed
Some checks are pending
CI / lint-and-test (push) Waiting to run

Two code paths set status='closed' in the pipeline DB without calling
the Forgejo API to close the PR. This caused 50 ghost PRs to accumulate
on Forgejo (dashboard shows review backlog) while the pipeline considered
them done.

- evaluate.py: no-diff stale branch close now calls Forgejo PATCH
- merge.py: permanent conflict close now calls Forgejo PATCH

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
m3taversal 2026-04-15 17:15:58 +01:00
parent 0d3fe95522
commit e0c9951308
2 changed files with 2 additions and 0 deletions

View file

@ -533,6 +533,7 @@ async def evaluate_pr(conn, pr_number: int, tier: str = None) -> dict:
diff = await get_pr_diff(pr_number)
if not diff:
# Close PRs with no diff — stale branch, nothing to evaluate
await forgejo_api("PATCH", repo_path(f"pulls/{pr_number}"), {"state": "closed"})
conn.execute("UPDATE prs SET status='closed', last_error='closed: no diff against main (stale branch)' WHERE number = ?", (pr_number,))
return {"pr": pr_number, "skipped": True, "reason": "no_diff_closed"}

View file

@ -1771,6 +1771,7 @@ async def _handle_permanent_conflicts(conn) -> int:
except Exception:
pass
await forgejo_api("PATCH", repo_path(f"pulls/{pr_number}"), {"state": "closed"})
conn.execute(
"UPDATE prs SET status = 'closed', last_error = 'conflict_permanent: closed + filed in archive' WHERE number = ?",
(pr_number,),