fix(kanban): clear failure/crash diagnostics while a retry is in flight

A retried task (→ running) kept showing "crashed Nx": the in-flight run
has no outcome yet, so the trailing crash scan skipped it and kept
counting the prior streak, and the consecutive_failures counter lingers.
Exempt `running` from both repeated_failures and repeated_crashes so a
fresh attempt clears the banner until it itself resolves (re-fires if the
new run also fails).
This commit is contained in:
Brooklyn Nicholson 2026-07-09 15:59:50 -05:00
parent e87c495dc2
commit aea570db4e
2 changed files with 24 additions and 2 deletions

View file

@ -282,6 +282,17 @@ def test_failure_rules_exempt_terminal_statuses():
assert kd.compute_task_diagnostics(task, [], runs) == []
def test_failure_rules_exempt_running_retry():
# Retrying a task (→ running) puts a fresh attempt in flight; its
# in-flight run (no outcome) doesn't break the trailing crash scan,
# so the past streak used to keep flagging over an active retry.
# A running card must clear the failure/crash banner until this
# attempt itself resolves.
runs = [_run(outcome="crashed", run_id=1), _run(outcome="crashed", run_id=2)]
task = _task(status="running", assignee="crashy", consecutive_failures=3)
assert kd.compute_task_diagnostics(task, [], runs) == []
def test_stuck_in_blocked_fires_past_threshold():
now = int(time.time())
task = _task(status="blocked")