dx(orchestrate): reset poll interval when waiting_approval agents present

Sentry flagged that adaptive backoff could delay auto-approval by up to
5 minutes. Fix: treat waiting_approval agents same as active kick/recycle
events — reset to base interval (30s) immediately.
This commit is contained in:
Zamil Majdy
2026-04-08 09:38:02 +07:00
parent 5fd9f17265
commit 4787b11805

View File

@@ -163,8 +163,9 @@ while true; do
echo "[$(date +%H:%M:%S)] Poll — ${RUNNING} running ${KICKED} kicked ${DONE} recycled (next in ${POLL_CURRENT}s)"
# Adaptive backoff: reset to base on activity, back off toward max when idle
if (( KICKED > 0 || DONE > 0 )); then
# Adaptive backoff: reset to base on activity or waiting_approval agents; back off when truly idle
WAITING=$(jq '[.agents[] | select(.state == "waiting_approval")] | length' "$STATE_FILE" 2>/dev/null || echo 0)
if (( KICKED > 0 || DONE > 0 || WAITING > 0 )); then
POLL_CURRENT=$POLL_INTERVAL
else
POLL_CURRENT=$(( POLL_CURRENT * 3 / 2 ))