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
Stabilize infrastructure realtime identity
rcourtmana6c460daa0d8
diff --git a/docs/release-control/v6/internal/status.json b/docs/release-control/v6/internal/status.jsonindex f3edcefbed..d799d491ed 100644--- a/docs/release-control/v6/internal/status.json+++ b/docs/release-control/v6/internal/status.json@@ -2359,22 +2359,34 @@},{"id": "RA26",- "summary": "Infrastructure Settings is a release-critical configuration surface: it must remain a first-class source-management workspace whose first viewport makes adding, discovering, installing agents, and verifying API plus Pulse Agent coverage clear, with stable source grouping, source/member status separation, and browser-verified layout before release-ready claims.",+ "summary": "Infrastructure Settings and Infrastructure realtime identity are release-critical configuration surfaces: they must keep adding, discovering, installing agents, verifying API plus Pulse Agent coverage, cold-start ledger hydration, source grouping, source/member status separation, non-replayed setup success notifications, and websocket plus REST resource identity stable before release-ready claims.","kind": "journey","blocking_level": "release-ready","proof_type": "hybrid","lane_ids": [+ "L6","L8","L16"],"subsystem_ids": ["agent-lifecycle",+ "api-contracts","frontend-primitives"],"release_gate_ids": ["settings-surface-layout-consistency"],"proof_commands": [+ {+ "id": "infrastructure-realtime-broadcast-contract-tests",+ "run": [+ "go",+ "test",+ "./internal/monitoring",+ "-run",+ "TestBroadcastResourceProjectionCoalescesSplitHostIdentities|TestConvertResourcesForBroadcastCoalescesSplitHostResources"+ ]+ },{"id": "infrastructure-settings-workspace-tests","run": [@@ -2383,6 +2395,9 @@"frontend-modern","test","--",+ "src/utils/__tests__/resourceStateAdapters.test.ts",+ "src/stores/__tests__/websocket-unified.test.ts",+ "src/stores/__tests__/websocket-resilience.test.ts","src/components/Settings/__tests__/ConnectionsTable.test.tsx","src/components/Settings/__tests__/connectionsTableModel.test.ts","src/components/Settings/__tests__/InfrastructureSourceManager.test.tsx",@@ -2391,6 +2406,16 @@"src/components/Settings/__tests__/settingsArchitecture.test.ts","src/utils/__tests__/discoveryPresentation.test.ts"]+ },+ {+ "id": "infrastructure-state-resource-contract-tests",+ "run": [+ "go",+ "test",+ "./internal/api",+ "-run",+ "TestContract_StateAndResourceListShareCanonicalMockResourceContract|TestBuildAutoRegisterEventDataUsesCanonicalAutoRegisterTokenIdentity|TestContract_AutoRegisterWebSocketEventJSONSnapshot|TestContract_CanonicalAutoRegisterEventJSONSnapshot|TestAutoRegisterWebSocketEventTypeDistinguishesCreatedFromExistingRefresh"+ ]}],"evidence": [@@ -2453,6 +2478,56 @@"repo": "pulse","path": "frontend-modern/src/components/Settings/useConnectionsLedger.ts","kind": "file"+ },+ {+ "repo": "pulse",+ "path": "frontend-modern/src/stores/__tests__/websocket-resilience.test.ts",+ "kind": "file"+ },+ {+ "repo": "pulse",+ "path": "frontend-modern/src/stores/__tests__/websocket-unified.test.ts",+ "kind": "file"+ },+ {+ "repo": "pulse",+ "path": "frontend-modern/src/utils/__tests__/resourceStateAdapters.test.ts",+ "kind": "file"+ },+ {+ "repo": "pulse",+ "path": "frontend-modern/src/utils/resourceStateAdapters.ts",+ "kind": "file"+ },+ {+ "repo": "pulse",+ "path": "internal/api/config_handlers_canonical_auto_register_test.go",+ "kind": "file"+ },+ {+ "repo": "pulse",+ "path": "internal/api/config_setup_handlers.go",+ "kind": "file"+ },+ {+ "repo": "pulse",+ "path": "internal/api/contract_test.go",+ "kind": "file"+ },+ {+ "repo": "pulse",+ "path": "internal/monitoring/canonical_guardrails_test.go",+ "kind": "file"+ },+ {+ "repo": "pulse",+ "path": "internal/monitoring/monitor.go",+ "kind": "file"+ },+ {+ "repo": "pulse",+ "path": "internal/monitoring/monitor_unified_state_test.go",+ "kind": "file"}]},diff --git a/docs/release-control/v6/internal/subsystems/agent-lifecycle.md b/docs/release-control/v6/internal/subsystems/agent-lifecycle.mdindex abbb8bcb38..9cb47e27f3 100644--- a/docs/release-control/v6/internal/subsystems/agent-lifecycle.md+++ b/docs/release-control/v6/internal/subsystems/agent-lifecycle.md@@ -280,7 +280,11 @@ profile and assignment columns, but embedded table framing must route throughtimestamped lifecycle event rather than durable infrastructure state:fresh first-time events may show one success toast, but replayed, stale, orduplicate events must refresh configuration silently so an old registration- cannot present as a newly connected node.+ cannot present as a newly connected node. The event payload must preserve+ the canonical registration `source`; script-initiated first-time+ registrations are the only source that may display the operator-facing+ success toast, while background agent registrations must update the ledger+ without claiming the operator just added that node.Shared `internal/api/` session and auth changes consumed by lifecycleroutes must preserve durable principal IDs as the authorization key. Agentlifecycle surfaces may display contact email when supplied by the shareddiff --git a/docs/release-control/v6/internal/subsystems/api-contracts.md b/docs/release-control/v6/internal/subsystems/api-contracts.mdindex 83e28889ae..4eb260880e 100644--- a/docs/release-control/v6/internal/subsystems/api-contracts.md+++ b/docs/release-control/v6/internal/subsystems/api-contracts.md@@ -258,6 +258,9 @@ checks, merge tenants, or become the source of truth for telemetry freshness.`node_auto_registered`, but successful idempotent matches or credentialrefreshes for an already configured node must use a non-toast config-changeevent such as `nodes_changed` instead of re-announcing first registration.+ The event payload must carry the canonical `source` field so browser+ consumers can distinguish script-initiated operator handoffs from+ background agent lifecycle churn.That same shared setup contract also owns teardown symmetry for script-managed Proxmox nodes: `/api/auto-unregister` must accept the canonical `type`, normalized `host`, explicit `serverName`, optional canonical `tokenId`, request-body `authToken`, and `source:"script"` payload, and it must answer the same canonical success envelope on both real removals and idempotent no-op reruns so browser/runtime callers do not invent a second uninstall vocabulary.That same setup-script payload contract owns the Proxmox permission shapefor generated scripts, runtime-side host-agent setup, and installer@@ -521,6 +524,11 @@ the canonical monitored-system blocked payload.instead of rebuilding capability or topology context from the list response.7. Route unified-resource list ordering through `internal/api/resources.go`, `internal/api/contract_test.go`, and the owned unified-resource registry helpers together; list payloads must stay deterministic for equal-name resources by carrying one canonical `name -> type -> id` tie-break across cold seed, REST pagination, and websocket-backed refreshes instead of inheriting map order or page-local re-sortsThat same shared API contract also owns the external resource `type`, canonical display name, and cluster identity published through `/api/resources` and `/api/state`; the websocket/state hydrate path must not emit legacy aliases or raw store labels once the unified resource contract has normalized them.+ Realtime `/api/state` and websocket `resources` snapshots must also collapse+ transient split host identities before broadcast: a Proxmox-node row and a+ host-agent row for the same machine must leave the API boundary as one+ hybrid `agent` resource with merged source facets, not as duplicate rows+ that disappear only after REST reconciliation.8. Route unified-agent installer and binary download headers through `internal/api/unified_agent.go` and `internal/api/contract_test.go` together; published release downloads must keep the canonical `X-Checksum-Sha256` plus `X-Signature-Ed25519` contract for updater clients and the base64-encoded `X-Signature-SSHSIG` contract for installer clients whether the asset is served locally or proxied from the matching GitHub release, instead of leaving callers to infer trust from source location alone.9. Route canonical AI intelligence summary and resource-intelligence reads through `frontend-modern/src/api/ai.ts`, `frontend-modern/src/stores/aiIntelligence.ts`, `frontend-modern/src/stores/aiIntelligenceSummaryModel.ts`, `frontend-modern/src/features/patrol/usePatrolIntelligenceState.ts`, `frontend-modern/src/features/patrol/PatrolIntelligenceSurface.tsx`, the Patrol-owned section files under `frontend-modern/src/features/patrol/`, `frontend-modern/src/pages/AIIntelligence.tsx`, `internal/api/ai_handlers.go`, and `internal/api/contract_test.go` together so the summary card, store normalization owner, runtime hook, feature shell, section owners, route shell, and backend payload stay aligned on one governed surface, including the canonical recent-changes slicewhile keeping the learning counters backend-only coverage, so the summary page keeps Patrol health and findings primary and renders timeline, correlation, and policy-posture data as secondary investigation context rather than as a separate headline product metricdiff --git a/docs/release-control/v6/internal/subsystems/frontend-primitives.md b/docs/release-control/v6/internal/subsystems/frontend-primitives.mdindex ab602f9d05..c8bf557df5 100644--- a/docs/release-control/v6/internal/subsystems/frontend-primitives.md+++ b/docs/release-control/v6/internal/subsystems/frontend-primitives.md@@ -1740,7 +1740,14 @@ The infrastructure feature state owner may opt into websocket-first unifiedresource hydration only when it also schedules canonical REST revalidationafter the first-paint settle window; shared route composition must not re-routethe table through a blocking resource fetch just to confirm infrastructure that-the realtime store has already reported.+the realtime store has already reported. Authenticated cold starts must render+from retained realtime or unified-resource state without falling back to+first-run/welcome posture or replaying stale setup success notifications, and+background revalidation may update rows in place but may not blank the page.+Realtime resource adapters must defensively coalesce split host identities by+the same source-bridge rule as the API boundary so a transient backend rebuild+cannot surface duplicate infrastructure rows while the next canonical REST+snapshot is settling.Infrastructure summary and detail surfaces now also use the shared normalizedidentity lookup helper from `frontend-modern/src/utils/resourceIdentity.ts`so dotted hostnames and alias variants stay consistent between the shareddiff --git a/docs/release-control/v6/internal/subsystems/monitoring.md b/docs/release-control/v6/internal/subsystems/monitoring.mdindex aa791ad2a6..30e4301f1a 100644--- a/docs/release-control/v6/internal/subsystems/monitoring.md+++ b/docs/release-control/v6/internal/subsystems/monitoring.md@@ -86,6 +86,11 @@ truth for live infrastructure data.Failed endpoint probes are observed runtime state for that target; theymust publish provider health and incidents without dead-lettering thescheduler task itself.+13. Add or change broadcast resource projection through+ `internal/monitoring/monitor.go` and monitoring guardrails together.+ `/api/state` and websocket broadcasts must coalesce transient split host+ resources before serialization so a single Proxmox node with a reporting+ host agent remains one hybrid top-level system across rebuild ticks.## Forbidden Pathsdiff --git a/docs/release-control/v6/internal/subsystems/storage-recovery.md b/docs/release-control/v6/internal/subsystems/storage-recovery.mdindex 7540a62039..29e097acce 100644--- a/docs/release-control/v6/internal/subsystems/storage-recovery.md+++ b/docs/release-control/v6/internal/subsystems/storage-recovery.md@@ -429,7 +429,9 @@ bypass the API fail-closed execution gate.`node_auto_registered` WebSocket event, while idempotent existing-noderefreshes must stay on non-toast configuration-change events so adjacentstorage/recovery transport does not infer a second protected-system- admission from a credential refresh.+ admission from a credential refresh. The event data must preserve the+ canonical registration `source` so script-created and agent-created+ lifecycle events remain distinguishable without re-reading setup state.That same adjacent transport boundary must also preserve disabledprovider-connection admission truth. Storage- and recovery-adjacent setupsurfaces may reflect zero-delta or removal-only monitored-system previewsdiff --git a/docs/release-control/v6/internal/subsystems/unified-resources.md b/docs/release-control/v6/internal/subsystems/unified-resources.mdindex dcb4e3d88b..df8d054ad9 100644--- a/docs/release-control/v6/internal/subsystems/unified-resources.md+++ b/docs/release-control/v6/internal/subsystems/unified-resources.md@@ -209,6 +209,11 @@ cross-source deduplication.provider facets from generic agent telemetry: flat agent disk payloads stayunder the agent source and do not become Proxmox facets without explicitProxmox source, node, or workload-shape evidence.+ Realtime resource adapters must also apply the canonical host source-bridge+ rule to incoming websocket snapshots: agent plus platform/API evidence for+ the same host coalesces into one hybrid infrastructure resource, while+ same-name agent-only records remain separate until stronger identity or+ platform evidence exists.Resource detail mappers now reuse the shared`frontend-modern/src/utils/textPresentation.ts` title-case helper for sensordiff --git a/frontend-modern/src/components/Settings/__tests__/ConnectionsTable.test.tsx b/frontend-modern/src/components/Settings/__tests__/ConnectionsTable.test.tsxindex c7ecae5fd1..36de210a2d 100644--- a/frontend-modern/src/components/Settings/__tests__/ConnectionsTable.test.tsx+++ b/frontend-modern/src/components/Settings/__tests__/ConnectionsTable.test.tsx@@ -254,6 +254,9 @@ describe('ConnectionsTable', () => {);expect(screen.queryByText('Config pending')).toBeNull();expect(screen.queryByText('Rollout pending')).toBeNull();+ expect(+ screen.queryByText(/applied agent configuration fingerprint/i),+ ).not.toBeInTheDocument();});it('keeps large row sets bounded behind an explicit show-more path', () => {diff --git a/frontend-modern/src/components/Settings/__tests__/connectionsTableModel.test.ts b/frontend-modern/src/components/Settings/__tests__/connectionsTableModel.test.tsindex 6e57d5df67..bd9ed2b955 100644--- a/frontend-modern/src/components/Settings/__tests__/connectionsTableModel.test.ts+++ b/frontend-modern/src/components/Settings/__tests__/connectionsTableModel.test.ts@@ -38,7 +38,8 @@ describe('visibleFleetGovernanceSignals', () => {remoteControl: 'disabled',configDrift: {status: 'pending',- reason: 'Pulse has not received a comparable applied agent configuration fingerprint yet',+ reason:+ 'Pulse has not received a comparable applied agent configuration fingerprint yet',},rollout: {status: 'pending',@@ -146,4 +147,40 @@ describe('visibleFleetGovernanceSignals', () => {},]);});++ it('hides rollout fallback copy when a passive config confirmation marks the handshake', () => {+ const rawSignals = fleetGovernanceSignalsForConnection(+ connectionFixture({+ fleet: {+ enrollmentState: 'enrolled',+ livenessState: 'active',+ versionDrift: 'current',+ adapterHealth: 'healthy',+ configRollout: 'reported',+ credentialStatus: 'verified',+ updateStatus: 'current',+ remoteControl: 'disabled',+ configDrift: {+ status: 'pending',+ reason:+ 'Pulse has not received a comparable applied agent configuration fingerprint yet',+ },+ rollout: {+ status: 'pending',+ },+ credentialHealth: { status: 'verified', kind: 'agent-token' },+ commandPolicy: {+ status: 'disabled',+ desired: 'unknown',+ applied: 'disabled',+ enforcement: 'not-applicable',+ },+ },+ }),+ );++ expect(visibleFleetGovernanceSignals(rawSignals).map((signal) => signal.label)).toEqual([+ 'Remote control disabled',+ ]);+ });});diff --git a/frontend-modern/src/components/Settings/connectionsTableModel.ts b/frontend-modern/src/components/Settings/connectionsTableModel.tsindex 3d248545d5..894bccdc98 100644--- a/frontend-modern/src/components/Settings/connectionsTableModel.ts+++ b/frontend-modern/src/components/Settings/connectionsTableModel.ts@@ -843,7 +843,12 @@ export const fleetGovernanceSignalsForConnection = (export const visibleFleetGovernanceSignals = (signals: readonly FleetGovernanceSignal[],): FleetGovernanceSignal[] => {- const visibleSignals = signals.filter((signal) => !isPassiveAgentConfigConfirmationSignal(signal));+ const hasPassiveAgentConfigConfirmation = signals.some(isPassiveAgentConfigConfirmationSignal);+ const visibleSignals = signals.filter(+ (signal) =>+ !isPassiveAgentConfigConfirmationSignal(signal) &&+ !isPassiveAgentRolloutConfirmationFallbackSignal(signal, hasPassiveAgentConfigConfirmation),+ );const attention = visibleSignals.filter((signal) => signal.tone === 'critical' || signal.tone === 'warning',);@@ -874,6 +879,22 @@ const isPassiveAgentConfigConfirmationSignal = (signal: FleetGovernanceSignal):);};+const isPassiveAgentRolloutConfirmationFallbackSignal = (+ signal: FleetGovernanceSignal,+ hasPassiveAgentConfigConfirmation: boolean,+): boolean => {+ if (!hasPassiveAgentConfigConfirmation) return false;+ if (signal.tone !== 'warning' || signal.key !== 'rollout') return false;++ const detail = signal.detail.toLowerCase();+ return (+ detail.includes('staged rollout is waiting for confirmation') ||+ detail.includes(+ 'rollout state cannot be confirmed without comparable desired and applied agent config fingerprints',+ )+ );+};+export interface InfrastructureSystemMemberRow {id: string;name: string;diff --git a/frontend-modern/src/stores/__tests__/websocket-resilience.test.ts b/frontend-modern/src/stores/__tests__/websocket-resilience.test.tsindex e4d475c71b..b8b0c0a0c8 100644--- a/frontend-modern/src/stores/__tests__/websocket-resilience.test.ts+++ b/frontend-modern/src/stores/__tests__/websocket-resilience.test.ts@@ -192,6 +192,7 @@ describe('websocket store resilience', () => {timestamp: '2026-05-14T08:00:00.000Z',data: {type: 'pve',+ source: 'script',host: 'https://minipc:8006',name: 'minipc',nodeId: 'minipc',@@ -239,4 +240,60 @@ describe('websocket store resilience', () => {dispose();}});++ it('suppresses auto-registration notifications that predate the websocket session', async () => {+ const { dispose } = await createStoreHarness();+ try {+ vi.advanceTimersByTime(1);+ expect(currentInstance).not.toBeNull();++ currentInstance!.onmessage?.({+ data: JSON.stringify({+ type: 'node_auto_registered',+ timestamp: '2026-05-14T07:59:30.000Z',+ data: {+ type: 'pve',+ source: 'script',+ host: 'https://minipc:8006',+ name: 'minipc',+ nodeId: 'minipc',+ tokenId: 'pulse-monitor@pve!pulse-minipc',+ hasToken: true,+ },+ }),+ } as MessageEvent);++ expect(notificationMocks.success).not.toHaveBeenCalled();+ } finally {+ dispose();+ }+ });++ it('suppresses background agent auto-registration success notifications', async () => {+ const { dispose } = await createStoreHarness();+ try {+ vi.advanceTimersByTime(1);+ expect(currentInstance).not.toBeNull();++ currentInstance!.onmessage?.({+ data: JSON.stringify({+ type: 'node_auto_registered',+ timestamp: '2026-05-14T08:00:00.000Z',+ data: {+ type: 'pve',+ source: 'agent',+ host: 'https://minipc:8006',+ name: 'minipc',+ nodeId: 'minipc',+ tokenId: 'pulse-monitor@pve!pulse-minipc',+ hasToken: true,+ },+ }),+ } as MessageEvent);++ expect(notificationMocks.success).not.toHaveBeenCalled();+ } finally {+ dispose();+ }+ });});diff --git a/frontend-modern/src/stores/__tests__/websocket-unified.test.ts b/frontend-modern/src/stores/__tests__/websocket-unified.test.tsindex 22eb900a20..59be54ddd3 100644--- a/frontend-modern/src/stores/__tests__/websocket-unified.test.ts+++ b/frontend-modern/src/stores/__tests__/websocket-unified.test.ts@@ -144,6 +144,79 @@ describe('websocket store unified resource contract', () => {}});+ it('coalesces split host identities from realtime resource snapshots', async () => {+ const { store, dispose } = await createStoreHarness();+ try {+ await waitForOpenTick();++ emitMessage({+ type: 'initialState',+ data: {+ connectedInfrastructure: [],+ resources: [+ {+ id: 'agent-proxmox-delly',+ type: 'agent',+ name: 'delly',+ displayName: 'delly',+ platformId: 'delly',+ platformType: 'proxmox-pve',+ sourceType: 'api',+ sources: ['proxmox'],+ status: 'online',+ lastSeen: Date.now() - 1000,+ proxmox: {+ nodeName: 'delly',+ clusterName: 'homelab',+ },+ platformData: {+ sources: ['proxmox'],+ proxmox: {+ nodeName: 'delly',+ clusterName: 'homelab',+ },+ },+ },+ {+ id: 'agent-runtime-delly',+ type: 'agent',+ name: 'delly',+ displayName: 'delly',+ platformId: 'delly',+ platformType: 'agent',+ sourceType: 'agent',+ sources: ['agent'],+ status: 'online',+ lastSeen: Date.now(),+ agent: {+ hostname: 'delly',+ osName: 'Debian GNU/Linux',+ },+ platformData: {+ sources: ['agent'],+ agent: {+ hostname: 'delly',+ osName: 'Debian GNU/Linux',+ },+ },+ },+ ],+ lastUpdate: 1739059200000,+ activeAlerts: [],+ recentlyResolved: [],+ },+ });++ expect(store.state.resources).toHaveLength(1);+ expect(store.state.resources[0]?.id).toBe('agent-runtime-delly');+ expect(store.state.resources[0]?.sourceType).toBe('hybrid');+ expect(store.state.resources[0]?.proxmox).toMatchObject({ clusterName: 'homelab' });+ expect(store.state.resources[0]?.agent).toMatchObject({ osName: 'Debian GNU/Linux' });+ } finally {+ dispose();+ }+ });+it('incremental update adds to resources without creating legacy fields', async () => {const { store, dispose } = await createStoreHarness();try {diff --git a/frontend-modern/src/stores/events.ts b/frontend-modern/src/stores/events.tsindex 758c2c4261..79a463dff3 100644--- a/frontend-modern/src/stores/events.ts+++ b/frontend-modern/src/stores/events.ts@@ -16,6 +16,7 @@ export type EventType =// Event data typesexport interface NodeAutoRegisteredData {type: string;+ source?: string;host: string;name: string;tokenId: string;diff --git a/frontend-modern/src/stores/websocket.ts b/frontend-modern/src/stores/websocket.tsindex 12870e68e0..814b7c5c89 100644--- a/frontend-modern/src/stores/websocket.ts+++ b/frontend-modern/src/stores/websocket.ts@@ -24,10 +24,12 @@ const MAX_INBOUND_WEBSOCKET_MESSAGE_BYTES = 8 * 1024 * 1024; // 8 MiBconst AUTO_REGISTER_NOTIFICATION_FRESH_MS = 2 * 60 * 1000;const AUTO_REGISTER_NOTIFICATION_FUTURE_SKEW_MS = 30 * 1000;const AUTO_REGISTER_NOTIFICATION_DEDUPE_MS = 10 * 60 * 1000;+const AUTO_REGISTER_NOTIFICATION_SESSION_GRACE_MS = 5 * 1000;type TimestampedWSMessage = WSMessage & { timestamp?: number | string };type AutoRegisterNotificationPayload = {type?: string;+ source?: string;host?: string;name?: string;nodeId?: string;@@ -74,11 +76,23 @@ const shouldShowAutoRegisterNotification = (message: TimestampedWSMessage,node: AutoRegisterNotificationPayload,now = Date.now(),+ connectionOpenedAtMs = 0,): boolean => {+ const source = node.source?.trim().toLowerCase();+ if (source && source !== 'script') {+ return false;+ }+const eventTimestampMs = resolveMessageTimestampMs(message);if (eventTimestampMs === null) {return false;}+ if (+ connectionOpenedAtMs > 0 &&+ eventTimestampMs < connectionOpenedAtMs - AUTO_REGISTER_NOTIFICATION_SESSION_GRACE_MS+ ) {+ return false;+ }if (eventTimestampMs < now - AUTO_REGISTER_NOTIFICATION_FRESH_MS ||eventTimestampMs > now + AUTO_REGISTER_NOTIFICATION_FUTURE_SKEW_MS@@ -232,6 +246,7 @@ export function createWebSocketStore(url: string) {let reconnectAttempt = 0;let isReconnecting = false;let isDisposed = false;+ let currentConnectionOpenedAtMs = 0;const maxReconnectDelay = POLLING_INTERVALS.RECONNECT_MAX;const initialReconnectDelay = POLLING_INTERVALS.RECONNECT_BASE;const heartbeatIntervalMs = 30000; // Send heartbeat every 30 seconds@@ -362,6 +377,7 @@ export function createWebSocketStore(url: string) {reconnectAttempt = 0; // Reset reconnect attempts on successful connectionisReconnecting = false;lastServerActivityAt = Date.now();+ currentConnectionOpenedAtMs = lastServerActivityAt;// Start heartbeat to keep connection aliveclearHeartbeatTimer();@@ -563,7 +579,14 @@ export function createWebSocketStore(url: string) {const nodeName = node.name || node.host;const nodeType = node.type === 'pve' ? 'Proxmox VE' : 'Proxmox Backup Server';- if (shouldShowAutoRegisterNotification(message, node)) {+ if (+ shouldShowAutoRegisterNotification(+ message,+ node,+ Date.now(),+ currentConnectionOpenedAtMs,+ )+ ) {notificationStore.success(`${nodeType} node "${nodeName}" was successfully auto-registered and is now being monitored!`,8000,@@ -835,9 +858,7 @@ export function createWebSocketStore(url: string) {// clear the pending flag after a generous timeout so we eventually resync with reality.const pendingTimeout = window.setTimeout(() => {if (pendingAckChanges.has(alertIdentifier)) {- logger.warn(- `Clearing stale pending ack change for alert ${alertIdentifier}`,- );+ logger.warn(`Clearing stale pending ack change for alert ${alertIdentifier}`);clearPendingAck(alertIdentifier);notificationStore.error('Server did not confirm the alert acknowledgment in time. Re-syncing from latest data.',diff --git a/frontend-modern/src/types/api.ts b/frontend-modern/src/types/api.tsindex 723959a6c5..3a39c672a2 100644--- a/frontend-modern/src/types/api.ts+++ b/frontend-modern/src/types/api.ts@@ -1110,6 +1110,7 @@ export type WSMessage =type: 'node_auto_registered';data: {type: string;+ source?: string;host: string;name: string;tokenId: string;diff --git a/frontend-modern/src/utils/__tests__/resourceStateAdapters.test.ts b/frontend-modern/src/utils/__tests__/resourceStateAdapters.test.tsindex 79f5eaf606..27ba589995 100644--- a/frontend-modern/src/utils/__tests__/resourceStateAdapters.test.ts+++ b/frontend-modern/src/utils/__tests__/resourceStateAdapters.test.ts@@ -348,6 +348,126 @@ describe('resourceStateAdapters nodeFromResource', () => {});});+ it('coalesces split realtime Proxmox and agent host records before rendering', () => {+ const proxmoxOnly = {+ id: 'agent-proxmox-delly',+ type: 'agent',+ name: 'delly',+ displayName: 'delly',+ platformId: 'delly',+ platformType: 'proxmox-pve',+ sourceType: 'api',+ sources: ['proxmox'],+ status: 'online',+ lastSeen: Date.now() - 1_000,+ canonicalIdentity: {+ displayName: 'delly',+ hostname: 'delly',+ platformId: 'delly',+ primaryId: 'node:homelab-delly',+ },+ proxmox: {+ nodeName: 'delly',+ clusterName: 'homelab',+ pveVersion: '9.1.9',+ },+ platformData: {+ sources: ['proxmox'],+ proxmox: {+ nodeName: 'delly',+ clusterName: 'homelab',+ pveVersion: '9.1.9',+ },+ },+ } as Resource;+ const agentOnly = {+ id: 'agent-runtime-delly',+ type: 'agent',+ name: 'delly',+ displayName: 'delly',+ platformId: 'delly',+ platformType: 'agent',+ sourceType: 'agent',+ sources: ['agent'],+ status: 'online',+ lastSeen: Date.now(),+ canonicalIdentity: {+ displayName: 'delly',+ hostname: 'delly',+ platformId: 'delly',+ primaryId: 'agent:delly-runtime',+ },+ agent: {+ hostname: 'delly',+ osName: 'Debian GNU/Linux',+ osVersion: '13',+ },+ platformData: {+ sources: ['agent'],+ agent: {+ hostname: 'delly',+ osName: 'Debian GNU/Linux',+ osVersion: '13',+ },+ },+ } as Resource;++ for (const incoming of [+ [proxmoxOnly, agentOnly],+ [agentOnly, proxmoxOnly],+ ]) {+ const [resource] = mergeCanonicalResourceSnapshot(incoming, []);++ expect(mergeCanonicalResourceSnapshot(incoming, [])).toHaveLength(1);+ expect(resource.id).toBe('agent-runtime-delly');+ expect(resource.platformType).toBe('proxmox-pve');+ expect(resource.sourceType).toBe('hybrid');+ expect(new Set(resource.sources ?? [])).toEqual(new Set(['agent', 'proxmox']));+ expect(resource.proxmox).toMatchObject({ nodeName: 'delly', clusterName: 'homelab' });+ expect(resource.agent).toMatchObject({ hostname: 'delly', osName: 'Debian GNU/Linux' });+ expect((resource.platformData as Record<string, unknown>).proxmox).toMatchObject({+ nodeName: 'delly',+ });+ expect((resource.platformData as Record<string, unknown>).agent).toMatchObject({+ hostname: 'delly',+ });+ }+ });++ it('does not coalesce same-name agent-only records without a platform source bridge', () => {+ const resources = mergeCanonicalResourceSnapshot(+ [+ {+ id: 'agent-runtime-1',+ type: 'agent',+ name: 'shared-hostname',+ displayName: 'shared-hostname',+ platformId: 'shared-hostname',+ platformType: 'agent',+ sourceType: 'agent',+ sources: ['agent'],+ status: 'online',+ lastSeen: Date.now(),+ } as Resource,+ {+ id: 'agent-runtime-2',+ type: 'agent',+ name: 'shared-hostname',+ displayName: 'shared-hostname',+ platformId: 'shared-hostname',+ platformType: 'agent',+ sourceType: 'agent',+ sources: ['agent'],+ status: 'online',+ lastSeen: Date.now(),+ } as Resource,+ ],+ [],+ );++ expect(resources.map((resource) => resource.id)).toEqual(['agent-runtime-1', 'agent-runtime-2']);+ });+it('uses authoritative top-level sources for realtime storage platform canonicalization', () => {const [resource] = mergeCanonicalResourceSnapshot([diff --git a/frontend-modern/src/utils/resourceStateAdapters.ts b/frontend-modern/src/utils/resourceStateAdapters.tsindex a4cf67e26b..7765e0e43d 100644--- a/frontend-modern/src/utils/resourceStateAdapters.ts+++ b/frontend-modern/src/utils/resourceStateAdapters.ts@@ -68,6 +68,12 @@ const getCanonicalPlatformId = (resource: Resource): string | undefined => {: undefined;};+const normalizeResourceIdentityToken = (value: string | undefined): string | undefined => {+ if (!value) return undefined;+ const normalized = value.trim().toLowerCase();+ return normalized.length > 0 ? normalized : undefined;+};+export const resourcePlatformData = (resource: Resource): Record<string, unknown> | undefined =>asRecord(resource.platformData);@@ -463,6 +469,119 @@ const getCanonicalSourceList = (: deriveLegacySourceList(resource, platformData);};+const sourceListContainsRuntimePlatform = (sources: string[] | undefined): boolean =>+ sourceListHas(+ sources,+ 'proxmox-pve',+ 'docker',+ 'kubernetes',+ 'vmware-vsphere',+ 'truenas',+ );++const getHostResourceMergeKey = (resource: Resource): string | undefined => {+ if (resource.type !== 'agent') return undefined;+ const platform = asRecord(resource.platformData);+ const canonical = resource.canonicalIdentity;+ const candidates = [+ canonical?.platformId,+ canonical?.hostname,+ resource.platformId,+ asString(asRecord(resource.agent)?.hostname),+ asString(asRecord(platform?.agent)?.hostname),+ asString(asRecord(resource.proxmox)?.nodeName),+ asString(asRecord(platform?.proxmox)?.nodeName),+ getPreferredResourceHostname(resource),+ getPreferredInfrastructureDisplayName(resource),+ resource.displayName,+ resource.name,+ ];+ const hostKey = candidates.map(normalizeResourceIdentityToken).find(Boolean);+ return hostKey ? `agent:${hostKey}` : undefined;+};++const shouldMergeRealtimeHostResources = (incoming: Resource, existing: Resource): boolean => {+ if (incoming.type !== 'agent' || existing.type !== 'agent') return false;+ const incomingSources = getCanonicalSourceList(incoming, incoming.platformData);+ const existingSources = getCanonicalSourceList(existing, existing.platformData);+ const unionSources = mergeStringArrays(incomingSources, existingSources);+ return sourceListHas(unionSources, 'agent') && sourceListContainsRuntimePlatform(unionSources);+};++const preferHostResourcePrimary = (candidate: Resource, other: Resource): boolean => {+ const candidateSources = getCanonicalSourceList(candidate, candidate.platformData);+ const otherSources = getCanonicalSourceList(other, other.platformData);+ if (sourceListHas(candidateSources, 'agent') && !sourceListHas(otherSources, 'agent')) {+ return true;+ }+ if (!sourceListHas(candidateSources, 'agent') && sourceListHas(otherSources, 'agent')) {+ return false;+ }+ return candidate.lastSeen >= other.lastSeen;+};++const withMergedSnapshotSources = (+ resource: Resource,+ sources: string[] | undefined,+): Resource => {+ if (!sources || sources.length === 0) return resource;+ const platform = asRecord(resource.platformData);+ return canonicalizeRealtimeResource({+ ...resource,+ sources,+ platformData: {+ ...(platform ?? {}),+ sources,+ },+ });+};++const mergeRealtimeHostResources = (incoming: Resource, existing: Resource): Resource => {+ const unionSources = mergeStringArrays(+ getCanonicalSourceList(incoming, incoming.platformData),+ getCanonicalSourceList(existing, existing.platformData),+ );+ const primary = preferHostResourcePrimary(incoming, existing) ? incoming : existing;+ const secondary = primary === incoming ? existing : incoming;+ return canonicalizeRealtimeResource(+ mergeCanonicalResource(+ withMergedSnapshotSources(primary, unionSources),+ withMergedSnapshotSources(secondary, unionSources),+ ),+ );+};++const coalesceRealtimeResourceSnapshot = (resources: Resource[]): Resource[] => {+ const coalesced: Resource[] = [];+ const indexByHostKey = new Map<string, number>();++ for (const rawResource of resources) {+ const resource = canonicalizeRealtimeResource(rawResource);+ const hostKey = getHostResourceMergeKey(resource);+ if (!hostKey) {+ coalesced.push(resource);+ continue;+ }++ const existingIndex = indexByHostKey.get(hostKey);+ if (existingIndex === undefined) {+ indexByHostKey.set(hostKey, coalesced.length);+ coalesced.push(resource);+ continue;+ }++ const existing = coalesced[existingIndex];+ if (!shouldMergeRealtimeHostResources(resource, existing)) {+ coalesced.push(resource);+ continue;+ }++ coalesced[existingIndex] = mergeRealtimeHostResources(resource, existing);+ }++ return coalesced;+};+const hasAvailabilityFacet = (resource: Resource,platformData?: Resource['platformData'],@@ -619,9 +738,10 @@ export const mergeCanonicalResourceSnapshot = (if (incoming.length === 0) {return [];}+ const coalescedIncoming = coalesceRealtimeResourceSnapshot(incoming);const existingById = new Map(existing.map((resource) => [resource.id, resource] as const));- return incoming.map((resource) =>- mergeCanonicalResource(canonicalizeRealtimeResource(resource), existingById.get(resource.id)),+ return coalescedIncoming.map((resource) =>+ mergeCanonicalResource(resource, existingById.get(resource.id)),);};diff --git a/internal/api/config_handlers_canonical_auto_register_test.go b/internal/api/config_handlers_canonical_auto_register_test.goindex 74999921b6..6937a883cf 100644--- a/internal/api/config_handlers_canonical_auto_register_test.go+++ b/internal/api/config_handlers_canonical_auto_register_test.go@@ -708,6 +708,7 @@ func TestHandleCanonicalAutoRegisterReturnsCanonicalStoredNodeIdentity(t *testinfunc TestBuildAutoRegisterEventDataUsesCanonicalAutoRegisterTokenIdentity(t *testing.T) {req := &AutoRegisterRequest{Type: "pbs",+ Source: "agent",ServerName: "backup-node",}@@ -722,6 +723,9 @@ func TestBuildAutoRegisterEventDataUsesCanonicalAutoRegisterTokenIdentity(t *tesif got := event["tokenId"]; got != "pulse-monitor@pbs!pulse-backup" {t.Fatalf("tokenId = %#v, want canonical token id", got)}+ if got := event["source"]; got != "agent" {+ t.Fatalf("source = %#v, want canonical registration source", got)+ }}func TestAutoRegisterWebSocketEventTypeDistinguishesCreatedFromExistingRefresh(t *testing.T) {diff --git a/internal/api/config_setup_handlers.go b/internal/api/config_setup_handlers.goindex 40744475b5..267c36ac10 100644--- a/internal/api/config_setup_handlers.go+++ b/internal/api/config_setup_handlers.go@@ -789,6 +789,7 @@ func buildAutoRegisterEventData(req *AutoRegisterRequest, host string, actualNamreturn map[string]interface{}{"type": req.Type,+ "source": req.Source,"host": host,"name": eventName,"nodeId": eventName,diff --git a/internal/api/contract_test.go b/internal/api/contract_test.goindex b6a863ebc7..1169605ff7 100644--- a/internal/api/contract_test.go+++ b/internal/api/contract_test.go@@ -9587,6 +9587,7 @@ func TestContract_AutoUnregisterNoopResponseJSONSnapshot(t *testing.T) {func TestContract_AutoRegisterWebSocketEventJSONSnapshot(t *testing.T) {payload := map[string]any{"type": "pve",+ "source": "script","host": "https://pve.local:8006","name": "pve-node-1","nodeId": "pve-node-1",@@ -9608,6 +9609,7 @@ func TestContract_AutoRegisterWebSocketEventJSONSnapshot(t *testing.T) {"name":"pve-node-1","nodeId":"pve-node-1","nodeName":"pve-node-1",+ "source":"script","status":"connected","tokenId":"pulse-monitor@pve!pulse-homelab","type":"pve",@@ -9620,6 +9622,7 @@ func TestContract_AutoRegisterWebSocketEventJSONSnapshot(t *testing.T) {func TestContract_CanonicalAutoRegisterEventJSONSnapshot(t *testing.T) {payload := map[string]any{"type": "pbs",+ "source": "agent","host": "https://pbs.local:8007","name": "backup-node (2)","nodeId": "backup-node (2)",@@ -9641,6 +9644,7 @@ func TestContract_CanonicalAutoRegisterEventJSONSnapshot(t *testing.T) {"name":"backup-node (2)","nodeId":"backup-node (2)","nodeName":"backup-node (2)",+ "source":"agent","status":"connected","tokenId":"pulse-monitor@pbs!pulse-backup","type":"pbs",diff --git a/internal/monitoring/canonical_guardrails_test.go b/internal/monitoring/canonical_guardrails_test.goindex f10419c421..315d854898 100644--- a/internal/monitoring/canonical_guardrails_test.go+++ b/internal/monitoring/canonical_guardrails_test.go@@ -171,6 +171,27 @@ func TestBroadcastResourceProjectionPreservesCanonicalHealthContext(t *testing.T}}+func TestBroadcastResourceProjectionCoalescesSplitHostIdentities(t *testing.T) {+ data, err := os.ReadFile("monitor.go")+ if err != nil {+ t.Fatalf("failed to read monitor.go: %v", err)+ }+ source := string(data)++ for _, snippet := range []string{+ "broadcastResources := coalesceBroadcastResources(unifiedView.resources)",+ "frontendState.Resources = convertResourcesForBroadcast(broadcastResources)",+ "frontendState.ConnectedInfrastructure = buildConnectedInfrastructure(broadcastResources, snapshot)",+ "func coalesceBroadcastResources(resources []unifiedresources.Resource) []unifiedresources.Resource {",+ "func shouldMergeBroadcastHostResources(left, right unifiedresources.Resource) bool {",+ "broadcastHasSource(sources, unifiedresources.SourceAgent) && broadcastHasRuntimePlatformSource(sources)",+ } {+ if !strings.Contains(source, snippet) {+ t.Fatalf("monitor.go must contain %q", snippet)+ }+ }+}+func TestMetricsStoreRuntimeOverridesStayOnMonitorBoundary(t *testing.T) {data, err := os.ReadFile("monitor.go")if err != nil {diff --git a/internal/monitoring/monitor.go b/internal/monitoring/monitor.goindex 0cea174d9d..694fced343 100644--- a/internal/monitoring/monitor.go+++ b/internal/monitoring/monitor.go@@ -3717,8 +3717,9 @@ func (m *Monitor) buildBroadcastFrontendStateFromSnapshot(snapshot models.StateS}}unifiedView := m.currentUnifiedStateView()- frontendState.Resources = convertResourcesForBroadcast(unifiedView.resources)- frontendState.ConnectedInfrastructure = buildConnectedInfrastructure(unifiedView.resources, snapshot)+ broadcastResources := coalesceBroadcastResources(unifiedView.resources)+ frontendState.Resources = convertResourcesForBroadcast(broadcastResources)+ frontendState.ConnectedInfrastructure = buildConnectedInfrastructure(broadcastResources, snapshot)if !unifiedView.freshness.IsZero() {frontendState.LastUpdate = unifiedView.freshness.UnixMilli()}@@ -4891,11 +4892,325 @@ func (m *Monitor) getResourcesForBroadcast() []models.ResourceFrontend {return convertResourcesForBroadcast(m.getUnifiedResourcesForBroadcast())}+func coalesceBroadcastResources(resources []unifiedresources.Resource) []unifiedresources.Resource {+ if len(resources) == 0 {+ return resources+ }++ coalesced := make([]unifiedresources.Resource, 0, len(resources))+ indexByHostKey := make(map[string]int, len(resources))+ for _, resource := range resources {+ resource.Type = unifiedresources.CanonicalResourceType(resource.Type)+ hostKey := broadcastHostMergeKey(resource)+ if hostKey == "" {+ coalesced = append(coalesced, resource)+ continue+ }++ existingIndex, ok := indexByHostKey[hostKey]+ if !ok {+ indexByHostKey[hostKey] = len(coalesced)+ coalesced = append(coalesced, resource)+ continue+ }++ existing := coalesced[existingIndex]+ if !shouldMergeBroadcastHostResources(existing, resource) {+ coalesced = append(coalesced, resource)+ continue+ }+ coalesced[existingIndex] = mergeBroadcastHostResources(existing, resource)+ }++ return coalesced+}++func broadcastHostMergeKey(resource unifiedresources.Resource) string {+ if unifiedresources.CanonicalResourceType(resource.Type) != unifiedresources.ResourceTypeAgent {+ return ""+ }++ candidates := []string{}+ if resource.Canonical != nil {+ candidates = append(candidates, resource.Canonical.PlatformID, resource.Canonical.Hostname)+ }+ candidates = append(candidates, resource.Identity.Hostnames...)+ if resource.Agent != nil {+ candidates = append(candidates, resource.Agent.Hostname)+ }+ if resource.Proxmox != nil {+ candidates = append(candidates, resource.Proxmox.NodeName)+ }+ candidates = append(candidates, resource.Name)++ for _, candidate := range candidates {+ normalized := unifiedresources.NormalizeHostname(candidate)+ if normalized != "" {+ return "agent:" + normalized+ }+ }+ return ""+}++func shouldMergeBroadcastHostResources(left, right unifiedresources.Resource) bool {+ if unifiedresources.CanonicalResourceType(left.Type) != unifiedresources.ResourceTypeAgent ||+ unifiedresources.CanonicalResourceType(right.Type) != unifiedresources.ResourceTypeAgent {+ return false+ }+ sources := mergeBroadcastSources(broadcastResourceSources(left), broadcastResourceSources(right))+ return broadcastHasSource(sources, unifiedresources.SourceAgent) && broadcastHasRuntimePlatformSource(sources)+}++func broadcastResourceSources(resource unifiedresources.Resource) []unifiedresources.DataSource {+ sources := append([]unifiedresources.DataSource(nil), resource.Sources...)+ for source := range resource.SourceStatus {+ sources = append(sources, source)+ }+ if resource.Agent != nil {+ sources = append(sources, unifiedresources.SourceAgent)+ }+ if resource.Proxmox != nil {+ sources = append(sources, unifiedresources.SourceProxmox)+ }+ if resource.Docker != nil {+ sources = append(sources, unifiedresources.SourceDocker)+ }+ if resource.Kubernetes != nil {+ sources = append(sources, unifiedresources.SourceK8s)+ }+ if resource.VMware != nil {+ sources = append(sources, unifiedresources.SourceVMware)+ }+ if resource.TrueNAS != nil {+ sources = append(sources, unifiedresources.SourceTrueNAS)+ }+ return mergeBroadcastSources(nil, sources)+}++func broadcastHasRuntimePlatformSource(sources []unifiedresources.DataSource) bool {+ for _, source := range []unifiedresources.DataSource{+ unifiedresources.SourceProxmox,+ unifiedresources.SourceDocker,+ unifiedresources.SourceK8s,+ unifiedresources.SourceVMware,+ unifiedresources.SourceTrueNAS,+ } {+ if broadcastHasSource(sources, source) {+ return true+ }+ }+ return false+}++func broadcastHasSource(sources []unifiedresources.DataSource, target unifiedresources.DataSource) bool {+ for _, source := range sources {+ if source == target {+ return true+ }+ }+ return false+}++func mergeBroadcastSources(left, right []unifiedresources.DataSource) []unifiedresources.DataSource {+ merged := make([]unifiedresources.DataSource, 0, len(left)+len(right))+ seen := make(map[unifiedresources.DataSource]struct{}, len(left)+len(right))+ for _, source := range append(append([]unifiedresources.DataSource(nil), left...), right...) {+ if strings.TrimSpace(string(source)) == "" {+ continue+ }+ if _, ok := seen[source]; ok {+ continue+ }+ seen[source] = struct{}{}+ merged = append(merged, source)+ }+ return merged+}++func mergeBroadcastHostResources(left, right unifiedresources.Resource) unifiedresources.Resource {+ primary, secondary := left, right+ if preferBroadcastHostPrimary(right, left) {+ primary, secondary = right, left+ }++ merged := primary+ merged.Sources = mergeBroadcastSources(broadcastResourceSources(primary), broadcastResourceSources(secondary))+ merged.SourceStatus = mergeBroadcastSourceStatus(primary.SourceStatus, secondary.SourceStatus, merged.Sources, primary.LastSeen, secondary.LastSeen)+ merged.Identity = mergeBroadcastIdentity(primary.Identity, secondary.Identity)++ if merged.Agent == nil {+ merged.Agent = secondary.Agent+ }+ if merged.Proxmox == nil {+ merged.Proxmox = secondary.Proxmox+ }+ if merged.Docker == nil {+ merged.Docker = secondary.Docker+ }+ if merged.Kubernetes == nil {+ merged.Kubernetes = secondary.Kubernetes+ }+ if merged.VMware == nil {+ merged.VMware = secondary.VMware+ }+ if merged.TrueNAS == nil {+ merged.TrueNAS = secondary.TrueNAS+ }+ if merged.Storage == nil {+ merged.Storage = secondary.Storage+ }+ if merged.Metrics == nil {+ merged.Metrics = secondary.Metrics+ } else if secondary.Metrics != nil {+ merged.Metrics = mergeBroadcastMetrics(merged.Metrics, secondary.Metrics)+ }+ if merged.DiscoveryTarget == nil {+ merged.DiscoveryTarget = secondary.DiscoveryTarget+ }+ if merged.MetricsTarget == nil {+ merged.MetricsTarget = secondary.MetricsTarget+ }+ if merged.Canonical == nil {+ merged.Canonical = secondary.Canonical+ }+ merged.Tags = uniqueBroadcastStrings(append(append([]string(nil), secondary.Tags...), primary.Tags...))+ merged.Incidents = append(append([]unifiedresources.ResourceIncident(nil), secondary.Incidents...), primary.Incidents...)+ if secondary.LastSeen.After(merged.LastSeen) {+ merged.LastSeen = secondary.LastSeen+ }+ if secondary.UpdatedAt.After(merged.UpdatedAt) {+ merged.UpdatedAt = secondary.UpdatedAt+ }+ merged.Status = betterBroadcastStatus(merged.Status, secondary.Status)+ return merged+}++func preferBroadcastHostPrimary(candidate, other unifiedresources.Resource) bool {+ candidateHasAgent := broadcastHasSource(broadcastResourceSources(candidate), unifiedresources.SourceAgent)+ otherHasAgent := broadcastHasSource(broadcastResourceSources(other), unifiedresources.SourceAgent)+ if candidateHasAgent != otherHasAgent {+ return candidateHasAgent+ }+ if candidate.LastSeen.Equal(other.LastSeen) {+ return strings.TrimSpace(candidate.ID) < strings.TrimSpace(other.ID)+ }+ return candidate.LastSeen.After(other.LastSeen)+}++func mergeBroadcastSourceStatus(+ left, right map[unifiedresources.DataSource]unifiedresources.SourceStatus,+ sources []unifiedresources.DataSource,+ leftLastSeen time.Time,+ rightLastSeen time.Time,+) map[unifiedresources.DataSource]unifiedresources.SourceStatus {+ merged := make(map[unifiedresources.DataSource]unifiedresources.SourceStatus, len(sources))+ for source, status := range right {+ merged[source] = status+ }+ for source, status := range left {+ merged[source] = status+ }+ for _, source := range sources {+ if _, ok := merged[source]; ok {+ continue+ }+ lastSeen := leftLastSeen+ if rightLastSeen.After(lastSeen) {+ lastSeen = rightLastSeen+ }+ merged[source] = unifiedresources.SourceStatus{Status: "online", LastSeen: lastSeen}+ }+ return merged+}++func mergeBroadcastIdentity(left, right unifiedresources.ResourceIdentity) unifiedresources.ResourceIdentity {+ merged := left+ if merged.MachineID == "" {+ merged.MachineID = right.MachineID+ }+ if merged.DMIUUID == "" {+ merged.DMIUUID = right.DMIUUID+ }+ if merged.ClusterName == "" {+ merged.ClusterName = right.ClusterName+ }+ merged.Hostnames = uniqueBroadcastStrings(append(append([]string(nil), left.Hostnames...), right.Hostnames...))+ merged.IPAddresses = uniqueBroadcastStrings(append(append([]string(nil), left.IPAddresses...), right.IPAddresses...))+ merged.MACAddresses = uniqueBroadcastStrings(append(append([]string(nil), left.MACAddresses...), right.MACAddresses...))+ return merged+}++func uniqueBroadcastStrings(values []string) []string {+ if len(values) == 0 {+ return nil+ }+ unique := make([]string, 0, len(values))+ seen := make(map[string]struct{}, len(values))+ for _, value := range values {+ trimmed := strings.TrimSpace(value)+ if trimmed == "" {+ continue+ }+ if _, ok := seen[trimmed]; ok {+ continue+ }+ seen[trimmed] = struct{}{}+ unique = append(unique, trimmed)+ }+ return unique+}++func mergeBroadcastMetrics(left, right *unifiedresources.ResourceMetrics) *unifiedresources.ResourceMetrics {+ if left == nil {+ return right+ }+ if right == nil {+ return left+ }+ merged := *left+ if merged.CPU == nil {+ merged.CPU = right.CPU+ }+ if merged.Memory == nil {+ merged.Memory = right.Memory+ }+ if merged.Disk == nil {+ merged.Disk = right.Disk+ }+ if merged.NetIn == nil {+ merged.NetIn = right.NetIn+ }+ if merged.NetOut == nil {+ merged.NetOut = right.NetOut+ }+ if merged.DiskRead == nil {+ merged.DiskRead = right.DiskRead+ }+ if merged.DiskWrite == nil {+ merged.DiskWrite = right.DiskWrite+ }+ return &merged+}++func betterBroadcastStatus(left, right unifiedresources.ResourceStatus) unifiedresources.ResourceStatus {+ rank := map[unifiedresources.ResourceStatus]int{+ unifiedresources.StatusOnline: 4,+ unifiedresources.StatusWarning: 3,+ unifiedresources.StatusUnknown: 2,+ unifiedresources.StatusOffline: 1,+ }+ if rank[right] > rank[left] {+ return right+ }+ return left+}+// convertResourcesForBroadcast converts unified resources into the frontend payload shape.func convertResourcesForBroadcast(allResources []unifiedresources.Resource) []models.ResourceFrontend {if len(allResources) == 0 {return []models.ResourceFrontend{}}+ allResources = coalesceBroadcastResources(allResources)type broadcastResource struct {input models.ResourceConvertInputsortKey stringdiff --git a/internal/monitoring/monitor_unified_state_test.go b/internal/monitoring/monitor_unified_state_test.goindex 1f575dd918..825f799549 100644--- a/internal/monitoring/monitor_unified_state_test.go+++ b/internal/monitoring/monitor_unified_state_test.go@@ -84,6 +84,74 @@ func hasUnifiedResourceName(resources []unifiedresources.Resource, name string)return false}+func TestConvertResourcesForBroadcastCoalescesSplitHostResources(t *testing.T) {+ now := time.Date(2026, 5, 14, 10, 30, 0, 0, time.UTC)+ resources := []unifiedresources.Resource{+ {+ ID: "agent-proxmox-delly",+ Type: unifiedresources.ResourceTypeAgent,+ Name: "delly",+ Status: unifiedresources.StatusOnline,+ LastSeen: now.Add(-1 * time.Second),+ Sources: []unifiedresources.DataSource{unifiedresources.SourceProxmox},+ Identity: unifiedresources.ResourceIdentity{Hostnames: []string{"delly"}},+ Proxmox: &unifiedresources.ProxmoxData{+ NodeName: "delly",+ ClusterName: "homelab",+ PVEVersion: "9.1.9",+ },+ },+ {+ ID: "agent-runtime-delly",+ Type: unifiedresources.ResourceTypeAgent,+ Name: "delly",+ Status: unifiedresources.StatusOnline,+ LastSeen: now,+ Sources: []unifiedresources.DataSource{unifiedresources.SourceAgent},+ Identity: unifiedresources.ResourceIdentity{+ MachineID: "agent-machine-delly",+ Hostnames: []string{+ "delly",+ },+ },+ Agent: &unifiedresources.AgentData{+ AgentID: "agent-machine-delly",+ Hostname: "delly",+ OSName: "Proxmox VE",+ },+ },+ }++ frontend := convertResourcesForBroadcast(resources)+ if len(frontend) != 1 {+ t.Fatalf("expected split host resources to coalesce into 1 frontend resource, got %d: %#v", len(frontend), frontend)+ }++ resource := frontend[0]+ if resource.ID != "agent-runtime-delly" {+ t.Fatalf("expected agent-backed resource ID, got %q", resource.ID)+ }+ if resource.SourceType != "hybrid" {+ t.Fatalf("expected hybrid source type, got %q", resource.SourceType)+ }+ if resource.PlatformType != "proxmox-pve" {+ t.Fatalf("expected proxmox-pve platform type, got %q", resource.PlatformType)+ }+ sourceSet := make(map[string]bool, len(resource.Sources))+ for _, source := range resource.Sources {+ sourceSet[source] = true+ }+ if !sourceSet["agent"] || !sourceSet["proxmox"] {+ t.Fatalf("expected agent and proxmox sources, got %#v", resource.Sources)+ }+ if len(resource.Proxmox) == 0 {+ t.Fatal("expected merged Proxmox facet")+ }+ if len(resource.Agent) == 0 {+ t.Fatal("expected merged agent facet")+ }+}+func hasFrontendResourceName(resources []models.ResourceFrontend, name string) bool {for _, resource := range resources {if resource.Name == name {