From edddf0c1796d7955f7ce3bfdaa788196a5c08d86 Mon Sep 17 00:00:00 2001 From: Cursor Agent Date: Sun, 17 May 2026 17:04:07 +0000 Subject: [PATCH] Fix bugs in auto-close PR triage scripts - close_low_quality_prs.py: Treat author_association API lookup failures as internal (fail-safe) so transient errors don't cause internal contributors' PRs to be auto-closed. - triage_with_llm.py: Update summary heading from 'Would post comment:' to 'Posted comment:' since this branch only runs after the comment has already been posted. Co-authored-by: Yassin Kortam --- .github/scripts/close_low_quality_prs.py | 5 ++++- .github/scripts/triage_with_llm.py | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/.github/scripts/close_low_quality_prs.py b/.github/scripts/close_low_quality_prs.py index 6338ad380ce..95335aec167 100644 --- a/.github/scripts/close_low_quality_prs.py +++ b/.github/scripts/close_low_quality_prs.py @@ -116,7 +116,10 @@ def is_external_pr_author(pr: dict, repo: str | None) -> bool: if login.endswith("[bot]") or login in {"dependabot", "github-actions"}: return False association = fetch_pr_author_association(pr["number"], repo) - if association in INTERNAL_AUTHOR_ASSOCIATIONS: + # Fail-safe: if the API lookup failed (empty string), treat the author as + # internal so we don't auto-close their PR. Auto-close is destructive, so + # an unknown association should never make a PR eligible for closing. + if not association or association in INTERNAL_AUTHOR_ASSOCIATIONS: return False return True diff --git a/.github/scripts/triage_with_llm.py b/.github/scripts/triage_with_llm.py index 3062770dbe9..1c6c87aeb0b 100644 --- a/.github/scripts/triage_with_llm.py +++ b/.github/scripts/triage_with_llm.py @@ -520,7 +520,7 @@ def render_summary(result: dict) -> str: comment = result.get("comment") if comment: lines.append("") - lines.append("### Would post comment:") + lines.append("### Posted comment:") lines.append("") lines.append("> " + comment.replace("\n", "\n> ")) return "\n".join(lines)