From 64b464b01b91489dac435de170c7200f0f7400ac Mon Sep 17 00:00:00 2001 From: openhands Date: Fri, 13 Mar 2026 06:51:53 +0000 Subject: [PATCH] =?UTF-8?q?feat:=20dev-agent=20=E2=86=92=20supervisor=20es?= =?UTF-8?q?calation=20via=20escalations.jsonl?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. --- dev/dev-agent.sh | 5 ++++- factory/factory-poll.sh | 7 +++++++ 2 files changed, 11 insertions(+), 1 deletion(-) 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)