From 4961bf4eaf67581554b29f9560f786acfd738279 Mon Sep 17 00:00:00 2001 From: Cursor Agent Date: Sun, 17 May 2026 16:37:04 +0000 Subject: [PATCH] fix(workflows): scheduled cron closes PRs; safe --close strip in triage Co-authored-by: Yassin Kortam --- .github/workflows/close_low_quality_prs.yml | 9 +++++---- .github/workflows/triage_issue_with_llm.yml | 10 +++++++++- .github/workflows/triage_pr_with_llm.yml | 12 ++++++++++-- 3 files changed, 24 insertions(+), 7 deletions(-) diff --git a/.github/workflows/close_low_quality_prs.yml b/.github/workflows/close_low_quality_prs.yml index 4271adca184..57f74399cc1 100644 --- a/.github/workflows/close_low_quality_prs.yml +++ b/.github/workflows/close_low_quality_prs.yml @@ -62,9 +62,10 @@ jobs: - name: Run low-quality PR closer env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - # Default to dry-run for scheduled triggers as well. The repo - # variable AGENT_SHIN_ENABLED must be "true" before scheduled runs - # actually close PRs, AND workflow_dispatch must opt-in via close=true. + # 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. CLOSE_FLAG: ${{ github.event.inputs.close || 'false' }} AGENT_SHIN_ENABLED: ${{ vars.AGENT_SHIN_ENABLED }} MIN_AGE_DAYS: ${{ github.event.inputs.min_age_days || '7' }} @@ -80,7 +81,7 @@ jobs: ) if [ "${AGENT_SHIN_ENABLED:-false}" != "true" ]; then echo "::notice::AGENT_SHIN_ENABLED is not 'true' -> forcing dry-run regardless of close input." - elif [ "${CLOSE_FLAG}" = "true" ]; then + elif [ "${GITHUB_EVENT_NAME:-}" = "schedule" ] || [ "${CLOSE_FLAG}" = "true" ]; then ARGS+=(--close) echo "::notice::Running in close-on-fail mode." else diff --git a/.github/workflows/triage_issue_with_llm.yml b/.github/workflows/triage_issue_with_llm.yml index c9ddad5d3ea..1aab2cfd533 100644 --- a/.github/workflows/triage_issue_with_llm.yml +++ b/.github/workflows/triage_issue_with_llm.yml @@ -69,7 +69,15 @@ jobs: # Automatic `issues` events stay dry-run regardless until the team # explicitly invokes workflow_dispatch with close=true. if [ "${GITHUB_EVENT_NAME:-}" = "issues" ]; then - ARGS=("${ARGS[@]/--close/}") + # filter out --close rather than substituting to "" (which would + # leave an empty positional arg that argparse rejects) + FILTERED=() + for arg in "${ARGS[@]}"; do + if [ "${arg}" != "--close" ]; then + FILTERED+=("${arg}") + fi + done + ARGS=("${FILTERED[@]}") echo "::notice::issues trigger -> forcing dry-run." fi python3 .github/scripts/triage_with_llm.py "${ARGS[@]}" diff --git a/.github/workflows/triage_pr_with_llm.yml b/.github/workflows/triage_pr_with_llm.yml index f9b6d7fed47..58d2aaee66c 100644 --- a/.github/workflows/triage_pr_with_llm.yml +++ b/.github/workflows/triage_pr_with_llm.yml @@ -82,8 +82,16 @@ jobs: # summary before any contributor sees a comment. Only the manual # workflow_dispatch path (with close=true) closes PRs. if [ "${GITHUB_EVENT_NAME:-}" = "pull_request_target" ]; then - # strip any --close added above - ARGS=("${ARGS[@]/--close/}") + # strip any --close added above (filter out, don't substitute + # to empty string — that would leave a stray "" positional arg + # that argparse rejects) + FILTERED=() + for arg in "${ARGS[@]}"; do + if [ "${arg}" != "--close" ]; then + FILTERED+=("${arg}") + fi + done + ARGS=("${FILTERED[@]}") echo "::notice::pull_request_target trigger -> forcing dry-run." fi python3 .github/scripts/triage_with_llm.py "${ARGS[@]}"