Skip to content

[ai] fix(ci): support stale batch in branch-cleanup-delete.sh - #1840

Draft
github-actions[bot] wants to merge 5 commits into
mainfrom
pr-iteration/fix/branch-cleanup-stale-batch-support
Draft

[ai] fix(ci): support stale batch in branch-cleanup-delete.sh#1840
github-actions[bot] wants to merge 5 commits into
mainfrom
pr-iteration/fix/branch-cleanup-stale-batch-support

Conversation

@github-actions

@github-actions github-actions Bot commented Sep 9, 2026

Copy link
Copy Markdown

Canonical issue

Fixes #aw_bcstale

Problem

.github/workflows/branch-cleanup.yml exposes a stale batch option (both
via workflow_dispatch and the [run-cleanup:stale] sentinel-commit path),
but scripts/maintenance/branch-cleanup-delete.sh only implemented
safe|review and fell through to usage: ... {safe|review} with exit 2
for stale. Every historical run selecting the stale batch has failed with
this exact signature since at least 2026-08-07 (15+ occurrences), most
recently https://github.com/groupthinking/EventRelay/actions/runs/34392035516
on 2026-09-09.

Fix

  • Add a STALE_BRANCHES array (empty today — docs/branch-cleanup-matrix.csv
    has no CLOSE-STALE verdict rows yet) and a stale) case in
    scripts/maintenance/branch-cleanup-delete.sh.
  • Update the usage string and header comment to document the new option.
  • No branches are deleted by this change; the stale batch now runs as a
    documented no-op instead of erroring, matching the workflow's existing
    safe/review behavior pattern.

Verification

  • bash -n scripts/maintenance/branch-cleanup-delete.sh — syntax check passes.
  • DRY_RUN=1 scripts/maintenance/branch-cleanup-delete.sh stale — exits 0
    (previously exited 2 with the usage error).
  • scripts/maintenance/branch-cleanup-delete.sh bogus — still correctly
    rejects unknown batches with exit 2 and the updated usage string.
  • DRY_RUN=1 scripts/maintenance/branch-cleanup-delete.sh safe — unchanged
    behavior confirmed (still lists CLOSE-SAFE branches).
  • git diff origin/main -- scripts/maintenance/branch-cleanup-delete.sh
    confirms the change is an 11-line, single-file, additive diff.

Evidence

Branch Cleanup stale-batch failure frequency

15+ failed Branch Cleanup runs over 5 weeks share this identical exit-code-2
signature (gh run list --workflow "Branch Cleanup" --status failure).

Risk

  • Risk level: low
  • Failure mode: none introduced — STALE_BRANCHES is empty, so stale is a
    guaranteed no-op until a future branch audit populates it.
  • Rollback: revert this commit; the workflow will resume failing on stale
    batch selection as before (not a regression from current main).

Research pattern recommendation

Agentic Workflows best fits this checkpoint: the failure is a scheduled/
dispatch-triggered GitHub Actions script bug, discoverable and fixable purely
through natural-language-programmed CI automation (this very pr-iteration-loop
workflow) without needing real-time multiplayer planning (Chopin), generic
platform-embedded LLM automation (Continuous AI), or open-ended autonomous
goal-seeking (Autoloop). The fix is small, verifiable by direct script
execution, and the evidence trail (workflow run history) is exactly the kind
of structured signal agentic workflows are built to consume and act on.

Generated by pr-iteration-loop for #1778 · copilot · auto · 98.5 AIC · ⌖ 20.8 AIC · ⊞ 12.1K ·

  • expires on Sep 16, 2026, 7:07 PM UTC

github-actions Bot and others added 4 commits September 9, 2026 19:07
Co-authored-by: groupthinking <154503486+groupthinking@users.noreply.github.com>
Co-authored-by: groupthinking <154503486+groupthinking@users.noreply.github.com>
The Branch Cleanup workflow lets a workflow_dispatch or sentinel commit
select batch=stale, but branch-cleanup-delete.sh only recognized
safe|review and exited 2 for any other argument, failing the run.

Add a STALE_BRANCHES case (currently empty, since no branch in
docs/branch-cleanup-matrix.csv carries the CLOSE-STALE verdict yet) so
the stale batch runs as a no-op instead of erroring out.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@vercel

vercel Bot commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
v0-uvai Ready Ready Preview, v0 Sep 9, 2026 7:38pm UTC

Locks in the stale-batch fix on this branch with automated pytest
coverage instead of only manual DRY_RUN verification. Confirmed the
new tests fail against main's unfixed script (2/7 failures reproducing
the original usage/exit-2 bug) and pass against this branch's fix (7/7).

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@github-actions

github-actions Bot commented Sep 9, 2026

Copy link
Copy Markdown
Author

Commit pushed: b075a4a

Generated by pr-iteration-loop · copilot · auto · 178.1 AIC · ⌖ 11.9 AIC · ⊞ 12.1K

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants