Skip to content

[ai] fix(ci): remove unimplemented stale batch from Branch Cleanup dispatch #1835

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

Canonical issue

Canonical issue: “Branch Cleanup workflow_dispatch batch=stale always fails (exit 2)” (created alongside this PR).

Outcome

Branch Cleanup's workflow_dispatch and push-sentinel trigger paths no longer offer a stale batch option that branch-cleanup-delete.sh cannot execute. Both trigger paths now only expose safe/review, matching what the script (and docs/branch-cleanup-matrix.csv, which has no STALE verdict) actually supports.

Scope

  • Included:
    • .github/workflows/branch-cleanup.yml: removed stale from workflow_dispatch.inputs.batch.options, from the push-sentinel grep/sed regex, and from the header comment documenting the sentinel syntax.
  • Explicitly excluded:
    • No changes to scripts/maintenance/branch-cleanup-delete.sh (safe/review logic untouched).
    • No changes to the branch verdict matrix or audit data.

Risk

  • Risk level: low
  • Failure mode: none expected — stale was never a working option; removing it only prevents users from selecting an input that always failed.
  • Rollback: revert this commit.

Verification

  • Reproduced the failure signature from the real failing run: usage: scripts/maintenance/branch-cleanup-delete.sh {safe|review} / exit 2, confirming stale was unimplemented.
  • python3 -c "import yaml; yaml.safe_load(open('.github/workflows/branch-cleanup.yml'))" → parses cleanly.
  • grep -n "stale" .github/workflows/branch-cleanup.yml → no matches remain.
  • Simulated sentinel regex logic: [run-cleanup:safe] still matches and extracts batch=safe; [run-cleanup:stale] is now correctly rejected instead of reaching the script.
  • DRY_RUN=1 scripts/maintenance/branch-cleanup-delete.sh safe → exits 0, unaffected by this change.

Production evidence

Not applicable — CI/workflow-definition-only change; no runtime or deploy impact.

Agent handoff

  • One canonical issue is linked
  • No competing PR implements the same issue
  • Acceptance criteria are satisfied (unimplemented option removed from both trigger paths)
  • Required checks pass on the current head
  • Human decision is requested only for product, security, irreversible infrastructure, or production approval

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

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

# Create the pull request
gh pr create --title '[ai] fix(ci): remove unimplemented stale batch from Branch Cleanup dispatch' --base 'main' --head 'pr-iteration/fix/branch-cleanup-stale-batch-crash' --repo 'groupthinking/EventRelay'

Generated by pr-iteration-loop · copilot · auto · 165.9 AIC · ⌖ 9.04 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