feat: dev-agent → supervisor escalation via escalations.jsonl

When dev-agent exhausts CI fix budget, writes escalation marker.
Supervisor picks it up next poll and invokes claude -p to diagnose
(flaky test? rate limit? real bug?) and decide: fix, close PR, or
escalate to human.
This commit is contained in:
openhands 2026-03-13 06:51:53 +00:00
parent 6abe24f3a5
commit 64b464b01b
2 changed files with 11 additions and 1 deletions

View file

@ -967,7 +967,10 @@ while [ "$REVIEW_ROUND" -lt "$MAX_REVIEW_ROUNDS" ]; do
CI_FIX_COUNT=$(( ${CI_FIX_COUNT:-0} + 1 )) CI_FIX_COUNT=$(( ${CI_FIX_COUNT:-0} + 1 ))
if [ "$CI_FIX_COUNT" -gt 2 ]; then if [ "$CI_FIX_COUNT" -gt 2 ]; then
log "CI failure not recoverable after ${CI_FIX_COUNT} fix attempts" 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 break
fi fi

View file

@ -267,6 +267,13 @@ done
# ============================================================================= # =============================================================================
# P4: HOUSEKEEPING — stale processes # 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" status "P4: housekeeping"
# Stale claude processes (>3h, not caught by P0) # Stale claude processes (>3h, not caught by P0)