mirror of
https://github.com/BerriAI/litellm.git
synced 2026-09-14 23:21:35 +00:00
fix(triage): scheduled cron stays dry-run; dedent prompts before interpolation
- close_low_quality_prs.yml: only workflow_dispatch with close=true (and AGENT_SHIN_ENABLED=true) actually closes PRs. Scheduled runs are always dry-run, matching the safety invariant documented for triage_pr/issue. - triage_with_llm.py: textwrap.dedent on an f-string with multi-line interpolated bodies fails because the body's 2nd+ lines start at column 0, making the common-indent zero. Dedent the static template first, then .format() the title/body in. Co-authored-by: Yassin Kortam <yassin@berri.ai>
This commit is contained in:
parent
4961bf4eaf
commit
401433374d
2 changed files with 18 additions and 10 deletions
16
.github/scripts/triage_with_llm.py
vendored
16
.github/scripts/triage_with_llm.py
vendored
|
|
@ -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)
|
||||
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
|
|
|
|||
12
.github/workflows/close_low_quality_prs.yml
vendored
12
.github/workflows/close_low_quality_prs.yml
vendored
|
|
@ -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[@]}"
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue