fix: address review feedback on escalation triage (#185)

- supervisor-poll.sh: check PR state before retrigger; discard stale escalations
  for closed/merged PRs instead of pushing to their branches
- supervisor-poll.sh: bump escalation ts to now on failed retrigger push, so
  the 30-min cooldown resets and alert flooding is avoided on persistent failures
- ci-helpers.sh: require at least one confirmed infra step before returning
  "infra"; prevents false-positive when all step names are empty strings
- ci-helpers.sh: clarify header comment to distinguish per-function requirements
- AGENTS.md: document classify_pipeline_failure() in ci-helpers.sh table row

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
openhands 2026-03-19 09:03:03 +00:00
parent 47eccdb8ae
commit 97ffdca95c
3 changed files with 19 additions and 6 deletions

View file

@ -410,11 +410,16 @@ check_project() {
continue
fi
# Get the PR's branch from Codeberg
# Get the PR's branch and state from Codeberg
_esc_pr_json=$(codeberg_api GET "/pulls/${_esc_pr}" 2>/dev/null) || {
flog "${proj_name}: PR #${_esc_pr}: failed to fetch PR info, keeping escalation"
printf '%s\n' "$_esc_line" >> "$_esc_tmp"; continue
}
_esc_pr_state=$(printf '%s' "$_esc_pr_json" | jq -r '.state // ""' 2>/dev/null)
if [ "$_esc_pr_state" != "open" ]; then
flog "${proj_name}: PR #${_esc_pr} is ${_esc_pr_state:-unknown} — discarding stale escalation"
continue # PR merged/closed externally; escalation no longer actionable
fi
_esc_branch=$(printf '%s' "$_esc_pr_json" | jq -r '.head.ref // ""' 2>/dev/null)
if [ -z "$_esc_branch" ]; then
printf '%s\n' "$_esc_line" >> "$_esc_tmp"; continue
@ -493,7 +498,12 @@ json.dump(d, open(f, 'w'))
# Escalation removed — do NOT write to _esc_tmp
else
p2 "${proj_name}: PR #${_esc_pr}: infra-only CI exhaustion but retrigger push failed"
printf '%s\n' "$_esc_line" >> "$_esc_tmp"
# Bump timestamp to now so the 30-min cooldown resets; prevents alert flood
# on persistent push failures (SSH key issue, Codeberg outage, etc.)
_esc_now=$(date -u +%Y-%m-%dT%H:%M:%SZ)
_esc_bumped=$(printf '%s' "$_esc_line" | jq -c --arg ts "$_esc_now" '.ts = $ts' 2>/dev/null \
|| printf '%s' "$_esc_line")
printf '%s\n' "$_esc_bumped" >> "$_esc_tmp"
fi
done < "$_esc_file"