From 684d8bb908533b27049ce2e97bc58be9502d8598 Mon Sep 17 00:00:00 2001 From: mateo-berri <277851410+mateo-berri@users.noreply.github.com> Date: Tue, 19 May 2026 07:05:44 +0000 Subject: [PATCH] =?UTF-8?q?fix(triage):=20greptile=20=E2=80=94=20share=20a?= =?UTF-8?q?uto-close=20marker=20+=20gate=20reconsider=20job=20on=20closed?= =?UTF-8?q?=20state?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Address the two remaining concerns from Greptile's summary: 1. close_low_quality_prs.py duplicated the 'I'm **Agent Shin**' literal from triage_with_llm.AGENT_SHIN_AUTO_CLOSE_MARKER. The reconsider provenance check keys off that exact phrase, so silently drifting the two strings would break reconsider for Greptile-closed PRs without any test catching it. Import the marker from the sibling module instead. 2. triage_reconsider.yml fired on any '@agent-shin reconsider' comment regardless of whether the PR/issue was open or closed. Gating the job on github.event.issue.state == 'closed' skips runner provisioning for stray comments on open items; the triage script still re-checks state (skip-not-closed) as defense in depth. --- .github/scripts/close_low_quality_prs.py | 13 ++++++++++++- .github/workflows/triage_reconsider.yml | 7 +++++++ 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/.github/scripts/close_low_quality_prs.py b/.github/scripts/close_low_quality_prs.py index a05636d5376..66c6d03a467 100644 --- a/.github/scripts/close_low_quality_prs.py +++ b/.github/scripts/close_low_quality_prs.py @@ -41,8 +41,19 @@ import json import re import subprocess import sys +from pathlib import Path from typing import Iterable +# Share the auto-close marker with the sibling Agent Shin script instead of +# duplicating the literal — the reconsider provenance check +# (`was_auto_closed_by_agent_shin`) keys off this exact phrase, so a drift +# between the two files would silently break reconsider for Greptile-closed +# PRs without any test catching it. +_SCRIPTS_DIR = Path(__file__).resolve().parent +if str(_SCRIPTS_DIR) not in sys.path: + sys.path.insert(0, str(_SCRIPTS_DIR)) +from triage_with_llm import AGENT_SHIN_AUTO_CLOSE_MARKER # noqa: E402 + # Greptile's GitHub App appears as `greptile-apps[bot]` in REST API comments # and `greptile-apps` in `gh pr view --json` output. Accept either form. GREPTILE_BOT_LOGINS = frozenset({"greptile-apps", "greptile-apps[bot]"}) @@ -245,7 +256,7 @@ def close_pr( return comment_body = ( - "👋 Hi, thanks for the PR! I'm **Agent Shin**, the automated triage " + f"👋 Hi, thanks for the PR! {AGENT_SHIN_AUTO_CLOSE_MARKER}, the automated triage " "bot for this repository. Closing as part of automated PR triage.\n\n" f"Greptile's most recent review scored this PR **{score}/5**, below " f"our merge bar of **{threshold}/5**.\n\n" diff --git a/.github/workflows/triage_reconsider.yml b/.github/workflows/triage_reconsider.yml index 69ba73d224d..7d2ed01eb41 100644 --- a/.github/workflows/triage_reconsider.yml +++ b/.github/workflows/triage_reconsider.yml @@ -32,9 +32,16 @@ permissions: jobs: reconsider: + # Reconsider only makes sense on a CLOSED PR/issue — its job is to + # re-evaluate and (on pass) reopen. Gating the job here means a + # stray `@agent-shin reconsider` on an open PR/issue exits before + # checkout/Python/pip ever runs, instead of spinning up the runner + # to be a no-op. The triage script itself still re-checks state + # (`skip-not-closed`) as defense in depth. if: | github.repository == 'BerriAI/litellm' && contains(github.event.comment.body, '@agent-shin reconsider') + && github.event.issue.state == 'closed' runs-on: ubuntu-latest steps: - name: Authorize commenter