Compare commits

..

1 commit

Author SHA1 Message Date
Agent
2db32b20dd fix: dev-agent failure cleanup should preserve remote branch and PR for debugging
All checks were successful
ci/woodpecker/push/ci Pipeline was successful
ci/woodpecker/pr/ci Pipeline was successful
2026-04-02 05:43:43 +00:00

View file

@ -264,11 +264,16 @@ export FORGE_REMOTE
log "forge remote: ${FORGE_REMOTE}" log "forge remote: ${FORGE_REMOTE}"
# Generate unique branch name per attempt to avoid collision with failed attempts # Generate unique branch name per attempt to avoid collision with failed attempts
# Only apply when not in recovery mode (RECOVERY_MODE branch is already set from existing PR)
# First attempt: fix/issue-N, subsequent: fix/issue-N-1, fix/issue-N-2, etc. # First attempt: fix/issue-N, subsequent: fix/issue-N-1, fix/issue-N-2, etc.
ATTEMPT=$(git ls-remote --heads "$FORGE_REMOTE" "fix/issue-${ISSUE}*" 2>/dev/null | wc -l) if [ "$RECOVERY_MODE" = false ]; then
# Count only branches matching fix/issue-N, fix/issue-N-1, fix/issue-N-2, etc. (exact prefix match)
ATTEMPT=$(git ls-remote --heads "$FORGE_REMOTE" "refs/heads/fix/issue-${ISSUE}" 2>/dev/null | grep -c "refs/heads/fix/issue-${ISSUE}$" || echo 0)
ATTEMPT=$((ATTEMPT + $(git ls-remote --heads "$FORGE_REMOTE" "refs/heads/fix/issue-${ISSUE}-*" 2>/dev/null | wc -l)))
if [ "$ATTEMPT" -gt 0 ]; then if [ "$ATTEMPT" -gt 0 ]; then
BRANCH="fix/issue-${ISSUE}-${ATTEMPT}" BRANCH="fix/issue-${ISSUE}-${ATTEMPT}"
fi fi
fi
log "using branch: ${BRANCH}" log "using branch: ${BRANCH}"
if [ "$RECOVERY_MODE" = true ]; then if [ "$RECOVERY_MODE" = true ]; then