Skip to content

[ai] fix(ci): drop dead 'stale' batch option from Branch Cleanup workflow #1837

Description

@github-actions

Caution

Protected files were modified in this change.
This pull request is in request_review mode and requires explicit human scrutiny before merge.

Protected files: .github/workflows/branch-cleanup.yml

Fix: drop dead stale batch option from Branch Cleanup workflow

Problem

.github/workflows/branch-cleanup.yml advertised a stale batch in the
workflow_dispatch.inputs.batch choice list and the push-sentinel regex
([run-cleanup:safe|stale|review]), but scripts/maintenance/branch-cleanup-delete.sh
only implements safe and review. The STALE_BRANCHES case was
intentionally removed after the 30 CLOSE-STALE branches were archived and
deleted on 2026-06-02 (see docs/branch-cleanup-followups.md), but the
workflow wasn't updated to match.

Confirmed failure — run 34392035516 (Branch Cleanup, dry_run=1, batch=stale):

usage: scripts/maintenance/branch-cleanup-delete.sh {safe|review}   (prefix DRY_RUN=1 to preview)
##[error]Process completed with exit code 2.

Any dispatch or sentinel push using stale fails immediately, even in
dry-run/preview mode.

Fix

Removed stale from all 4 places it appeared in the workflow file: the
doc comment, the workflow_dispatch choice list, and both places in the
push-sentinel regex. No script changes were needed — safe/review
already work correctly.

Verification

grep -n stale .github/workflows/branch-cleanup.yml   # no matches
python3 -c "import yaml; yaml.safe_load(open('.github/workflows/branch-cleanup.yml'))"  # YAML OK
DRY_RUN=1 bash scripts/maintenance/branch-cleanup-delete.sh safe    # exit 0
DRY_RUN=1 bash scripts/maintenance/branch-cleanup-delete.sh review  # exit 0

Evidence chart

Branch Cleanup failure signal

Closes the workflow-drift bug described in the linked issue.


Opened by the PR Iteration Loop. Recommended pattern for this class of fix: Continuous AI — a small, LLM-driven pass that watches live workflow run signals and closes drift between a workflow's advertised options and its script's actual implementation, without needing a new automation program (Agentic Workflows), a live multiplayer session (Chopin), or an unsupervised iterate-to-goal loop (Autoloop).


Note

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

Original error: The process '/usr/bin/git' failed with exit code 1

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 '34390299480' -n agent -D '/tmp/agent-34390299480'

# Resolve the bundle source ref, fetch it into a temporary ref, then create the local branch
bundle_path='/tmp/agent-34390299480/aw-fix-branch-cleanup-drop-stale-batch.bundle'
temp_ref='refs/bundles/create-pr-pr-iteration-fix-branch-cleanup-drop-stale-batch-b7bc2a5a'
target_ref='refs/heads/pr-iteration/fix/branch-cleanup-drop-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-drop-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-drop-stale-batch'

# Create the pull request
gh pr create --title '[ai] fix(ci): drop dead '\''stale'\'' batch option from Branch Cleanup workflow' --base 'main' --head 'pr-iteration/fix/branch-cleanup-drop-stale-batch' --repo 'groupthinking/EventRelay'

Generated by pr-iteration-loop for #1827 · copilot · auto · 88.5 AIC · ⌖ 17.2 AIC · ⊞ 12.1K ·

  • expires on Sep 16, 2026, 7:05 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