fix: skip grace-period text in close comment for IMMEDIATE_CLOSE_LOGINS

For PRs from IMMEDIATE_CLOSE_LOGINS (e.g. swiftwinds), evaluate_pr
returns 'close' immediately without ever posting a grace warning, so
the close comment should not reference a 1-day grace period.

Make close_pr take a grace_period_elapsed flag, default True, and
pass False from the main loop when the close path was the
immediate-close branch.

Co-authored-by: Yassin Kortam <yassin@berri.ai>
This commit is contained in:
Cursor Agent 2026-05-19 07:46:38 +00:00
parent f876173b78
commit e0eeb73554
No known key found for this signature in database

View file

@ -350,6 +350,7 @@ def close_pr(
repo: str | None,
dry_run: bool,
label: str | None,
grace_period_elapsed: bool = True,
) -> None:
"""Post the explanatory comment and close the PR."""
pr_number = pr["number"]
@ -362,11 +363,19 @@ def close_pr(
)
return
comment_body = (
f"Closing as part of automated PR triage.\n\n"
score_sentence = (
f"Greptile's most recent review scored this PR **{score}/5**, below "
f"our merge bar of **{threshold}/5**, and the 1-day grace period since "
"the warning has elapsed.\n\n"
if grace_period_elapsed
else (
f"Greptile's most recent review scored this PR **{score}/5**, "
f"below our merge bar of **{threshold}/5**.\n\n"
)
)
comment_body = (
f"Closing as part of automated PR triage.\n\n"
f"{score_sentence}"
"We close low-confidence PRs aggressively to keep the review queue "
"manageable for maintainers and contributors alike. **This is not a "
"rejection of the idea** — to bring this back:\n\n"
@ -602,6 +611,7 @@ def main() -> int:
repo=args.repo,
dry_run=pr_dry_run,
label=args.close_label,
grace_period_elapsed=not is_immediate,
)
if not pr_dry_run: