fix(channels): clear failure kind after recovery

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
This commit is contained in:
Ngoc TrungandSisyphus committed 2026-09-22 13:23:47 +07:00
1 parent 4f80824177
commit dcadb77548
2 files changed
+4

No files matched your search

+1
View File
@@ -304,6 +304,7 @@ func mergeChannelHealth(previous, snapshot ChannelHealth) ChannelHealth {
}
snapshot.ConsecutiveFailures = 0
snapshot.FirstFailedAt = time.Time{}
snapshot.FailureKind = ""
if snapshot.LastFailedAt.IsZero() {
snapshot.LastFailedAt = previous.LastFailedAt
}
+3
View File
@@ -504,6 +504,9 @@ func TestMergeChannelHealthTracksFailureTimelineAndRecovery(t *testing.T) {
recovered.CheckedAt = recoveredAt
recovered = mergeChannelHealth(second, recovered)
if recovered.FailureKind != "" {
t.Fatalf("expected failure kind to clear after recovery, got %q", recovered.FailureKind)
}
if recovered.ConsecutiveFailures != 0 {
t.Fatalf("expected consecutive failures reset, got %d", recovered.ConsecutiveFailures)
}