You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Protocol violations (rc=0 without complete/block) don't increment failure_limit counter #32747
When a worker process exits with rc=0 without calling kanban_complete or kanban_block, the dispatcher correctly emits a protocol_violation event, but does NOT increment the task's failure counter. This means failure_limit never triggers for this failure mode, and the card re-dispatches indefinitely.
Repro
Set failure_limit: 2 in config.yaml
Dispatch a card whose worker consistently exits rc=0 without calling complete/block
Observe: dispatcher emits protocol_violation each cycle, failure counter stays at 0, card re-dispatched indefinitely
Observed
Card t_9250007f accumulated 69 dispatch cycles with failure_limit=2 configured. Never auto-blocked. Had to be manually blocked.
Expected
failure_limit should apply to ALL terminal outcomes — crash (non-zero rc), timeout, AND protocol violations (rc=0 without complete/block). Any of these should increment the failure counter.
Confirming this reproduces with strong evidence on v0.14.0 (2026.5.16) — and the loss is worse than the original report suggests, because every cycle is an API call.
Same bug shape, two independent runs
Run A — May 18–26, 37 concurrent tasks (board "qe", auto-decomposed research cards). All 37 tasks accumulated 270–285 consecutive protocol_violation events each over ~8 days. None auto-blocked despite the dispatcher emitting gave_up on every cycle with failures=1, effective_limit=1. Diagnostics surfaced this as critical repeated_crashes (the → Check logs advice was accurate; the auto-block never fired). I eventually mass-blocked by hand to stop the loop.
Run B — May 27, fresh DB, --max-retries 1 set on a single task. After resetting the kanban DB to investigate, I created one task (t_f76f2272) with --max-retries 1 --max-runtime 5m. It still cycled through crashed → gave_up → promoted → claimed 3+ times before I blocked it. --max-retries on the task does not cap the dispatch loop for this failure mode either, matching this bug.
Suggested fix scope
gave_up already knows the outcome (trigger_outcome: 'crashed'), so the same guard could apply: if gave_up fired for this run, do not promote. As written the promotion happens unconditionally after gave_up, which is what makes the counter-not-incrementing problem catastrophic — even without fixing the counter, honoring the gave_up terminal signal would break the loop.
Cost
Each cycle on these tasks took ~2–3 min and spent ~7–10k tokens of API budget per spawn. The 270x crash counts × 37 tasks × ~10k tokens is non-trivial spend on a strictly broken control loop. Worth prioritizing the fix; happy to test a patch.
+1, and a variant worth folding into this issue: the same gap applies when the worker DOES call kanban_complete but the call is rejected.
In our production case (v0.15.0, details in my comment on #35202) the worker finished its task and called kanban_complete, which failed with could not complete <id> (unknown id or already terminal) because the dispatcher's watchdog had already reclaimed the run as a dead pid. From the breaker's point of view this is identical to your rc=0-without-complete case: a terminal outcome that advances no counter. The task re-dispatched 10 consecutive times with failure_limit: 2 configured; board diagnostics counted consecutive_crashes=10 correctly the whole time.
Your "Expected" section says it exactly: failure_limitshould apply to ALL terminal outcomes. I'd add rejected completions to that list alongside crash, timeout, and clean-exit protocol violations.
One more data point for triage: each phantom re-dispatch is a full LLM run. Ours burned a shared provider quota and then rolled onto a metered API key via fallback_providers. With your 69-cycle card and the 1,192-crash case in #35202, this failure family is anuncapped-spend bug, not P3/cosmetic.
This is implemented on current main. Automated hermes-sweeper review verified the exact rc=0-without-terminal-transition path.
hermes_cli/kanban_db.py:6632-6647 records a clean exit while still running as protocol_violation.
hermes_cli/kanban_db.py:6745-6755 invokes _record_task_failure(..., failure_limit=1) for that path, immediately blocking the task and emitting gave_up rather than allowing a redispatch loop.
tests/hermes_cli/test_kanban_core_functionality.py:4401-4455 covers the regression: rc=0 plus no kanban_complete/kanban_block produces protocol_violation and gave_up, with task status blocked.
The implementation landed in fdb9e0f6a65e77f795d32cd782520622a150301d (fix(kanban): auto-block workers that exit without completing) and is contained in v2026.5.7.
The later discussion's rejected-completion/stale-reclaim scenario is a distinct lifecycle-race concern; this issue's reported protocol-violation failure-counter loop is already fixed.
Activity
alycda commentedon May 27, 2026
Confirming this reproduces with strong evidence on
v0.14.0 (2026.5.16)— and the loss is worse than the original report suggests, because every cycle is an API call.Same bug shape, two independent runs
Run A — May 18–26, 37 concurrent tasks (board "qe", auto-decomposed research cards). All 37 tasks accumulated 270–285 consecutive
protocol_violationevents each over ~8 days. None auto-blocked despite the dispatcher emittinggave_upon every cycle withfailures=1, effective_limit=1. Diagnostics surfaced this as criticalrepeated_crashes(the→ Check logsadvice was accurate; the auto-block never fired). I eventually mass-blocked by hand to stop the loop.Sample event sequence (task
t_6907c842, 4,243 events total):Run B — May 27, fresh DB,
--max-retries 1set on a single task. After resetting the kanban DB to investigate, I created one task (t_f76f2272) with--max-retries 1 --max-runtime 5m. It still cycled throughcrashed → gave_up → promoted → claimed3+ times before I blocked it.--max-retrieson the task does not cap the dispatch loop for this failure mode either, matching this bug.Suggested fix scope
gave_upalready knows the outcome (trigger_outcome: 'crashed'), so the same guard could apply: ifgave_upfired for this run, do notpromote. As written the promotion happens unconditionally aftergave_up, which is what makes the counter-not-incrementing problem catastrophic — even without fixing the counter, honoring thegave_upterminal signal would break the loop.Cost
Each cycle on these tasks took ~2–3 min and spent ~7–10k tokens of API budget per spawn. The 270x crash counts × 37 tasks × ~10k tokens is non-trivial spend on a strictly broken control loop. Worth prioritizing the fix; happy to test a patch.
ga1205 commentedon Jun 5, 2026
+1, and a variant worth folding into this issue: the same gap applies when the worker DOES call
kanban_completebut the call is rejected.In our production case (v0.15.0, details in my comment on #35202) the worker finished its task and called
kanban_complete, which failed withcould not complete <id> (unknown id or already terminal)because the dispatcher's watchdog had already reclaimed the run as a dead pid. From the breaker's point of view this is identical to your rc=0-without-complete case: a terminal outcome that advances no counter. The task re-dispatched 10 consecutive times withfailure_limit: 2configured; board diagnostics countedconsecutive_crashes=10correctly the whole time.Your "Expected" section says it exactly:
failure_limitshould apply to ALL terminal outcomes. I'd add rejected completions to that list alongside crash, timeout, and clean-exit protocol violations.One more data point for triage: each phantom re-dispatch is a full LLM run. Ours burned a shared provider quota and then rolled onto a metered API key via
fallback_providers. With your 69-cycle card and the 1,192-crash case in #35202, this failure family is anuncapped-spend bug, not P3/cosmetic.teknium1 commentedon Jul 13, 2026
This is implemented on current
main. Automated hermes-sweeper review verified the exact rc=0-without-terminal-transition path.hermes_cli/kanban_db.py:6632-6647records a clean exit while stillrunningasprotocol_violation.hermes_cli/kanban_db.py:6745-6755invokes_record_task_failure(..., failure_limit=1)for that path, immediately blocking the task and emittinggave_uprather than allowing a redispatch loop.tests/hermes_cli/test_kanban_core_functionality.py:4401-4455covers the regression: rc=0 plus nokanban_complete/kanban_blockproducesprotocol_violationandgave_up, with task statusblocked.fdb9e0f6a65e77f795d32cd782520622a150301d(fix(kanban): auto-block workers that exit without completing) and is contained inv2026.5.7.The later discussion's rejected-completion/stale-reclaim scenario is a distinct lifecycle-race concern; this issue's reported protocol-violation failure-counter loop is already fixed.