fix: phase-handler.sh FAILURE_REASON fallback does not handle missing phase file (#410)
The sed pipeline `sed -n 2p "$PHASE_FILE" 2>/dev/null | sed "s/^Reason: //"` exits 0
even when $PHASE_FILE does not exist because the second sed reads empty stdin and
succeeds, leaving FAILURE_REASON as "" instead of "unspecified".
Replace with an explicit file-existence check and use ${FAILURE_REASON:-unspecified}
as the default assignment.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
ea794fc7c3
commit
8b293331b6
1 changed files with 4 additions and 1 deletions
|
|
@ -657,7 +657,10 @@ Instructions:
|
|||
|
||||
# ── PHASE: failed ───────────────────────────────────────────────────────────
|
||||
elif [ "$phase" = "PHASE:failed" ]; then
|
||||
FAILURE_REASON=$(sed -n '2p' "$PHASE_FILE" 2>/dev/null | sed 's/^Reason: //' || echo "unspecified")
|
||||
if [[ -f "$PHASE_FILE" ]]; then
|
||||
FAILURE_REASON=$(sed -n '2p' "$PHASE_FILE" | sed 's/^Reason: //')
|
||||
fi
|
||||
FAILURE_REASON="${FAILURE_REASON:-unspecified}"
|
||||
log "phase: failed — reason: ${FAILURE_REASON}"
|
||||
# Gitea labels API requires []int64 — look up the "backlog" label ID once
|
||||
BACKLOG_LABEL_ID=$(codeberg_api GET "/labels" 2>/dev/null \
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue