diff --git a/.github/scripts/triage_with_llm.py b/.github/scripts/triage_with_llm.py index f8ca780ee4c..3062770dbe9 100644 --- a/.github/scripts/triage_with_llm.py +++ b/.github/scripts/triage_with_llm.py @@ -146,8 +146,11 @@ def has_linked_issue(text: str) -> bool: def build_pr_prompt(*, title: str, body: str) -> str: cleaned_body = strip_html_comments(body or "").strip() or "(empty)" - return textwrap.dedent( - f""" + # Dedent the static template *before* interpolating dynamic fields so that + # multi-line bodies (whose 2nd+ lines start at column 0) don't defeat the + # common-indent computation in textwrap.dedent. + template = textwrap.dedent( + """ You are "Agent Shin", the OSS triage bot for the LiteLLM open-source repository (BerriAI/litellm). Decide whether this external pull request meets the project's contribution standards. @@ -195,12 +198,16 @@ def build_pr_prompt(*, title: str, body: str) -> str: --- """ ).strip() + return template.format(title=title, cleaned_body=cleaned_body) def build_issue_prompt(*, title: str, body: str) -> str: cleaned_body = strip_html_comments(body or "").strip() or "(empty)" - return textwrap.dedent( - f""" + # Dedent the static template *before* interpolating dynamic fields so that + # multi-line bodies (whose 2nd+ lines start at column 0) don't defeat the + # common-indent computation in textwrap.dedent. + template = textwrap.dedent( + """ You are "Agent Shin", the OSS triage bot for the LiteLLM open-source repository (BerriAI/litellm). Decide whether this GitHub issue meets the project's reporting standards. @@ -245,6 +252,7 @@ def build_issue_prompt(*, title: str, body: str) -> str: --- """ ).strip() + return template.format(title=title, cleaned_body=cleaned_body) # --------------------------------------------------------------------------- diff --git a/.github/workflows/close_low_quality_prs.yml b/.github/workflows/close_low_quality_prs.yml index 57f74399cc1..d834cea0c82 100644 --- a/.github/workflows/close_low_quality_prs.yml +++ b/.github/workflows/close_low_quality_prs.yml @@ -62,10 +62,10 @@ jobs: - name: Run low-quality PR closer env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - # Scheduled runs honor AGENT_SHIN_ENABLED directly: when the repo - # variable is "true", the cron actually closes PRs. workflow_dispatch - # must additionally opt-in via close=true so manual previews stay - # dry-run by default. + # Scheduled runs are ALWAYS dry-run, even when AGENT_SHIN_ENABLED is + # "true", so the team can QA the closer's verdicts in step summaries + # before any contributor sees a PR closed. Real closures only happen + # on manual workflow_dispatch with close=true (and the variable set). CLOSE_FLAG: ${{ github.event.inputs.close || 'false' }} AGENT_SHIN_ENABLED: ${{ vars.AGENT_SHIN_ENABLED }} MIN_AGE_DAYS: ${{ github.event.inputs.min_age_days || '7' }} @@ -81,10 +81,10 @@ jobs: ) if [ "${AGENT_SHIN_ENABLED:-false}" != "true" ]; then echo "::notice::AGENT_SHIN_ENABLED is not 'true' -> forcing dry-run regardless of close input." - elif [ "${GITHUB_EVENT_NAME:-}" = "schedule" ] || [ "${CLOSE_FLAG}" = "true" ]; then + elif [ "${GITHUB_EVENT_NAME:-}" = "workflow_dispatch" ] && [ "${CLOSE_FLAG}" = "true" ]; then ARGS+=(--close) echo "::notice::Running in close-on-fail mode." else - echo "::notice::AGENT_SHIN_ENABLED is true but close=false -> dry-run." + echo "::notice::AGENT_SHIN_ENABLED is true but this trigger is dry-run (scheduled event or close=false)." fi python3 .github/scripts/close_low_quality_prs.py "${ARGS[@]}"