fix: dev-poll.sh: redundant manual state exclusions alongside ci_passed (#113)
Add ci_failed() helper to lib/ci-helpers.sh and replace three compound `! ci_passed && CI_STATE != "" && != "pending" && != "unknown"` patterns in dev/dev-poll.sh with the cleaner ci_failed() call. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
4dc29d2393
commit
d29c6ad1c9
2 changed files with 17 additions and 3 deletions
|
|
@ -369,7 +369,7 @@ if [ "$ORPHAN_COUNT" -gt 0 ]; then
|
|||
fi
|
||||
exit 0
|
||||
|
||||
elif ! ci_passed "$CI_STATE" && [ "$CI_STATE" != "" ] && [ "$CI_STATE" != "pending" ] && [ "$CI_STATE" != "unknown" ]; then
|
||||
elif ci_failed "$CI_STATE"; then
|
||||
SESSION_NAME="dev-${PROJECT_NAME}-${ISSUE_NUM}"
|
||||
if tmux has-session -t "$SESSION_NAME" 2>/dev/null; then
|
||||
log "issue #${ISSUE_NUM} already has active session ${SESSION_NAME} — skipping"
|
||||
|
|
@ -477,7 +477,7 @@ for i in $(seq 0 $(($(echo "$OPEN_PRS" | jq 'length') - 1))); do
|
|||
nohup "${SCRIPT_DIR}/dev-agent.sh" "$STUCK_ISSUE" >> "$LOGFILE" 2>&1 &
|
||||
log "started dev-agent PID $! for stuck PR #${PR_NUM}"
|
||||
exit 0
|
||||
elif ! ci_passed "$CI_STATE" && [ "$CI_STATE" != "" ] && [ "$CI_STATE" != "pending" ] && [ "$CI_STATE" != "unknown" ]; then
|
||||
elif ci_failed "$CI_STATE"; then
|
||||
SESSION_NAME="dev-${PROJECT_NAME}-${STUCK_ISSUE}"
|
||||
if tmux has-session -t "$SESSION_NAME" 2>/dev/null; then
|
||||
log "issue #${STUCK_ISSUE} already has active session ${SESSION_NAME} — skipping"
|
||||
|
|
@ -568,7 +568,7 @@ for i in $(seq 0 $((BACKLOG_COUNT - 1))); do
|
|||
READY_ISSUE="$ISSUE_NUM"
|
||||
break
|
||||
|
||||
elif ! ci_passed "$CI_STATE" && [ "$CI_STATE" != "" ] && [ "$CI_STATE" != "pending" ] && [ "$CI_STATE" != "unknown" ]; then
|
||||
elif ci_failed "$CI_STATE"; then
|
||||
if handle_ci_exhaustion "$EXISTING_PR" "$ISSUE_NUM" "check_only"; then
|
||||
# Don't add to WAITING_PRS — escalated PRs should not block new work
|
||||
continue
|
||||
|
|
|
|||
|
|
@ -66,6 +66,20 @@ ci_passed() {
|
|||
return 1
|
||||
}
|
||||
|
||||
# ci_failed <state> — check if CI has definitively failed
|
||||
# Returns 0 if state indicates a real failure (not success, not pending,
|
||||
# not unknown, not empty).
|
||||
ci_failed() {
|
||||
local state="$1"
|
||||
if [ -z "$state" ] || [ "$state" = "pending" ] || [ "$state" = "unknown" ]; then
|
||||
return 1
|
||||
fi
|
||||
if ci_passed "$state"; then
|
||||
return 1
|
||||
fi
|
||||
return 0
|
||||
}
|
||||
|
||||
# is_infra_step <step_name> <exit_code> [log_data]
|
||||
# Checks whether a single CI step failure matches infra heuristics.
|
||||
# Returns 0 (infra) with reason on stdout, or 1 (not infra).
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue