Problem
The "What happened" diagnostics card on the channel detail page is displayed even when the channel is in a healthy state. This makes it look like something is wrong when the channel is actually operating normally.
Root Cause
The showDiagnosticsCard condition in channel-detail-page.tsx includes:
const showDiagnosticsCard =
status?.state === "failed" ||
status?.state === "degraded" ||
!!status?.remediation ||
!!status?.consecutive_failures ||
!!status?.first_failed_at; // ← bug here
The backend (mergeChannelHealth in internal/channels/health.go) correctly resets FirstFailedAt to time.Time{} when the channel transitions back to healthy. However, Go's zero-value time.Time{} serializes to "0001-01-01T00:00:00Z" in JSON — it does not become null or get omitted (the struct tag has no omitempty, and omitempty doesn't work for time.Time in Go's standard library anyway).
On the frontend, !!status?.first_failed_at evaluates !!"0001-01-01T00:00:00Z" → true, so the diagnostics card is always shown for any channel that has ever experienced a failure, even if it has fully recovered.
Fix
Replace the raw truthy check with the existing formatRelativeTime() helper, which already filters out year≤ 1 timestamps:
import { formatRelativeTime } from "../channels-status-view";
const showDiagnosticsCard =
status?.state === "failed" ||
status?.state === "degraded" ||
!!status?.remediation ||
!!status?.consecutive_failures ||
!!formatRelativeTime(status?.first_failed_at);
formatRelativeTime("0001-01-01T00:00:00Z") returns null because of its existing guard:
if (date.getUTCFullYear() <= 1) return null;
This ensures the diagnostics card only appears when there is a meaningful active or recent failure.
Problem
The "What happened" diagnostics card on the channel detail page is displayed even when the channel is in a
healthystate. This makes it look like something is wrong when the channel is actually operating normally.Root Cause
The
showDiagnosticsCardcondition inchannel-detail-page.tsxincludes:The backend (
mergeChannelHealthininternal/channels/health.go) correctly resetsFirstFailedAttotime.Time{}when the channel transitions back to healthy. However, Go's zero-valuetime.Time{}serializes to"0001-01-01T00:00:00Z"in JSON — it does not becomenullor get omitted (the struct tag has noomitempty, andomitemptydoesn't work fortime.Timein Go's standard library anyway).On the frontend,
!!status?.first_failed_atevaluates!!"0001-01-01T00:00:00Z"→true, so the diagnostics card is always shown for any channel that has ever experienced a failure, even if it has fully recovered.Fix
Replace the raw truthy check with the existing
formatRelativeTime()helper, which already filters out year≤ 1 timestamps:formatRelativeTime("0001-01-01T00:00:00Z")returnsnullbecause of its existing guard:This ensures the diagnostics card only appears when there is a meaningful active or recent failure.