Merge pull request 'fix: CI fix counter can be wasted by guard hits — consider check_only mode (#377)' (#481) from fix/issue-377 into main

This commit is contained in:
johba 2026-03-21 12:39:05 +01:00
commit bb8b3e92fb

View file

@ -375,10 +375,14 @@ if [ "$ORPHAN_COUNT" -gt 0 ]; then
log "issue #${ISSUE_NUM} already has active session ${SESSION_NAME} — skipping"
exit 0
fi
if handle_ci_exhaustion "$HAS_PR" "$ISSUE_NUM"; then
if handle_ci_exhaustion "$HAS_PR" "$ISSUE_NUM" "check_only"; then
# Fall through to backlog scan instead of exit
:
else
# Increment at actual launch time (not on guard-hit paths)
if handle_ci_exhaustion "$HAS_PR" "$ISSUE_NUM"; then
exit 0 # exhausted between check and launch
fi
log "issue #${ISSUE_NUM} PR #${HAS_PR} CI failed — spawning agent to fix (attempt ${CI_FIX_ATTEMPTS}/3)"
nohup "${SCRIPT_DIR}/dev-agent.sh" "$ISSUE_NUM" >> "$LOGFILE" 2>&1 &
log "started dev-agent PID $! for issue #${ISSUE_NUM} (CI fix)"
@ -483,9 +487,13 @@ for i in $(seq 0 $(($(echo "$OPEN_PRS" | jq 'length') - 1))); do
log "issue #${STUCK_ISSUE} already has active session ${SESSION_NAME} — skipping"
continue
fi
if handle_ci_exhaustion "$PR_NUM" "$STUCK_ISSUE"; then
if handle_ci_exhaustion "$PR_NUM" "$STUCK_ISSUE" "check_only"; then
continue # skip this PR, check next stuck PR or fall through to backlog
fi
# Increment at actual launch time (not on guard-hit paths)
if handle_ci_exhaustion "$PR_NUM" "$STUCK_ISSUE"; then
continue # exhausted between check and launch
fi
log "PR #${PR_NUM} (issue #${STUCK_ISSUE}) CI failed — fixing (attempt ${CI_FIX_ATTEMPTS}/3)"
nohup "${SCRIPT_DIR}/dev-agent.sh" "$STUCK_ISSUE" >> "$LOGFILE" 2>&1 &
log "started dev-agent PID $! for stuck PR #${PR_NUM}"