${FAILED_STEP:-unknown} — issue marked blocked"
- printf 'PHASE:failed\nReason: ci_exhausted after %d attempts\n' "$CI_FIX_COUNT" > "$PHASE_FILE"
- # Do NOT update LAST_PHASE_MTIME here — let the main loop detect PHASE:failed
+ "CI exhausted after ${CI_FIX_COUNT} attempts — escalating for human help" \
+ "CI exhausted after ${CI_FIX_COUNT} attempts on PR #${PR_NUMBER} | Pipeline${FAILED_STEP:-unknown} — escalating for human help"
+ printf 'PHASE:escalate\nReason: ci_exhausted after %d attempts (step: %s)\n' "$CI_FIX_COUNT" "${FAILED_STEP:-unknown}" > "$PHASE_FILE"
+ # Do NOT update LAST_PHASE_MTIME here — let the main loop detect PHASE:escalate
return 0
fi
@@ -551,9 +555,9 @@ Rebase onto ${PRIMARY_BRANCH} and push:
echo \"PHASE:awaiting_ci\" > \"${PHASE_FILE}\"
Do NOT merge or close the issue — the orchestrator handles that after CI passes.
-If rebase repeatedly fails, write PHASE:needs_human with a reason."
+If rebase repeatedly fails, write PHASE:escalate with a reason."
fi
- # _merge_rc=2: PHASE:needs_human already written by do_merge()
+ # _merge_rc=2: PHASE:escalate already written by do_merge()
break
elif [ "$VERDICT" = "REQUEST_CHANGES" ] || [ "$VERDICT" = "DISCUSS" ]; then
@@ -618,21 +622,21 @@ Instructions:
if ! $REVIEW_FOUND && [ "$REVIEW_POLL_ELAPSED" -ge "$REVIEW_POLL_TIMEOUT" ]; then
log "TIMEOUT: no review after 3h"
notify "no review received for PR #${PR_NUMBER} after 3h"
- agent_inject_into_session "$SESSION_NAME" "TIMEOUT: No review received after 3 hours for PR #${PR_NUMBER}. Write PHASE:needs_human to escalate to a human reviewer."
+ agent_inject_into_session "$SESSION_NAME" "TIMEOUT: No review received after 3 hours for PR #${PR_NUMBER}. Write PHASE:escalate to escalate to a human reviewer."
fi
- # ── PHASE: needs_human ──────────────────────────────────────────────────────
- elif [ "$phase" = "PHASE:needs_human" ]; then
- status "needs human input on issue #${ISSUE}"
- HUMAN_REASON=$(sed -n '2p' "$PHASE_FILE" 2>/dev/null | sed 's/^Reason: //' || echo "")
+ # ── PHASE: escalate ──────────────────────────────────────────────────────
+ elif [ "$phase" = "PHASE:escalate" ]; then
+ status "escalated — waiting for human input on issue #${ISSUE}"
+ ESCALATE_REASON=$(sed -n '2p' "$PHASE_FILE" 2>/dev/null | sed 's/^Reason: //' || echo "")
_issue_url="${CODEBERG_WEB}/issues/${ISSUE}"
_pr_link=""
[ -n "${PR_NUMBER:-}" ] && _pr_link=" | PR #${PR_NUMBER}"
notify_ctx \
- "⚠️ Issue #${ISSUE} (PR #${PR_NUMBER:-none}) needs human input.${HUMAN_REASON:+ Reason: ${HUMAN_REASON}}" \
- "⚠️ Issue #${ISSUE}${_pr_link} needs human input.${HUMAN_REASON:+ Reason: ${HUMAN_REASON}}