Skip to content

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

Description

@github-actions

Selected checkpoint

Failing GitHub Actions workflow run (highest-priority candidate per the
selection policy: recent failing workflow on main).

Root cause

.github/workflows/branch-cleanup.yml's workflow_dispatch input exposes
options: [safe, stale, review], and the branch-cleanup skill's verdict rule
(.claude/skills/branch-cleanup/SKILL.md) defines a CLOSE-STALE verdict.
But scripts/maintenance/branch-cleanup-delete.sh's case statement only
implemented safe|review. Selecting stale — exactly what run 34392035516
did — always falls through to the *) branch, prints
usage: ... {safe|review}, and exits 2, failing the job.

Fix

Added a documented (currently empty) STALE_BRANCHES array and a stale)
case that safely no-ops when there are no CLOSE-STALE branches in the
current docs/branch-cleanup-matrix.csv audit, instead of erroring. This
matches existing SAFE_BRANCHES/REVIEW_BRANCHES wiring, so a future audit
that populates CLOSE-STALE verdicts only needs to fill in the array — the
dispatch path already works.

Canonical mapping

  • Issue: none found (searched gh api search/issues for
    branch-cleanup-delete.sh + stale; no open issue or PR duplicates this).
  • PR: this PR
  • Branch: fix/branch-cleanup-stale-batch

Verification (current head)

bash -n scripts/maintenance/branch-cleanup-delete.sh                     # syntax OK
DRY_RUN=1 scripts/maintenance/branch-cleanup-delete.sh stale             # "no CLOSE-STALE branches..." exit 0
scripts/maintenance/branch-cleanup-delete.sh bogus                       # usage error, exit 2 (unchanged)
shellcheck scripts/maintenance/branch-cleanup-delete.sh                  # clean, exit 0
python3 -m pytest tests/unit/test_gh_aw_workflow_governance.py -q --no-cov  # 11 passed

Evidence chart

Failing/actionable-run signal for the audit window, with the selected
checkpoint highlighted:

chart

Recommended pattern: Autoloop

This checkpoint was a small, bounded, single-file CI script bug surfaced by
one scheduled/dispatched Actions workflow. The fix cycle was
detect-failure → patch → verify → land, with no multi-agent coordination,
no natural-language Actions authoring, and no need for a
collaboration-platform continuous-AI narrative. Autoloop — simple,
goal-driven iterative automation — is the best fit for EventRelay on this
class of problem right now; Chopin (real-time multiplayer agentic
planning) and Agentic Workflows (NL-programmed Actions) would be
over-engineering for a one-line dispatch-argument bug, and Continuous AI
doesn't apply since there's no cross-repo/platform collaboration surface
involved.

Cache-memory written

  • status.json — selected checkpoint, root cause, verification commands,
    accepted=true, recommended_pattern=Autoloop
  • history.jsonl — one line recording this run's action and result
  • lessons.md — root cause detail, why no existing issue/PR duplicated this,
    and what to carry forward if a future branch audit populates CLOSE-STALE

Note

This was originally intended as a pull request, but the git push operation failed.

Original error: ERR_SYSTEM: pushSignedCommits: failed to rebase commit range onto current GraphQL parent (c965b8b). Resolve conflicts by rebasing/cherry-picking locally and retry. Root cause: Auto-merging apps/web/src/components/OneLoopStudio.tsx CONFLICT (content): Merge conflict in apps/web/src/components/OneLoopStudio.tsx Auto-merging apps/web/src/lib/tests/studio-pipeline-status.test.ts CONFLICT (content): Merge conflict in apps/web/src/lib/tests/studio-pipeline-status.test.ts Auto-merging apps/web/src/lib/studio-pipeline-status.ts Rebasing (1/19) error: could not apply ed93de5... fix(web): Studio workbench when pack events[] is empty (#1692) hint: Resolve all conflicts manually, mark them as resolved with hint: "git add/rm (conflicted_files)", then run "git rebase --continue". hint: You can instead skip this commit: run "git rebase --skip". hint: To abort and get back to the state before "git rebase", run "git rebase --abort". hint: Disable this message with "git config set advice.mergeConflict false" Could not apply ed93de5... # fix(web): Studio workbench when pack events[] is empty (#1692)

Workflow Run: View run details and download bundle artifact

The bundle file is available in the agent artifact in the workflow run linked above.

Create the pull request manually
# Download the artifact from the workflow run
gh run download '34389712159' -n agent -D '/tmp/agent-34389712159'

# Resolve the bundle source ref, fetch it into a temporary ref, then create the local branch
bundle_path='/tmp/agent-34389712159/aw-fix-branch-cleanup-stale-batch.bundle'
temp_ref='refs/bundles/create-pr-pr-iteration-fix-branch-cleanup-stale-batch-693d66de'
target_ref='refs/heads/pr-iteration/fix/branch-cleanup-stale-batch'
bundle_source_ref=$(git bundle list-heads "$bundle_path" | awk '$2 ~ /^refs\/heads\// { print $2 }')
if [ -z "$bundle_source_ref" ]; then
  bundle_source_ref=$(git bundle list-heads "$bundle_path" | awk '$2 == "HEAD" { print $2 }')
fi
if [ "$(printf '%s\n' "$bundle_source_ref" | sed '/^$/d' | wc -l | tr -d ' ')" != "1" ]; then
  echo "Expected exactly one bundle source ref, found: $bundle_source_ref" >&2
  exit 1
fi
git fetch "$bundle_path" "${bundle_source_ref}:${temp_ref}"
git update-ref "$target_ref" "$temp_ref"
git checkout 'pr-iteration/fix/branch-cleanup-stale-batch'
# Ensure the working tree matches the updated branch
git reset --hard
# Remove the temporary bundle ref
git update-ref -d "$temp_ref"

# Push the branch to the target remote
git push 'origin' 'pr-iteration/fix/branch-cleanup-stale-batch'

# Create the pull request
gh pr create --title '[ai] fix(ci): support stale batch in branch-cleanup-delete.sh' --base 'main' --head 'pr-iteration/fix/branch-cleanup-stale-batch' --repo 'groupthinking/EventRelay'

Generated by pr-iteration-loop for #1684 · copilot · auto · 163 AIC · ⌖ 11.3 AIC · ⊞ 12.1K ·

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

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions