Files
cleveragents-core/tools/controller/master
drew bea16f7130 fix(controller): scope STUCK-gating counters to the operator_unstick epoch
operator_unstick is the deliberate operator escape hatch that requeues a
STUCK/APPROVED/PAUSED workflow back to DISCOVERED. It reset the state but
not the per-workflow failure tallies, so a requeued workflow inherited
every historical worker-error / ci-not-ready / ci-infra-failure / dispute
/ contract-violation / resolved-conflict count and re-tripped a backstop
cap almost immediately (observed: a PR re-STUCK after a single fresh
ci-not-ready because 5 stale ones from prior runs were still counted).

All seven prior-outcome counters now accept an epoch_start and, when the
workflow has been operator-requeued, count only attempts created after
the most recent operator_unstick event — so a requeue genuinely starts
the backstop budgets fresh. The automatic DISCOVERED loops
(ci_infra_recheck, ci_red_retry) are not operator_unstick events, so
their caps still bound those loops. operator_unstick is matched under
both conventions seen in the wild (bare event_type, or a transition
whose payload names it); the comparison is wrapped in datetime() to be
immune to timestamp-format drift.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-21 22:01:43 -04:00
..