diff --git a/dev/dev-agent.sh b/dev/dev-agent.sh index e0959af..7b13494 100755 --- a/dev/dev-agent.sh +++ b/dev/dev-agent.sh @@ -967,7 +967,10 @@ while [ "$REVIEW_ROUND" -lt "$MAX_REVIEW_ROUNDS" ]; do CI_FIX_COUNT=$(( ${CI_FIX_COUNT:-0} + 1 )) if [ "$CI_FIX_COUNT" -gt 2 ]; then log "CI failure not recoverable after ${CI_FIX_COUNT} fix attempts" - notify "❌ PR #${PR_NUMBER} CI failed ${CI_FIX_COUNT}x: ${FAILED_STEP:-unknown}. Needs human attention." + # Escalate to supervisor — write marker for factory-poll.sh to pick up + echo "{\"issue\":${ISSUE},\"pr\":${PR_NUMBER},\"reason\":\"ci_exhausted\",\"step\":\"${FAILED_STEP:-unknown}\",\"attempts\":${CI_FIX_COUNT},\"ts\":\"$(date -u +%Y-%m-%dT%H:%M:%SZ)\"}" \ + >> "${FACTORY_ROOT}/factory/escalations.jsonl" + log "escalated to supervisor via escalations.jsonl" break fi diff --git a/factory/factory-poll.sh b/factory/factory-poll.sh index 3877f98..4627039 100755 --- a/factory/factory-poll.sh +++ b/factory/factory-poll.sh @@ -267,6 +267,13 @@ done # ============================================================================= # P4: HOUSEKEEPING — stale processes # ============================================================================= +# Check for dev-agent escalations +ESCALATION_FILE="${FACTORY_ROOT}/factory/escalations.jsonl" +if [ -s "$ESCALATION_FILE" ]; then + ESCALATION_COUNT=$(wc -l < "$ESCALATION_FILE") + p3 "Dev-agent escalated ${ESCALATION_COUNT} issue(s) — see ${ESCALATION_FILE}" +fi + status "P4: housekeeping" # Stale claude processes (>3h, not caught by P0)