Real-time monitoring dashboard for Proxmox VE, PBS, Docker, Kubernetes, TrueNAS and vSphere. Self-hosted, with alerts for failed backups, full disks, unhealthy containers and offline nodes.
Go aialertsdashboarddockerdocker-monitoringgohomelabinfrastructure-monitoringkubernetesmonitoringmspproxmoxproxmox-backup-serverproxmox-mail-gatewayproxmox-veself-hostedtruenastypescriptvspherewebhooks
Keep watchdog, delivery log and Patrol ages moving
rcourtman278c403d9674
diff --git a/docs/release-control/v6/internal/subsystems/alerts.md b/docs/release-control/v6/internal/subsystems/alerts.mdindex 199b9bdc55..2cf5789a5a 100644--- a/docs/release-control/v6/internal/subsystems/alerts.md+++ b/docs/release-control/v6/internal/subsystems/alerts.md@@ -3041,6 +3041,17 @@ delivery pause because those policies must not disable observation of Pulse.Its Refresh and Show/Hide actions are the shared outline `Button` (xs and`settingsAction` sizes), not a copied border shell, so they match the otherdestination controls and keep a 44px touch target on phones.+Last success and Monitor progress are ages, so they read the frontend-primitives+shared relative-time clock and keep moving while the panel stays open, and the+panel re-reads `GET /api/alerts/deadman/status` in the background every 30+seconds. A moving age over a status read once at mount would claim the+heartbeat stopped while Pulse kept pinging every minute, and a status that is+never re-read kept its read-time age through a real stall, which is the one+case this panel exists to show. A background re-read leaves the Refresh control+alone, and a failed one keeps the last status and marks it unavailable.+The delivery log's relative hover time on each row reads the same clock: a+logged attempt's time never changes, so its age is correct over a log that is+only re-read on demand.Watchdog transport and monitoring progress remain notifications- andmonitoring-owned respectively. Alerts owns the system-alert projection:diff --git a/docs/release-control/v6/internal/subsystems/api-contracts.md b/docs/release-control/v6/internal/subsystems/api-contracts.mdindex e410966406..52de395abb 100644--- a/docs/release-control/v6/internal/subsystems/api-contracts.md+++ b/docs/release-control/v6/internal/subsystems/api-contracts.md@@ -4835,6 +4835,12 @@ clients must not treat their absence as evidence of stability.`frontend-modern/src/api/patrolAttention.ts` (`AttentionFlapping`) and`frontend-modern/src/api/patrol.ts` (`FindingFlapping`, `mirrors_alert_*`)are the typed client boundary.+The Patrol page's paused banner, selected-run banner and attention detail+measure their ages (`blocked_at`, a run's `started_at`, acknowledgement,+transition and evidence times) from the frontend-primitives shared+relative-time clock. That is presentation over the same `GET+/api/ai/patrol/status`, run history and `GET /api/ai/patrol/attention/{id}`+payloads: no field, request or polling cadence changes.### Resource-list facets preserve scoped navigation evidencediff --git a/docs/release-control/v6/internal/subsystems/frontend-primitives.md b/docs/release-control/v6/internal/subsystems/frontend-primitives.mdindex deb19c788a..efe7ea8740 100644--- a/docs/release-control/v6/internal/subsystems/frontend-primitives.md+++ b/docs/release-control/v6/internal/subsystems/frontend-primitives.md@@ -5212,6 +5212,15 @@ derived from the same time (replication Next sync, backup age bands) reads ittoo. The clock can trail the wall clock by up to one tick, so a check thattreats a future time as invalid (the backup age band) measures from the laterof the two.+The rule has one deliberate exception. The age of a latest reading (last used,+last seen, last success, last checked) on data the surface reads once and does+not re-read stays the age at read time, because a moving age over a snapshot+that never refreshes claims the reading stopped when it may not have. Such a+surface either re-reads the snapshot in the background, as Proxmox replication+and the external watchdog panel do, or keeps the read-time age, as the Patrol+attention detail does for Last seen. An immutable event time (when a delivery+was attempted, a transition happened, a policy was set) ages correctly over any+snapshot and reads the clock.Read-only metadata badges follow the same primitive-owned shell rule.`frontend-modern/src/components/shared/MetadataBadge.tsx` owns filled andoutlined appearances, compact sizing, shape, typed tone vocabulary, fitdiff --git a/docs/release-control/v6/internal/subsystems/patrol-intelligence.md b/docs/release-control/v6/internal/subsystems/patrol-intelligence.mdindex 383727f107..a89b6a45e6 100644--- a/docs/release-control/v6/internal/subsystems/patrol-intelligence.md+++ b/docs/release-control/v6/internal/subsystems/patrol-intelligence.md@@ -2647,6 +2647,17 @@ finding and carried onto the unified finding as `failureCause`, and a providerpreflight success no longer clears a budget-exhausted runtime finding, so thesetup card still routes to the budget after a restart clears the in-memoryblock state.+The paused banner's `Blocked ...` age reads the frontend-primitives shared+relative-time clock: each status re-read returns the same `blocked_at` while+Patrol stays paused, so the banner kept the age it had when Patrol first+paused. The selected run's `Patrol run ...` banner reads the clock for the same+reason, since the selected run stays as picked when run history is re-read. The+attention detail is read once per selection, so its fixed event times (the+acknowledgement, each timeline transition, each evidence observation) read the+clock while it stays open. Its `Last seen` and flapping window are latest+readings of a record that may have moved since, so they stay the ages at+read time, and the queue rows, summary, recent work, run history and digest+re-derive on their own 30- or 60-second re-reads.### This week card answers what Patrol did for the customerdiff --git a/frontend-modern/browser-verification/530561c68f6c71e9.json b/frontend-modern/browser-verification/530561c68f6c71e9.jsonnew file mode 100644index 0000000000..0a97bb0a6a--- /dev/null+++ b/frontend-modern/browser-verification/530561c68f6c71e9.json@@ -0,0 +1,51 @@+{+ "version": 1,+ "base_sha": "bffd21f47026ca2408ee1d0b5bb071c02e60c623",+ "verified_at": "2026-10-06T15:46:26Z",+ "result": "passed",+ "changed_paths": [+ "frontend-modern/src/features/alerts/AlertDeadManDestinationSection.tsx",+ "frontend-modern/src/features/alerts/AlertDeliveryLogCard.tsx",+ "frontend-modern/src/features/patrol/PatrolAttentionWorkbench.tsx",+ "frontend-modern/src/features/patrol/PatrolIntelligenceBanners.tsx",+ "frontend-modern/src/features/patrol/PatrolIntelligenceWorkspace.tsx"+ ],+ "content_sha256": {+ "frontend-modern/src/features/alerts/AlertDeadManDestinationSection.tsx": "df5d337cbac9e091aa0e9dfaa2623a7169eedc7609829a76338f0e4208685e0b",+ "frontend-modern/src/features/alerts/AlertDeliveryLogCard.tsx": "90ab80e79b7516c5693768657739ab1b6426615312e0dc03ff9c8636f39f35af",+ "frontend-modern/src/features/patrol/PatrolAttentionWorkbench.tsx": "7cbb73c2b4e903ba9bb4c783fada2493189f325f312c23a13f600541520e8a79",+ "frontend-modern/src/features/patrol/PatrolIntelligenceBanners.tsx": "2c5818b026c1976786bf858fddcbbce552217eed4410302db573cbebef3ac944",+ "frontend-modern/src/features/patrol/PatrolIntelligenceWorkspace.tsx": "5d68a4b1e2904bdfb76245bfda24f77bd330424f830952b4d134b1931fba0518"+ },+ "routes": [+ "/alerts/destinations",+ "/patrol",+ "/patrol/activity"+ ],+ "viewports": [+ {+ "width": 1440,+ "height": 900+ },+ {+ "width": 390,+ "height": 844+ }+ ],+ "states": [+ "Private mock stack (backend :7731 built from this clone, Vite :5251 serving this branch, base bffd21f470, after #2578 landed) with Playwright page.clock installed before load; data held by dropping /ws data frames and replaying cached API GETs while a data-free keep-alive frame per fake minute keeps one live socket (no heartbeat reconnect)",+ "Alerts > Destinations external watchdog with an injected healthy status (lastSuccessAt 30s, lastMonitoringProgress 20s before load; the mock has no watchdog): Last success 33s ago and Monitor progress 23s ago read 10 mins ago after 10 held minutes at 1440 and 390; 20 background re-reads of /api/alerts/deadman/status in those 10 minutes, Refresh button untouched",+ "Same page, delivery log with one injected sent email attempt 5 minutes old: the row time tooltip moved 5 mins ago to 15 mins ago",+ "Patrol activity with an injected blocked status (blocked_at 2 minutes before load): 'Blocked 2m ago' read 'Blocked 12m ago' after 10 held minutes",+ "Patrol activity > Finding options and history > History, newest demo run start rewritten to 3 minutes before load: row read 3m ago then 13m ago; selecting it showed 'Patrol run 3m ago' and then 'Patrol run 13m ago' while held",+ "Patrol inbox attention detail with injected acknowledgement, timeline and evidence times (3, 5 and 7 minutes before load): read 13m, 15m and 17m ago after 10 held minutes; 'Last seen' and the flapping window stay read-time by design",+ "Same-session control: with these five runtime files swapped back to origin/main under the running Vite, the watchdog ages, delivery tooltip, Blocked banner, selected-run banner and attention detail ages stayed frozen (one status read, no background re-reads); only the run history row moved, because history re-reads on Patrol's 60-second refresh, so that row is not changed here",+ "No page errors at either viewport"+ ],+ "interactions": [+ "Loaded /alerts/destinations at 1440x900 and 390x844, held the data stream and advanced the page clock ten one-minute steps",+ "Loaded /patrol/activity, opened Finding options and history, opened History, selected the newest run, held and advanced ten minutes",+ "Loaded /patrol, opened the first attention item's detail, held and advanced ten minutes",+ "Repeated every scenario with the pre-change files as the control"+ ]+}diff --git a/frontend-modern/src/features/alerts/AlertDeadManDestinationSection.tsx b/frontend-modern/src/features/alerts/AlertDeadManDestinationSection.tsxindex 83174ca881..b6e5f53ee1 100644--- a/frontend-modern/src/features/alerts/AlertDeadManDestinationSection.tsx+++ b/frontend-modern/src/features/alerts/AlertDeadManDestinationSection.tsx@@ -1,4 +1,4 @@-import { createSignal, createUniqueId, onMount, Show, type Accessor } from 'solid-js';+import { createSignal, createUniqueId, onCleanup, onMount, Show, type Accessor } from 'solid-js';import { AlertsAPI } from '@/api/alerts';import { Button } from '@/components/shared/Button';@@ -6,6 +6,7 @@ import { SettingsPanel } from '@/components/shared/SettingsPanel';import type { DeadManStatus } from '@/types/alerts';import { formatRelativeTime } from '@/utils/format';import { logger } from '@/utils/logger';+import { useRelativeTimeNow } from '@/utils/relativeTimeClock';interface AlertDeadManDestinationSectionProps {pingUrl: Accessor<string>;@@ -14,6 +15,9 @@ interface AlertDeadManDestinationSectionProps {}const REDACTED_PING_URL = '***REDACTED***';+// Pulse pings the watchdog every minute, so a status read once at mount goes+// stale while the panel stays open.+export const DEAD_MAN_STATUS_POLL_MS = 30_000;const statusPresentation: Record<DeadManStatus['state'], { label: string; class: string }> = {disabled: {@@ -54,9 +58,13 @@ export function AlertDeadManDestinationSection(props: AlertDeadManDestinationSecconst [unavailable, setUnavailable] = createSignal(false);const [showUrl, setShowUrl] = createSignal(false);- const loadStatus = async () => {- if (loading()) return;- setLoading(true);+ let backgroundLoad = false;+ const loadStatus = async (options: { background?: boolean } = {}) => {+ if (loading() || backgroundLoad) return;+ // A background re-read leaves the Refresh button alone; a failed one keeps+ // the last status and marks it unavailable.+ if (options.background) backgroundLoad = true;+ else setLoading(true);try {setStatus(await AlertsAPI.getDeadManStatus());setUnavailable(false);@@ -64,11 +72,20 @@ export function AlertDeadManDestinationSection(props: AlertDeadManDestinationSeclogger.error('Failed to load external watchdog status', error);setUnavailable(true);} finally {- setLoading(false);+ if (options.background) backgroundLoad = false;+ else setLoading(false);}};- onMount(() => void loadStatus());+ // Last success and Monitor progress keep aging on the shared clock, and the+ // status is re-read in the background so a moving age never describes a+ // heartbeat that has since been sent.+ const now = useRelativeTimeNow();+ onMount(() => {+ void loadStatus();+ const timer = setInterval(() => void loadStatus({ background: true }), DEAD_MAN_STATUS_POLL_MS);+ onCleanup(() => clearInterval(timer));+ });const presentation = () => {const current = status();@@ -162,7 +179,10 @@ export function AlertDeadManDestinationSection(props: AlertDeadManDestinationSec<div class="font-medium text-muted">Last success</div><div class="mt-1 text-base-content">{current().lastSuccessAt- ? formatRelativeTime(current().lastSuccessAt, { emptyText: 'Never' })+ ? formatRelativeTime(current().lastSuccessAt, {+ emptyText: 'Never',+ now: now(),+ }): 'Never'}</div></div>@@ -170,7 +190,10 @@ export function AlertDeadManDestinationSection(props: AlertDeadManDestinationSec<div class="font-medium text-muted">Monitor progress</div><div class="mt-1 text-base-content">{current().lastMonitoringProgress- ? formatRelativeTime(current().lastMonitoringProgress, { emptyText: 'Waiting' })+ ? formatRelativeTime(current().lastMonitoringProgress, {+ emptyText: 'Waiting',+ now: now(),+ }): 'Waiting'}</div></div>diff --git a/frontend-modern/src/features/alerts/AlertDeliveryLogCard.test.tsx b/frontend-modern/src/features/alerts/AlertDeliveryLogCard.test.tsxindex 4fb6b60f9a..47d20243a8 100644--- a/frontend-modern/src/features/alerts/AlertDeliveryLogCard.test.tsx+++ b/frontend-modern/src/features/alerts/AlertDeliveryLogCard.test.tsx@@ -4,6 +4,7 @@ import { afterEach, describe, expect, it, vi } from 'vitest';import type { NotificationDeliveryLog, Webhook } from '@/api/notifications';import type { AlertEvent } from '@/types/api';+import { RELATIVE_TIME_TICK_MS } from '@/utils/relativeTimeClock';import { AlertDeliveryLogCard, mergeDeliveryLogRows } from './AlertDeliveryLogCard';@@ -437,4 +438,36 @@ describe('AlertDeliveryLogCard', () => {expect(screen.getByRole('status')).toHaveTextContent('Loading delivery attempts...');expect(screen.queryByText(/No alert deliveries were attempted/)).not.toBeInTheDocument();});++ it("keeps each row's age tooltip moving while the log is not refreshed", () => {+ vi.useFakeTimers({+ toFake: ['Date', 'setInterval', 'clearInterval'],+ now: Date.parse('2026-08-27T12:05:00Z'),+ });++ try {+ render(() => (+ <AlertDeliveryLogCard+ log={{+ ...log,+ entries: [{ ...log.entries[1], timestamp: '2026-08-27T12:00:00Z' }],+ }}+ unavailable={false}+ refreshing={false}+ onRefresh={vi.fn()}+ webhooks={webhooks}+ />+ ));+ const time = () => document.querySelector('time[datetime="2026-08-27T12:00:00Z"]');++ expect(time()).toHaveAttribute('title', '5 mins ago');++ // The log is not re-read: the entry never changes and only the clock moves.+ vi.advanceTimersByTime(2 * 60 * 2 * RELATIVE_TIME_TICK_MS);++ expect(time()).toHaveAttribute('title', '2 hours ago');+ } finally {+ vi.useRealTimers();+ }+ });});diff --git a/frontend-modern/src/features/alerts/AlertDeliveryLogCard.tsx b/frontend-modern/src/features/alerts/AlertDeliveryLogCard.tsxindex cb1be99e27..74953bfc06 100644--- a/frontend-modern/src/features/alerts/AlertDeliveryLogCard.tsx+++ b/frontend-modern/src/features/alerts/AlertDeliveryLogCard.tsx@@ -21,6 +21,7 @@ import {getAlertDestinationsDeliveryRefreshLabel,} from '@/utils/alertDestinationsPresentation';import { formatRelativeTime } from '@/utils/format';+import { useRelativeTimeNow } from '@/utils/relativeTimeClock';import { describeAlertEventReason } from './deliveryDiagnosisPresentation';@@ -76,6 +77,9 @@ const outcomeBadgeClasses: Record<NotificationDeliveryLogEntry['outcome'], strin};export function AlertDeliveryLogCard(props: AlertDeliveryLogCardProps) {+ // Log rows stay mounted between refreshes and their times never change, so+ // the age in each row's tooltip reads the shared clock.+ const now = useRelativeTimeNow();// Destination ids are opaque on purpose (hashes for email/apprise, config// ids for webhooks); only webhook ids can be resolved to a configured name.const destinationLabel = (entry: NotificationDeliveryLogEntry): string => {@@ -215,7 +219,7 @@ export function AlertDeliveryLogCard(props: AlertDeliveryLogCardProps) {<timeclass="ml-auto shrink-0 text-xs text-gray-500 dark:text-gray-400"dateTime={row.entry.timestamp}- title={formatRelativeTime(row.entry.timestamp)}+ title={formatRelativeTime(row.entry.timestamp, { now: now() })}>{absoluteTimestamp(row.entry.timestamp)}</time>@@ -259,7 +263,7 @@ export function AlertDeliveryLogCard(props: AlertDeliveryLogCardProps) {<timeclass="ml-auto shrink-0 text-xs text-gray-500 dark:text-gray-400"dateTime={row.event.occurredAt}- title={formatRelativeTime(row.event.occurredAt)}+ title={formatRelativeTime(row.event.occurredAt, { now: now() })}>{absoluteTimestamp(row.event.occurredAt)}</time>diff --git a/frontend-modern/src/features/alerts/__tests__/AlertDeadManDestinationSection.test.tsx b/frontend-modern/src/features/alerts/__tests__/AlertDeadManDestinationSection.test.tsxindex 7b06fb4601..17ba5f8165 100644--- a/frontend-modern/src/features/alerts/__tests__/AlertDeadManDestinationSection.test.tsx+++ b/frontend-modern/src/features/alerts/__tests__/AlertDeadManDestinationSection.test.tsx@@ -4,7 +4,10 @@ import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';import { AlertsAPI } from '@/api/alerts';-import { AlertDeadManDestinationSection } from '../AlertDeadManDestinationSection';+import {+ AlertDeadManDestinationSection,+ DEAD_MAN_STATUS_POLL_MS,+} from '../AlertDeadManDestinationSection';vi.mock('@/api/alerts', () => ({AlertsAPI: {@@ -113,4 +116,42 @@ describe('AlertDeadManDestinationSection', () => {screen.getByText('Saved external watchdog configuration could not be read'),).toBeInTheDocument();});++ it('keeps Last success aging and re-reads the status while the panel stays open', async () => {+ const start = Date.parse('2026-08-27T12:00:30Z');+ vi.useFakeTimers({ toFake: ['Date', 'setInterval', 'clearInterval'], now: start });+ const [pingUrl, setPingUrl] = createSignal('***REDACTED***');++ try {+ render(() => (+ <AlertDeadManDestinationSection+ pingUrl={pingUrl}+ setPingUrl={setPingUrl}+ setHasUnsavedChanges={vi.fn()}+ />+ ));+ const lastSuccess = () => screen.getByText('Last success').nextElementSibling;+ await waitFor(() => expect(lastSuccess()).toHaveTextContent('30s ago'));+ expect(AlertsAPI.getDeadManStatus).toHaveBeenCalledTimes(1);++ // The watchdog stops being reached: every background re-read returns the+ // same last success, and its age keeps moving on the clock.+ for (let poll = 2; poll <= 5; poll += 1) {+ vi.advanceTimersByTime(DEAD_MAN_STATUS_POLL_MS);+ await waitFor(() => expect(AlertsAPI.getDeadManStatus).toHaveBeenCalledTimes(poll));+ }+ expect(lastSuccess()).toHaveTextContent('2 mins ago');+ expect(screen.getByRole('button', { name: 'Refresh' })).not.toBeDisabled();++ // A later heartbeat lands: the next background re-read picks it up.+ vi.mocked(AlertsAPI.getDeadManStatus).mockResolvedValue({+ ...(await AlertsAPI.getDeadManStatus()),+ lastSuccessAt: '2026-08-27T12:02:30Z',+ });+ vi.advanceTimersByTime(DEAD_MAN_STATUS_POLL_MS);+ await waitFor(() => expect(lastSuccess()).toHaveTextContent('30s ago'));+ } finally {+ vi.useRealTimers();+ }+ });});diff --git a/frontend-modern/src/features/patrol/PatrolAttentionWorkbench.tsx b/frontend-modern/src/features/patrol/PatrolAttentionWorkbench.tsxindex 76bbcbe03d..15fb0c12c1 100644--- a/frontend-modern/src/features/patrol/PatrolAttentionWorkbench.tsx+++ b/frontend-modern/src/features/patrol/PatrolAttentionWorkbench.tsx@@ -64,6 +64,7 @@ import type { EvidenceEnvelope } from '@/types/operationalTrust';import type { ActionDetailResponse } from '@/types/actionAudit';import { getAlertResourceIncidentAcknowledgedByLabel } from '@/utils/alertIncidentPresentation';import { formatRelativeTime } from '@/utils/format';+import { useRelativeTimeNow } from '@/utils/relativeTimeClock';import { copyToClipboard } from '@/utils/clipboard';import type { PatrolAutonomyLevel } from '@/api/patrol';import {@@ -1249,6 +1250,9 @@ function AttentionLifecycleControls(props: {onSuppress: (itemId: string, reason: string, expiresAt: string) => Promise<void>;onUnsuppress: (itemId: string) => Promise<void>;}) {+ // The acknowledgement time never changes while the detail stays open, so its+ // age reads the shared clock.+ const now = useRelativeTimeNow();const [showSuppression, setShowSuppression] = createSignal(false);const [reason, setReason] = createSignal('');const [durationMs, setDurationMs] = createSignal<number>(SUPPRESSION_DURATIONS[1].value);@@ -1276,7 +1280,7 @@ function AttentionLifecycleControls(props: {{(acknowledgement) => (<p class="mb-2 text-xs leading-5 text-muted">{getAlertResourceIncidentAcknowledgedByLabel(acknowledgement().by)}{' '}- {formatRelativeTime(acknowledgement().at, { compact: true })}.+ {formatRelativeTime(acknowledgement().at, { compact: true, now: now() })}.</p>)}</Show>@@ -1415,6 +1419,9 @@ function AttentionLifecycleControls(props: {}function AttentionTimelineList(props: { timeline: AttentionItemDetail['timeline'] }) {+ // The open detail is read once per selection and its transitions never+ // change, so their ages read the shared clock.+ const now = useRelativeTimeNow();return (<ol class="space-y-3"><For each={props.timeline}>@@ -1424,7 +1431,7 @@ function AttentionTimelineList(props: { timeline: AttentionItemDetail['timeline'{formatLabel(transition.from)} to {formatLabel(transition.to)}</p><p class="mt-0.5 text-[11px] text-muted">- {formatRelativeTime(transition.at, { compact: true })} ·{' '}+ {formatRelativeTime(transition.at, { compact: true, now: now() })} ·{' '}{formatLabel(transition.cause)}</p><Show when={transition.reason}>@@ -1748,6 +1755,9 @@ function DetailSection(props: { title: string; children: import('solid-js').JSX.}function EvidenceObservation(props: { evidence: EvidenceEnvelope }) {+ // An evidence record's observation time is fixed, so its age reads the+ // shared clock while the detail stays open.+ const now = useRelativeTimeNow();return (<li class="rounded-md border border-border-subtle p-3"><div class="flex flex-wrap items-center gap-2">@@ -1771,7 +1781,7 @@ function EvidenceObservation(props: { evidence: EvidenceEnvelope }) {</div><p class="mt-1 text-xs text-muted">{props.evidence.source.collector} · observed{' '}- {formatRelativeTime(props.evidence.observedAt, { compact: true })}+ {formatRelativeTime(props.evidence.observedAt, { compact: true, now: now() })}</p><Show when={props.evidence.reason?.message}>{(reason) => <p class="mt-1 text-xs leading-5 text-muted">{reason()}</p>}diff --git a/frontend-modern/src/features/patrol/PatrolIntelligenceBanners.tsx b/frontend-modern/src/features/patrol/PatrolIntelligenceBanners.tsxindex 059d311f05..d491135fb1 100644--- a/frontend-modern/src/features/patrol/PatrolIntelligenceBanners.tsx+++ b/frontend-modern/src/features/patrol/PatrolIntelligenceBanners.tsx@@ -11,6 +11,7 @@ import {presentationPolicyHidesUpgradePrompts,} from '@/stores/sessionPresentationPolicy';import { formatRelativeTime } from '@/utils/format';+import { useRelativeTimeNow } from '@/utils/relativeTimeClock';import { getAIProviderDisplayName } from '@/utils/aiProviderPresentation';import { getPatrolSetupAction } from '@/utils/patrolRuntimeActions';import { getPatrolAutonomyAvailabilityPresentation } from './patrolAutonomyAvailability';@@ -30,6 +31,9 @@ function modelIdWithoutProviderPrefix(modelId: string | undefined): string {export function PatrolIntelligenceBanners(props: { state: PatrolIntelligenceState }) {const state = props.state;+ // Patrol status re-reads keep the same blocked time while Patrol stays+ // paused, so the Blocked age reads the shared clock.+ const now = useRelativeTimeNow();const setupAction = createMemo(() =>getPatrolSetupAction(resolvePatrolBlockedActionCause(state.blockedCause(), state.patrolReadiness()?.cause),@@ -267,7 +271,7 @@ export function PatrolIntelligenceBanners(props: { state: PatrolIntelligenceStat<p class="text-xs text-amber-700 dark:text-amber-300">{state.blockedReason()}</p><Show when={state.blockedAt()}><p class="text-[10px] text-amber-700 dark:text-amber-300">- Blocked {formatRelativeTime(state.blockedAt(), { compact: true })}+ Blocked {formatRelativeTime(state.blockedAt(), { compact: true, now: now() })}</p></Show></div>diff --git a/frontend-modern/src/features/patrol/PatrolIntelligenceWorkspace.tsx b/frontend-modern/src/features/patrol/PatrolIntelligenceWorkspace.tsxindex 1bd38e07c6..b3c70a6068 100644--- a/frontend-modern/src/features/patrol/PatrolIntelligenceWorkspace.tsx+++ b/frontend-modern/src/features/patrol/PatrolIntelligenceWorkspace.tsx@@ -12,6 +12,7 @@ import {isPatrolRuntimeFinding,} from '@/utils/aiFindingPresentation';import { formatRelativeTime } from '@/utils/format';+import { useRelativeTimeNow } from '@/utils/relativeTimeClock';import { formatTriggerReason } from '@/utils/patrolFormat';import {getPatrolRunRecordSummaryPresentation,@@ -51,6 +52,9 @@ export function PatrolIntelligenceWorkspace(props: {findingResourceId?: string;}) {const state = props.state;+ // The selected run stays as picked when run history is re-read, so its start+ // age reads the shared clock instead of freezing at selection.+ const now = useRelativeTimeNow();const queueDisplayGroups = createMemo(() =>buildPatrolFindingDisplayGroups(state.findingsTabBadgeFindings()),);@@ -207,7 +211,7 @@ export function PatrolIntelligenceWorkspace(props: {<div class="min-w-0 space-y-1"><div class="flex flex-wrap items-center gap-2 text-xs"><span class="font-semibold text-blue-950 dark:text-blue-100">- Patrol run {formatRelativeTime(run().started_at, { compact: true })}+ Patrol run {formatRelativeTime(run().started_at, { compact: true, now: now() })}</span><span>{formatTriggerReason(run().trigger_reason)}</span><Show when={selectedRunStatus()}>diff --git a/frontend-modern/src/features/patrol/__tests__/PatrolAttentionWorkbench.test.tsx b/frontend-modern/src/features/patrol/__tests__/PatrolAttentionWorkbench.test.tsxindex 3c5ff2b423..d0b5ac3b27 100644--- a/frontend-modern/src/features/patrol/__tests__/PatrolAttentionWorkbench.test.tsx+++ b/frontend-modern/src/features/patrol/__tests__/PatrolAttentionWorkbench.test.tsx@@ -7,6 +7,7 @@ import type {AttentionListResponse,AttentionSummary,} from '@/api/patrolAttention';+import { RELATIVE_TIME_TICK_MS } from '@/utils/relativeTimeClock';const apiMocks = vi.hoisted(() => ({getList: vi.fn(),@@ -479,6 +480,45 @@ describe('PatrolAttentionWorkbench', () => {expect(window.location.search).toBe('?attention=record-1');});+ it('keeps the open detail transition, evidence and acknowledgement ages moving', async () => {+ vi.useFakeTimers({+ toFake: ['Date', 'setInterval', 'clearInterval'],+ now: Date.parse('2026-07-19T08:10:00Z'),+ });+ const active = item({ state: 'acknowledged' });+ const opened = detail(active);+ opened.timeline[0].at = '2026-07-19T08:03:00Z';+ opened.evidence[0].observedAt = '2026-07-19T08:05:00Z';+ opened.operationalRecord.acknowledgement = { by: 'admin', at: '2026-07-19T08:07:00Z' };+ apiMocks.getList.mockResolvedValue(+ listResponse([active], summary({ activeCount: 1, acknowledgedCount: 1, calm: false })),+ );+ apiMocks.getDetail.mockResolvedValue(opened);++ try {+ renderWorkbench();+ fireEvent.click(+ await screen.findByRole('button', { name: 'Open Database VM · Disk pressure' }),+ );+ const detailRegion = await screen.findByRole('complementary', {+ name: 'Database VM · Disk pressure',+ });+ await waitFor(() => expect(detailRegion).toHaveTextContent('7m ago'));+ expect(detailRegion).toHaveTextContent('5m ago');+ expect(detailRegion).toHaveTextContent('3m ago');++ // The detail is not re-read: its records never change and only the+ // clock moves.+ vi.advanceTimersByTime(2 * 60 * 2 * RELATIVE_TIME_TICK_MS);++ expect(detailRegion).not.toHaveTextContent(/[357]m ago/);+ expect(detailRegion.textContent?.match(/2h ago/g)?.length).toBeGreaterThanOrEqual(3);+ expect(apiMocks.getDetail).toHaveBeenCalledTimes(1);+ } finally {+ vi.useRealTimers();+ }+ });+it('keeps the detail header and queue controls pinned while a long decision scrolls', async () => {const active = item();apiMocks.getList.mockResolvedValue(diff --git a/frontend-modern/src/features/patrol/__tests__/PatrolRunBanners.relativeAge.test.tsx b/frontend-modern/src/features/patrol/__tests__/PatrolRunBanners.relativeAge.test.tsxnew file mode 100644index 0000000000..bb50875020--- /dev/null+++ b/frontend-modern/src/features/patrol/__tests__/PatrolRunBanners.relativeAge.test.tsx@@ -0,0 +1,96 @@+import { cleanup, render, screen } from '@solidjs/testing-library';+import { afterEach, describe, expect, it, vi } from 'vitest';++import type { PatrolRunRecord } from '@/api/patrol';+import { RELATIVE_TIME_TICK_MS } from '@/utils/relativeTimeClock';+import { PatrolIntelligenceBanners } from '../PatrolIntelligenceBanners';+import { PatrolIntelligenceWorkspace } from '../PatrolIntelligenceWorkspace';+import type { PatrolIntelligenceState } from '../usePatrolIntelligenceState';++vi.mock('@/components/AI/FindingsPanel', () => ({+ FindingsPanel: () => <div data-testid="findings-panel" />,+}));++vi.mock('@/components/patrol/RunHistoryPanel', () => ({+ RunHistoryPanel: () => <div data-testid="run-history-panel" />,+}));++// Both surfaces read many accessors; the ones a test does not set answer+// with nothing, and list-valued ones with an empty list.+const LIST_ACCESSORS = new Set([+ 'findingsTabBadgeFindings',+ 'displayRunHistory',+ 'selectedRunFindingIds',+ 'selectedRunScopeResourceIds',+]);+const stubState = (overrides: Record<string, unknown>): PatrolIntelligenceState =>+ new Proxy(overrides, {+ get(target, key: string) {+ if (key in target) return target[key];+ if (key === 'patrolStream') {+ return new Proxy({}, { get: () => () => undefined });+ }+ if (key === 'patrolRunHistory') return { value: () => [], refetch: vi.fn() };+ return LIST_ACCESSORS.has(key) ? () => [] : () => undefined;+ },+ }) as unknown as PatrolIntelligenceState;++afterEach(() => {+ cleanup();+ vi.useRealTimers();+});++describe('Patrol run and pause banners relative ages', () => {+ it('keeps the Patrol paused Blocked age moving while Patrol stays paused', () => {+ vi.useFakeTimers({+ toFake: ['Date', 'setInterval', 'clearInterval'],+ now: Date.parse('2026-07-19T08:05:00Z'),+ });++ render(() => (+ <PatrolIntelligenceBanners+ state={stubState({+ showBlockedBanner: () => true,+ blockedReason: () => 'The monthly AI budget is used up.',+ blockedAt: () => '2026-07-19T08:00:00Z',+ })}+ />+ ));++ expect(screen.getByText('Blocked 5m ago')).toBeInTheDocument();++ // Each status re-read returns the same blocked time: only the clock moves.+ vi.advanceTimersByTime(3 * 60 * 2 * RELATIVE_TIME_TICK_MS);++ expect(screen.getByText('Blocked 3h ago')).toBeInTheDocument();+ });++ it('keeps the selected Patrol run start age moving while the run stays selected', () => {+ vi.useFakeTimers({+ toFake: ['Date', 'setInterval', 'clearInterval'],+ now: Date.parse('2026-07-19T08:05:00Z'),+ });+ const run = {+ id: 'run-1',+ started_at: '2026-07-19T08:00:00Z',+ trigger_reason: 'scheduled',+ status: 'healthy',+ finding_ids: [],+ } as unknown as PatrolRunRecord;++ render(() => (+ <PatrolIntelligenceWorkspace+ state={stubState({+ activeTab: () => 'findings',+ selectedRun: () => run,+ })}+ />+ ));++ expect(screen.getByText('Patrol run 5m ago')).toBeInTheDocument();++ vi.advanceTimersByTime(3 * 60 * 2 * RELATIVE_TIME_TICK_MS);++ expect(screen.getByText('Patrol run 3h ago')).toBeInTheDocument();+ });+});