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
Restore manual agent update commands unless an update is actively applying
rcourtman7f2fb03380d2
diff --git a/frontend-modern/src/components/Settings/__tests__/infrastructureAgentDoctorModel.test.ts b/frontend-modern/src/components/Settings/__tests__/infrastructureAgentDoctorModel.test.tsindex 706fdcd0a2..e72ec9a1a9 100644--- a/frontend-modern/src/components/Settings/__tests__/infrastructureAgentDoctorModel.test.ts+++ b/frontend-modern/src/components/Settings/__tests__/infrastructureAgentDoctorModel.test.ts@@ -144,7 +144,7 @@ describe('Agent Doctor model', () => {expect(targets[0].commandBlockedReason).toContain('will not guess');});- it('classifies eligible v6 convergence as waiting and withholds a premature manual command', () => {+ it('classifies eligible v6 convergence as waiting but keeps the manual command available', () => {const connection = connectionFixture({agentUpdate: {state: 'checking',@@ -172,10 +172,50 @@ describe('Agent Doctor model', () => {status: 'waiting',updaterLabel: 'Checking for an automatic update',});- expect(targets[0].commandBlockedReason).toContain('handling the update asynchronously');+ expect(targets[0].commandBlockedReason).toBeUndefined();expect(targets[0].evidence).toContain('Last updater check: 2026-07-13T09:01:00Z');});+ it('withholds the manual command only while an update is actively applying', () => {+ const nowMs = Date.parse('2026-07-13T09:05:00Z');+ const agentUpdate = {+ state: 'updating' as const,+ autoUpdate: true,+ lastAttemptAt: '2026-07-13T09:01:00Z',+ };+ const connection = connectionFixture({ agentUpdate });+ const targets = collectInfrastructureAgentDoctorTargets({+ rows: [rowFixture(connection)],+ connections: [connection],+ diagnostics: [diagnosticFixture({ agentUpdate })],+ diagnosticsAvailable: true,+ targetVersion: '6.2.0',+ nowMs,+ });++ expect(targets[0].commandBlockedReason).toContain('applying an update right now');+ });++ it('restores the manual command when an in-flight update stalls', () => {+ const nowMs = Date.parse('2026-07-13T10:00:00Z');+ const agentUpdate = {+ state: 'updating' as const,+ autoUpdate: true,+ lastAttemptAt: '2026-07-13T09:01:00Z',+ };+ const connection = connectionFixture({ agentUpdate });+ const targets = collectInfrastructureAgentDoctorTargets({+ rows: [rowFixture(connection)],+ connections: [connection],+ diagnostics: [diagnosticFixture({ agentUpdate })],+ diagnosticsAvailable: true,+ targetVersion: '6.2.0',+ nowMs,+ });++ expect(targets[0].commandBlockedReason).toBeUndefined();+ });+it('withholds FreeBSD and pfSense update commands until installer state is proven', () => {const connection = connectionFixture({agentIdentity: { hostname: 'firewall', platform: 'pfSense', architecture: 'amd64' },diff --git a/frontend-modern/src/components/Settings/__tests__/infrastructureAgentUpdateCommandsModel.branchcov0720pm.test.ts b/frontend-modern/src/components/Settings/__tests__/infrastructureAgentUpdateCommandsModel.branchcov0720pm.test.tsindex 7e6689df40..8df506121f 100644--- a/frontend-modern/src/components/Settings/__tests__/infrastructureAgentUpdateCommandsModel.branchcov0720pm.test.ts+++ b/frontend-modern/src/components/Settings/__tests__/infrastructureAgentUpdateCommandsModel.branchcov0720pm.test.ts@@ -922,7 +922,27 @@ describe('collectInfrastructureAgentDoctorTargets (commandBlockedReason arms)',expect(target?.commandBlockedReason).toContain('cannot verify saved FreeBSD');});- it('blocks while the eligible v6 updater is handling the update', () => {+ it('blocks while the updater is actively applying an update', () => {+ const [target] = runDoctor(+ [+ agentConnection({+ state: 'active',+ agentUpdateAvailable: true,+ expectedAgentVersion: '6.2.0',+ agentIdentity: { hostname: 'host-1', platform: 'ubuntu', architecture: 'amd64' },+ agentUpdate: {+ state: 'updating',+ autoUpdate: true,+ lastAttemptAt: '2026-07-13T09:01:00Z',+ },+ }),+ ],+ { nowMs: Date.parse('2026-07-13T09:03:00Z') },+ );+ expect(target?.commandBlockedReason).toContain('applying an update right now');+ });++ it('keeps the manual command available while the updater merely waits', () => {const [target] = runDoctor([agentConnection({state: 'active',@@ -932,7 +952,7 @@ describe('collectInfrastructureAgentDoctorTargets (commandBlockedReason arms)',agentUpdate: { state: 'checking', autoUpdate: true },}),]);- expect(target?.commandBlockedReason).toContain('handling the update asynchronously');+ expect(target?.commandBlockedReason).toBeUndefined();});it('blocks when diagnostics offer no supported structured upgrade action', () => {diff --git a/frontend-modern/src/components/Settings/infrastructureAgentUpdateCommandsModel.ts b/frontend-modern/src/components/Settings/infrastructureAgentUpdateCommandsModel.tsindex efff2e3298..9df3537291 100644--- a/frontend-modern/src/components/Settings/infrastructureAgentUpdateCommandsModel.ts+++ b/frontend-modern/src/components/Settings/infrastructureAgentUpdateCommandsModel.ts@@ -48,6 +48,7 @@ export interface InfrastructureAgentDoctorOptions {diagnosticsAvailable: boolean;targetVersion?: string | null;scopedAgentIds?: readonly string[];+ nowMs?: number;}const maybeAdd = (flags: Set<string>, flag: string) => {@@ -396,6 +397,22 @@ const evidenceFor = (return Array.from(evidence);};+// A live self-update should finish well inside this window. Past it, the+// updater is treated as stalled and the manual command comes back.+const UPDATER_IN_FLIGHT_STALL_MS = 10 * 60 * 1000;++const updaterApplyingNow = (+ connection: Connection,+ diagnostic: AgentFleetAgentDiagnostic | undefined,+ nowMs: number,+): boolean => {+ const update = connection.agentUpdate ?? diagnostic?.agentUpdate;+ if (update?.state?.trim().toLowerCase() !== 'updating') return false;+ const startedAt = Date.parse(update.lastAttemptAt || update.lastCheckedAt || '');+ if (Number.isNaN(startedAt)) return true;+ return nowMs - startedAt < UPDATER_IN_FLIGHT_STALL_MS;+};+const updaterPresentation = (connection: Connection,diagnostic: AgentFleetAgentDiagnostic | undefined,@@ -443,7 +460,8 @@ const doctorTargetFromBinding = (binding: AgentConnectionBinding,diagnostic: AgentFleetAgentDiagnostic | undefined,diagnosticsAvailable: boolean,- targetVersion?: string | null,+ targetVersion: string | null | undefined,+ nowMs: number,): InfrastructureAgentDoctorTarget => {const connection = binding.connection;const expectedVersion = expectedVersionFor(connection, targetVersion);@@ -482,9 +500,9 @@ const doctorTargetFromBinding = (} else if (needsUpdate && commandPlatform === 'freebsd') {commandBlockedReason ='Pulse cannot verify saved FreeBSD or pfSense installer state yet. Open Install on a host for the reviewed manual path instead of running a guessed update command.';- } else if (updater.waiting) {+ } else if (needsUpdate && updaterApplyingNow(connection, diagnostic, nowMs)) {commandBlockedReason =- 'This eligible v6 agent is handling the update asynchronously. Wait for its updater result before using a manual command.';+ 'This agent is applying an update right now. Wait for its updater result before running a manual command.';}const hasStructuredUpgradeAction = Boolean(@@ -571,6 +589,7 @@ export const collectInfrastructureAgentDoctorTargets = ({diagnosticsAvailable,targetVersion,scopedAgentIds = [],+ nowMs = Date.now(),}: InfrastructureAgentDoctorOptions): InfrastructureAgentDoctorTarget[] => {const bindings = collectAgentConnectionBindings(rows, connections);const diagnosticsByConnectionID = new Map(@@ -590,6 +609,7 @@ export const collectInfrastructureAgentDoctorTargets = ({diagnosticsByConnectionID.get(binding.connection.id),diagnosticsAvailable,targetVersion,+ nowMs,),);