[bug] a messaging channel that fails on its own is never restarted #1000

Closed
opened 2026-10-27 13:38:37 +00:00 by sam · 0 comments
Owner

runChannel (internal/app/archiemessaging/supervise.go) marks a channel that exits on its own as failed or stopped and returns, leaving it unsupervised; restartChannel then refuses it with 'channel is not running' because supervised is false. A channel that failed on its own can only come back by restarting the whole service.

Design

Keep one supervisor goroutine per channel for the service lifetime. A failed run is retried with bounded backoff (doubling, capped at 30s) up to 5 attempts; after the budget the supervisor parks. An explicit restart (restartChannel, driven by channel settings) wakes a parked or backing-off supervisor through a per-instance notify channel, and an in-flight run through restartPending plus its cancel. The supervisor only exits on shutdown, so a stopped channel always has one to start it again; a deferred supervisorExits clears supervised on return.

Acceptance criteria

Tests pin: a failing channel is started again; an explicit restart of a parked channel starts a replacement instead of being refused; an in-flight restart replaces a live run; a channel with no supervisor (never started, or shut down) is refused.

Close reason

Fixed by e6791746: one supervisor per channel for the service lifetime, bounded backoff retry (5 attempts, capped 30s), park, explicit restart wakes it. supervise_test covers all acceptance cases and passes with -race.


Imported from beads archie-core-1n31 · GitHub #1559 · type bug · priority P2 · created 2026-10-08 · closed 2026-10-24

runChannel (internal/app/archiemessaging/supervise.go) marks a channel that exits on its own as failed or stopped and returns, leaving it unsupervised; restartChannel then refuses it with 'channel is not running' because supervised is false. A channel that failed on its own can only come back by restarting the whole service. ### Design Keep one supervisor goroutine per channel for the service lifetime. A failed run is retried with bounded backoff (doubling, capped at 30s) up to 5 attempts; after the budget the supervisor parks. An explicit restart (restartChannel, driven by channel settings) wakes a parked or backing-off supervisor through a per-instance notify channel, and an in-flight run through restartPending plus its cancel. The supervisor only exits on shutdown, so a stopped channel always has one to start it again; a deferred supervisorExits clears supervised on return. ### Acceptance criteria Tests pin: a failing channel is started again; an explicit restart of a parked channel starts a replacement instead of being refused; an in-flight restart replaces a live run; a channel with no supervisor (never started, or shut down) is refused. ### Close reason Fixed by e6791746: one supervisor per channel for the service lifetime, bounded backoff retry (5 attempts, capped 30s), park, explicit restart wakes it. supervise_test covers all acceptance cases and passes with -race. --- _Imported from beads `archie-core-1n31` · GitHub #1559 · type bug · priority P2 · created 2026-10-08 · closed 2026-10-24_
sam added the mediumbug labels 2026-10-27 13:38:37 +00:00
sam self-assigned this 2026-10-27 13:38:37 +00:00
sam closed this issue 2026-10-27 13:38:37 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: sam/archie#1000