Skip to content

armgit / Pulse

Public Imported from GitHub
0

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.

Route stale agents to scoped update commands

rcourtmanb50b99c7c6ab
diff --git a/docs/release-control/v6/internal/subsystems/agent-lifecycle.md b/docs/release-control/v6/internal/subsystems/agent-lifecycle.md
index 422fce94d0..5e71f31433 100644
--- a/docs/release-control/v6/internal/subsystems/agent-lifecycle.md
+++ b/docs/release-control/v6/internal/subsystems/agent-lifecycle.md
@@ -48,12 +48,14 @@ that binary, not separate customer-facing agent products.
22. `frontend-modern/src/components/Settings/ConnectionEditor/CredentialSlots/VMwareCredentialSlot.tsx`
22a. `frontend-modern/src/components/Settings/ConnectionEditor/CredentialSlots/AvailabilityTargetSlot.tsx`
23. `frontend-modern/src/components/Settings/InfrastructureWorkspace.tsx`
+23a. `frontend-modern/src/components/Settings/InfrastructureAgentUpdatesDialog.tsx`
24. `frontend-modern/src/components/Settings/InfrastructureSourceManager.tsx`
25. `frontend-modern/src/components/Settings/InfrastructureSourcePicker.tsx`
26. `frontend-modern/src/components/Settings/InfrastructureDiscoverySettingsDialog.tsx`
27. `frontend-modern/src/components/Settings/DiscoverySettingsForm.tsx`
28. `frontend-modern/src/components/Settings/discoverySettingsModel.ts`
29. `frontend-modern/src/components/Settings/infrastructureWorkspaceModel.ts`
+29a. `frontend-modern/src/components/Settings/infrastructureAgentUpdateCommandsModel.ts`
30. `frontend-modern/src/components/Settings/proxmoxSettingsModel.ts`
31. `frontend-modern/src/components/Settings/useInfrastructureOperationsState.tsx`
32. `frontend-modern/src/components/Settings/useInfrastructureSettingsState.ts`
@@ -67,6 +69,7 @@ that binary, not separate customer-facing agent products.
40. `frontend-modern/src/components/SetupWizard/SetupCompletionPanel.tsx`
41. `frontend-modern/src/utils/agentProfilesPresentation.ts`
42. `frontend-modern/src/utils/agentInstallCommand.ts`
+42a. `frontend-modern/src/utils/agentVersion.ts`
43. `frontend-modern/src/utils/infrastructureOnboardingPresentation.ts`
44. `frontend-modern/src/api/nodes.ts`
45. `frontend-modern/src/components/Settings/InfrastructureInstallerSection.tsx`
@@ -174,6 +177,18 @@ before the update starts. Root `install.sh` v5-to-v6 upgrades must also inspect
local token metadata before binary replacement and warn when the shell path
cannot prove agent-token continuity.
+Stale-agent platform notices and the Infrastructure `agentUpdates` workspace
+route are part of that same lifecycle contract. Platform pages may link to the
+central Infrastructure update dialog with a scoped list of affected agent
+connection IDs, but command rendering stays lifecycle-owned in Settings. For
+Unix-like agents that Pulse already sees, the copied stale-agent update command
+must use `scripts/install.sh --update` and recover URL, token, identity, custom
+CA, and insecure transport from installer-owned saved state instead of asking
+the operator to mint a fresh install token or exposing agent IDs in the copied
+command. Windows stale-agent update commands remain on the existing
+token-gated install transport until the Windows installer owns an equivalent
+saved-state update mode.
+
Agent lifecycle and fleet-operation surfaces may consume
`POST /api/actions/plan` for resource capability planning, but the action plan
contract remains API-owned through `internal/api/actions.go` and
diff --git a/docs/release-control/v6/internal/subsystems/api-contracts.md b/docs/release-control/v6/internal/subsystems/api-contracts.md
index 5c43e47de8..33595d0eff 100644
--- a/docs/release-control/v6/internal/subsystems/api-contracts.md
+++ b/docs/release-control/v6/internal/subsystems/api-contracts.md
@@ -112,6 +112,17 @@ product API routes free of maintainer commercial analytics.
## Shared Boundaries
+Infrastructure settings copied agent commands are a shared API/payload boundary
+even when the final command string is assembled in the browser. Selected-row
+upgrade commands may carry fresh token and identity fields when the operator is
+rerunning a known install command for a specific connection, but stale-agent
+update commands opened from platform notices must not serialize API tokens,
+agent IDs, or hostnames into Unix shell payloads. Those commands route through
+the `agentUpdates` settings query for scoped row selection and then call the
+installer-owned `scripts/install.sh --update` saved-state path on the target
+host. Windows remains on the existing token-gated PowerShell payload until its
+installer owns the same saved-state update contract.
+
Summary-chart response caching is a shared API boundary:
`internal/api/router.go` may serve a short cached JSON payload for repeated
infrastructure-summary and workloads-summary requests with the same
@@ -3509,6 +3520,15 @@ The same identity-preservation contract applies to copied upgrade transport:
shell upgrade payloads must carry `--agent-id` and `--hostname`, and
PowerShell upgrade payloads must carry `PULSE_AGENT_ID` and `PULSE_HOSTNAME`,
so upgrade reruns stay bound to the selected governed inventory record.
+That selected-agent upgrade rerun is distinct from the stale-agent update
+commands opened from platform notices. The `agentUpdates` Infrastructure route
+may carry scoped agent connection IDs in the URL so Settings can select the
+affected inventory rows, but Unix-like copied stale-agent update commands must
+not serialize API tokens, agent IDs, or hostnames into the shell payload. They
+must call `scripts/install.sh --update` and let the installer recover the
+saved connection state on the target host. Windows stale-agent update commands
+continue to use the existing token-gated PowerShell install command shape
+until `install.ps1` has its own saved-state update mode.
That same Unix transport boundary must also preserve shell-safe argument
encoding: copied shell uninstall and upgrade payloads must quote canonical URL,
token, agent ID, and hostname arguments so governed lifecycle commands do not
diff --git a/docs/release-control/v6/internal/subsystems/deployment-installability.md b/docs/release-control/v6/internal/subsystems/deployment-installability.md
index 27e1d70f05..120617dcde 100644
--- a/docs/release-control/v6/internal/subsystems/deployment-installability.md
+++ b/docs/release-control/v6/internal/subsystems/deployment-installability.md
@@ -248,6 +248,13 @@ TLS floor in the dynamic config.
enrollment input, and avoid interactive download-failure prompts when
launched by generated non-interactive onboarding commands.
8. `scripts/install.sh` shared with `agent-lifecycle`: the shell installer is both a deployment installability entry point and a canonical agent lifecycle runtime continuity boundary.
+ Existing-agent update commands copied from the settings UI must use the
+ installer-owned `--update` mode rather than serializing a fresh enrollment
+ token into platform notice links. In `--update` mode, `scripts/install.sh`
+ must recover the server URL, token-file state, identity material, CA trust
+ settings, insecure flag, and persisted agent id from the local installed
+ agent state, must fail closed when no existing installation or connection
+ state is present, and must refuse to silently become a new install command.
## Extension Points
diff --git a/docs/release-control/v6/internal/subsystems/frontend-primitives.md b/docs/release-control/v6/internal/subsystems/frontend-primitives.md
index b110477a5d..b544f9db11 100644
--- a/docs/release-control/v6/internal/subsystems/frontend-primitives.md
+++ b/docs/release-control/v6/internal/subsystems/frontend-primitives.md
@@ -227,6 +227,15 @@ unified-resource owner supplies StorageClass, PersistentVolume, and
PersistentVolumeClaim-specific columns. Kubernetes networking inventory also
follows that same primitive boundary while the unified-resource owner supplies
Service, Ingress, and EndpointSlice-specific columns.
+Outdated-agent notices on platform pages are part of this same shared
+frontend/platform primitive boundary. Agent-backed and hybrid platform pages may
+surface a compact stale-agent cue when their row model carries Pulse agent
+identity and version evidence, but the CTA must route to the canonical
+Infrastructure settings update-command surface with scoped agent IDs instead of
+duplicating installer command assembly, tokens, or lifecycle copy in each
+platform page. Agentless API-only platforms such as vSphere must not grow this
+notice unless a concrete guest or monitored system row actually carries a Pulse
+agent identity.
Kubernetes policy inventory follows that same primitive boundary while the
unified-resource owner supplies NetworkPolicy policy type and rule-count
columns, PodDisruptionBudget budget and observed health columns, ResourceQuota
diff --git a/docs/release-control/v6/internal/subsystems/storage-recovery.md b/docs/release-control/v6/internal/subsystems/storage-recovery.md
index 9e412c9f0e..ccb4ca0c78 100644
--- a/docs/release-control/v6/internal/subsystems/storage-recovery.md
+++ b/docs/release-control/v6/internal/subsystems/storage-recovery.md
@@ -72,6 +72,12 @@ token may allow agent reporting for the scoped tenant workspace, but it must not
grant backup visibility, recovery authority, or storage health privileges; those
remain governed by the setup-script and source-specific backup API boundaries
below.
+Proxmox page stale-agent notices are adjacent frontend and agent-lifecycle
+plumbing even though `ProxmoxPageSurface` is a storage/recovery canonical file.
+Those notices may link an operator to scoped agent update commands for
+agent-contributed node detail and command support, but they must not be
+interpreted as backup visibility, recovery readiness, restore capability, or a
+storage/recovery-owned command path.
Tenant report branding settings are adjacent tenant-local configuration, not a
storage or recovery product state. `reportBranding` persisted in a tenant
runtime's `system.json` should be preserved by the existing tenant data
diff --git a/docs/release-control/v6/internal/subsystems/unified-resources.md b/docs/release-control/v6/internal/subsystems/unified-resources.md
index 731120b626..cbef81e5c8 100644
--- a/docs/release-control/v6/internal/subsystems/unified-resources.md
+++ b/docs/release-control/v6/internal/subsystems/unified-resources.md
@@ -483,6 +483,11 @@ AI-only summary payloads, or page-local heuristics.
treat top-level `remoteControl` as applied agent runtime truth, and they
must preserve desired/applied drift or no-report attention when enriching
resource rows.
+ Platform-page stale-agent notices may consume canonical agent identity from
+ merged resources only to scope the Infrastructure settings update-command
+ route to the affected agents. That scoped lifecycle handoff must not become a
+ new resource-action authority, a page-local command runner, or a substitute
+ for the `/api/connections` fleet command-policy truth described above.
`internal/unifiedresources/top_level_systems.go`
Explicit linked-host correlation is canonical here: when Kubernetes node
ingest has a resolved backing host agent, the registry must merge that node
diff --git a/frontend-modern/src/components/Settings/InfrastructureAgentUpdatesDialog.tsx b/frontend-modern/src/components/Settings/InfrastructureAgentUpdatesDialog.tsx
new file mode 100644
index 0000000000..85d9ef5a81
--- /dev/null
+++ b/frontend-modern/src/components/Settings/InfrastructureAgentUpdatesDialog.tsx
@@ -0,0 +1,220 @@
+import { For, Show, createMemo, type Component } from 'solid-js';
+import { Copy, X } from 'lucide-solid';
+import { Dialog } from '@/components/shared/Dialog';
+import { copyToClipboard } from '@/utils/clipboard';
+import { notificationStore } from '@/stores/notifications';
+import {
+ getUnifiedAgentClipboardCopyErrorMessage,
+ getUnifiedAgentClipboardCopySuccessMessage,
+} from '@/utils/unifiedAgentInventoryPresentation';
+import type { InfrastructureAgentUpdateTarget } from './infrastructureAgentUpdateCommandsModel';
+import { useInfrastructureOperationsContext } from './useInfrastructureOperationsState';
+
+interface InfrastructureAgentUpdatesDialogProps {
+ isOpen: boolean;
+ targets: readonly InfrastructureAgentUpdateTarget[];
+ onClose: () => void;
+}
+
+const closeButtonClass =
+ 'inline-flex h-9 w-9 items-center justify-center rounded-md border border-border text-base-content transition-colors hover:bg-surface-hover';
+
+const copyButtonClass =
+ 'absolute right-2 top-2 inline-flex min-h-10 min-w-10 items-center justify-center rounded-md bg-surface-hover p-2 text-muted transition-colors hover:text-base-content disabled:cursor-not-allowed disabled:opacity-50 sm:min-h-9 sm:min-w-9';
+
+export const InfrastructureAgentUpdatesDialog: Component<InfrastructureAgentUpdatesDialogProps> = (
+ props,
+) => {
+ const operations = useInfrastructureOperationsContext();
+ const targetCount = createMemo(() => props.targets.length);
+ const tokenGatedTargetCount = createMemo(
+ () =>
+ props.targets.filter((target) =>
+ operations.getAgentConnectionUpgradeCommandRequiresToken(target.connection),
+ ).length,
+ );
+ const hasTokenGatedTargets = createMemo(() => tokenGatedTargetCount() > 0);
+ const targetSummary = createMemo(() =>
+ targetCount() === 1 ? '1 agent needs an update' : `${targetCount()} agents need updates`,
+ );
+ const commandReadyForTarget = (target: InfrastructureAgentUpdateTarget) =>
+ !operations.getAgentConnectionUpgradeCommandRequiresToken(target.connection) ||
+ operations.commandsUnlocked();
+
+ const copyCommand = async (command: string) => {
+ const success = await copyToClipboard(command);
+ if (success) {
+ notificationStore.success(getUnifiedAgentClipboardCopySuccessMessage());
+ return;
+ }
+ notificationStore.error(getUnifiedAgentClipboardCopyErrorMessage());
+ };
+
+ return (
+ <Dialog isOpen={props.isOpen} onClose={props.onClose} ariaLabel="Update Pulse Agents">
+ <div class="flex h-full min-h-0 flex-col">
+ <div class="flex items-start justify-between gap-4 border-b border-border bg-surface-alt px-4 py-4 sm:px-6">
+ <div class="space-y-1">
+ <h2 class="text-base font-semibold text-base-content">Update Pulse Agents</h2>
+ <p class="text-sm text-muted">
+ Copy the update command for each host that is behind the current Pulse Agent target.
+ </p>
+ </div>
+ <button
+ type="button"
+ onClick={props.onClose}
+ class={closeButtonClass}
+ aria-label="Close agent update commands"
+ >
+ <X class="h-4 w-4" />
+ </button>
+ </div>
+
+ <div class="min-h-0 flex-1 space-y-4 overflow-y-auto p-4 sm:p-6">
+ <Show
+ when={targetCount() > 0}
+ fallback={
+ <div class="rounded-md border border-emerald-200 bg-emerald-50 px-4 py-3 text-sm text-emerald-900 dark:border-emerald-800 dark:bg-emerald-950/40 dark:text-emerald-100">
+ Pulse does not currently see any agents behind the target version.
+ </div>
+ }
+ >
+ <div class="rounded-md border border-amber-200 bg-amber-50 px-4 py-3 text-sm text-amber-900 dark:border-amber-800 dark:bg-amber-950/30 dark:text-amber-100">
+ <div class="font-semibold">{targetSummary()}</div>
+ <p class="mt-1 text-xs leading-5 text-amber-800 dark:text-amber-200">
+ Run these commands on the affected hosts. They reuse the signed unified installer,
+ recover the existing agent connection state where supported, verify the matching
+ agent binary, preserve host identity, and restart the service after the binary is
+ updated.
+ </p>
+ </div>
+
+ <Show
+ when={
+ hasTokenGatedTargets() &&
+ operations.requiresToken() &&
+ !operations.commandsUnlocked()
+ }
+ >
+ <section class="space-y-3 rounded-md border border-blue-200 bg-blue-50 px-4 py-3 dark:border-blue-800 dark:bg-blue-950/30">
+ <div class="space-y-1">
+ <h3 class="text-sm font-semibold text-blue-900 dark:text-blue-100">
+ Generate update token
+ </h3>
+ <p class="text-xs leading-5 text-blue-800 dark:text-blue-200">
+ {tokenGatedTargetCount() === 1
+ ? 'One target still needs a scoped install token before Pulse can show its update command.'
+ : `${tokenGatedTargetCount()} targets still need a scoped install token before Pulse can show their update commands.`}
+ </p>
+ </div>
+ <div class="flex flex-col gap-2 sm:flex-row">
+ <input
+ type="text"
+ value={operations.tokenName()}
+ onInput={(event) => operations.setTokenName(event.currentTarget.value)}
+ onKeyDown={(event) => {
+ if (event.key === 'Enter' && !operations.isGeneratingToken()) {
+ void operations.handleGenerateToken();
+ }
+ }}
+ placeholder="Token name (optional)"
+ class="min-h-10 flex-1 rounded-md border border-blue-200 bg-surface px-3 py-2 text-sm text-base-content shadow-sm focus:border-blue-500 focus:outline-none focus:ring-2 focus:ring-blue-200 dark:border-blue-700 dark:bg-blue-950 dark:focus:ring-blue-900"
+ />
+ <button
+ type="button"
+ onClick={() => void operations.handleGenerateToken()}
+ disabled={operations.isGeneratingToken()}
+ class="inline-flex min-h-10 items-center justify-center rounded-md bg-blue-600 px-4 py-2 text-sm font-medium text-white transition-colors hover:bg-blue-700 disabled:cursor-not-allowed disabled:opacity-60"
+ >
+ {operations.isGeneratingToken() ? 'Generating...' : 'Generate token'}
+ </button>
+ </div>
+ </section>
+ </Show>
+
+ <Show
+ when={
+ hasTokenGatedTargets() &&
+ !operations.requiresToken() &&
+ !operations.commandsUnlocked()
+ }
+ >
+ <section class="space-y-3 rounded-md border border-amber-200 bg-amber-50 px-4 py-3 text-sm text-amber-900 dark:border-amber-800 dark:bg-amber-950/30 dark:text-amber-100">
+ <p class="text-xs leading-5">
+ Tokens are optional on this Pulse instance. Confirm to generate update commands
+ without embedding a token.
+ </p>
+ <button
+ type="button"
+ onClick={operations.acknowledgeNoToken}
+ disabled={operations.confirmedNoToken()}
+ class="inline-flex min-h-9 items-center justify-center rounded-md border border-amber-300 bg-surface px-3 py-2 text-sm font-medium text-base-content transition-colors hover:bg-surface-hover disabled:cursor-default disabled:opacity-60"
+ >
+ {operations.confirmedNoToken() ? 'No token confirmed' : 'Confirm without token'}
+ </button>
+ </section>
+ </Show>
+
+ <div class="space-y-3">
+ <For each={props.targets}>
+ {(target) => {
+ const command = () =>
+ operations.getAgentConnectionUpgradeCommand(
+ target.connection,
+ target.installFlags,
+ );
+
+ return (
+ <section class="space-y-3 rounded-md border border-border bg-surface px-4 py-3">
+ <div class="flex flex-col gap-2 sm:flex-row sm:items-start sm:justify-between">
+ <div class="space-y-1">
+ <h3 class="text-sm font-semibold text-base-content">
+ {target.displayName}
+ </h3>
+ <p class="text-xs text-muted">
+ {target.contextLabel}
+ <Show when={target.currentVersion && target.expectedVersion}>
+ {' '}
+ · {target.currentVersion} -&gt; {target.expectedVersion}
+ </Show>
+ </p>
+ </div>
+ <span class="inline-flex w-fit items-center rounded-full bg-amber-100 px-2 py-0.5 text-[11px] font-medium text-amber-800 dark:bg-amber-900 dark:text-amber-200">
+ Update available
+ </span>
+ </div>
+
+ <Show
+ when={commandReadyForTarget(target)}
+ fallback={
+ <div class="rounded-md border border-border bg-surface-alt px-3 py-3 text-xs text-muted">
+ Generate a token to unlock the copyable update command.
+ </div>
+ }
+ >
+ <div class="relative">
+ <button
+ type="button"
+ onClick={() => void copyCommand(command())}
+ class={copyButtonClass}
+ title="Copy update command"
+ aria-label={`Copy update command for ${target.displayName}`}
+ >
+ <Copy class="h-4 w-4" />
+ </button>
+ <pre class="overflow-x-auto rounded-md bg-base p-3 pr-12 text-xs text-base-content">
+ <code>{command()}</code>
+ </pre>
+ </div>
+ </Show>
+ </section>
+ );
+ }}
+ </For>
+ </div>
+ </Show>
+ </div>
+ </div>
+ </Dialog>
+ );
+};
diff --git a/frontend-modern/src/components/Settings/InfrastructureWorkspace.tsx b/frontend-modern/src/components/Settings/InfrastructureWorkspace.tsx
index 481b3be8e5..d5eac04454 100644
--- a/frontend-modern/src/components/Settings/InfrastructureWorkspace.tsx
+++ b/frontend-modern/src/components/Settings/InfrastructureWorkspace.tsx
@@ -5,6 +5,7 @@ import { presentationPolicyIsReadOnly } from '@/stores/sessionPresentationPolicy
import { hasFeature, runtimeCapabilitiesLoaded } from '@/stores/license';
import { copyToClipboard } from '@/utils/clipboard';
import { notificationStore } from '@/stores/notifications';
+import { updateStore } from '@/stores/updates';
import { Dialog } from '@/components/shared/Dialog';
import { AgentProfilesPanel } from './AgentProfilesPanel';
import { ConnectionEditor } from './ConnectionEditor/ConnectionEditor';
@@ -16,6 +17,7 @@ import type { TrueNASConnection } from '@/api/truenas';
import type { VMwareConnection } from '@/api/vmware';
import type { NodeConfig, NodeConfigWithStatus } from '@/types/nodes';
import { InfrastructureDiscoverySettingsDialog } from './InfrastructureDiscoverySettingsDialog';
+import { InfrastructureAgentUpdatesDialog } from './InfrastructureAgentUpdatesDialog';
import {
InfrastructureInstallerSection,
type InfrastructureInstallerFocus,
@@ -31,10 +33,13 @@ import {
import {
buildInfrastructureOnboardingPath,
buildInfrastructureWorkspacePath,
+ deriveAgentUpdateScopeFromLocation,
+ deriveAgentUpdatesFromLocation,
deriveAddStepFromLocation,
type InfrastructureAddStep,
type InfrastructurePanelStep,
} from './infrastructureWorkspaceModel';
+import { collectInfrastructureAgentUpdateTargets } from './infrastructureAgentUpdateCommandsModel';
import type { InfrastructurePlatformSettingsProps } from './proxmoxSettingsModel';
import { useConnectionsLedger } from './useConnectionsLedger';
import { useConnectionRowActions } from './useConnectionRowActions';
@@ -131,6 +136,15 @@ const InfrastructureWorkspaceContent: Component<InfrastructureWorkspaceProps> =
if (readOnly()) return null;
return deriveAddStepFromLocation(location.pathname, location.search ?? '');
});
+ const showAgentUpdateCommands = createMemo(
+ () =>
+ !readOnly() &&
+ deriveAgentUpdatesFromLocation(location.pathname, location.search ?? '') &&
+ routeStep() === null,
+ );
+ const agentUpdateScope = createMemo(() =>
+ deriveAgentUpdateScopeFromLocation(location.pathname, location.search ?? ''),
+ );
const activeAddType = createMemo<ConnectionType | null>(() => {
const step = routeStep();
if (!step || step === 'pick' || step === 'detect') return null;
@@ -178,6 +192,13 @@ const InfrastructureWorkspaceContent: Component<InfrastructureWorkspaceProps> =
};
const rows = createMemo(() => ledger.rows());
+ const agentUpdateTargets = createMemo(() =>
+ collectInfrastructureAgentUpdateTargets(
+ rows(),
+ updateStore.versionInfo()?.version,
+ agentUpdateScope(),
+ ),
+ );
const visibleDiscoveredNodes = createMemo(() =>
filterRepresentedDiscoveredServers(
props.discoveredNodes(),
@@ -236,6 +257,10 @@ const InfrastructureWorkspaceContent: Component<InfrastructureWorkspaceProps> =
navigateToWorkspace(Boolean(routeStep()));
};
+ const closeAgentUpdateCommands = () => {
+ navigateToWorkspace(Boolean(showAgentUpdateCommands()));
+ };
+
const closeEditFlow = () => {
const connection = editingConnection();
if (connection) {
@@ -886,6 +911,14 @@ const InfrastructureWorkspaceContent: Component<InfrastructureWorkspaceProps> =
discoverySubnetInputRef={props.discoverySubnetInputRef}
/>
+ <Show when={showAgentUpdateCommands()}>
+ <InfrastructureAgentUpdatesDialog
+ isOpen={true}
+ targets={agentUpdateTargets()}
+ onClose={closeAgentUpdateCommands}
+ />
+ </Show>
+
<Show when={routeStep() !== null}>
<Dialog
isOpen={true}
diff --git a/frontend-modern/src/components/Settings/__tests__/InfrastructureOperationsModel.test.tsx b/frontend-modern/src/components/Settings/__tests__/InfrastructureOperationsModel.test.tsx
index 873252b13d..4dd7f92260 100644
--- a/frontend-modern/src/components/Settings/__tests__/InfrastructureOperationsModel.test.tsx
+++ b/frontend-modern/src/components/Settings/__tests__/InfrastructureOperationsModel.test.tsx
@@ -345,6 +345,36 @@ describe('infrastructure operations model', () => {
expect(operationsStateSource).not.toContain('const tokenEnv = token ?');
});
+ it('keeps stale Unix agent update commands on the saved-state update path', async () => {
+ const operationsStateSource = await import('../useInfrastructureOperationsState?raw').then(
+ (mod) => (mod as { default: string }).default,
+ );
+ const agentUpgradeStart = operationsStateSource.indexOf(
+ 'const getAgentConnectionUpgradeCommand =',
+ );
+ const agentUpgradeEnd = operationsStateSource.indexOf(
+ 'const getAgentConnectionUpgradeCommandRequiresToken',
+ agentUpgradeStart,
+ );
+ expect(agentUpgradeStart).toBeGreaterThanOrEqual(0);
+ expect(agentUpgradeEnd).toBeGreaterThan(agentUpgradeStart);
+ const agentUpgradeSource = operationsStateSource.slice(agentUpgradeStart, agentUpgradeEnd);
+ const unixUpgradeStart = agentUpgradeSource.indexOf('let command = `curl');
+ expect(unixUpgradeStart).toBeGreaterThanOrEqual(0);
+ const unixUpgradeSource = agentUpgradeSource.slice(unixUpgradeStart);
+
+ expect(agentUpgradeSource).toContain(
+ '| bash -s -- --update --url ${shellQuoteArg(url)} --non-interactive',
+ );
+ expect(operationsStateSource).toContain('getAgentConnectionUpgradeCommandRequiresToken');
+ expect(operationsStateSource).toContain(
+ "getConnectionUpgradePlatform(connection) === 'windows' && installState.requiresToken()",
+ );
+ expect(unixUpgradeSource).not.toContain('command += ` --token ${shellQuoteArg(token)}`;');
+ expect(unixUpgradeSource).not.toContain('--agent-id');
+ expect(unixUpgradeSource).not.toContain('--hostname');
+ });
+
it('keeps discovered-node filtering anchored to canonical represented-host dedupe', async () => {
const discoveryStateSource = await import('../useInfrastructureDiscoveryRuntimeState?raw').then(
(mod) => (mod as { default: string }).default,
diff --git a/frontend-modern/src/components/Settings/__tests__/InfrastructureWorkspace.test.tsx b/frontend-modern/src/components/Settings/__tests__/InfrastructureWorkspace.test.tsx
index c625411179..8ee3150e86 100644
--- a/frontend-modern/src/components/Settings/__tests__/InfrastructureWorkspace.test.tsx
+++ b/frontend-modern/src/components/Settings/__tests__/InfrastructureWorkspace.test.tsx
@@ -89,9 +89,20 @@ vi.mock('@/stores/sessionPresentationPolicy', () => ({
vi.mock('../useInfrastructureOperationsState', () => ({
InfrastructureOperationsStateProvider: (props: { children: unknown }) => <>{props.children}</>,
useInfrastructureOperationsContext: () => ({
+ acknowledgeNoToken: vi.fn(),
+ commandsUnlocked: () => true,
+ confirmedNoToken: () => true,
+ getAgentConnectionUpgradeCommand: (connection: Connection, installFlags: string[] = []) =>
+ `upgrade ${connection.id}${installFlags.length > 0 ? ` ${installFlags.join(' ')}` : ''}`,
+ getAgentConnectionUpgradeCommandRequiresToken: () => false,
getUninstallCommand: () => 'curl -fsSL http://pulse/install.sh | bash -s -- --uninstall',
getWindowsUninstallCommand: () =>
'$env:PULSE_URL="http://pulse"; $env:PULSE_UNINSTALL="true"; iwr /install.ps1 | iex',
+ handleGenerateToken: vi.fn(),
+ isGeneratingToken: () => false,
+ requiresToken: () => false,
+ setTokenName: vi.fn(),
+ tokenName: () => '',
}),
}));
@@ -342,6 +353,88 @@ describe('InfrastructureWorkspace', () => {
expect(screen.queryByRole('button', { name: /^Monitor endpoint$/i })).toBeNull();
});
+ it('opens stale agent update commands from the canonical route', async () => {
+ routeState.search = '?agentUpdates=1&agents=agent%3Aagent-zeus';
+ const primaryConnection = connectionFixture();
+ const attachedAgent = connectionFixture({
+ id: 'agent:agent-zeus',
+ type: 'agent',
+ name: 'zeus-agent',
+ address: 'zeus.lab',
+ surfaces: ['host'],
+ scope: { host: true },
+ source: 'agent',
+ agentVersion: '5.1.34',
+ expectedAgentVersion: '6.0.0-rc.6',
+ agentUpdateAvailable: true,
+ agentIdentity: {
+ hostname: 'zeus',
+ platform: 'linux',
+ },
+ capabilities: { supportsPause: false, supportsScope: false, supportsTest: false },
+ });
+ const unrelatedStaleAgent = connectionFixture({
+ id: 'agent:agent-other',
+ type: 'agent',
+ name: 'other-agent',
+ address: 'other.lab',
+ surfaces: ['host'],
+ scope: { host: true },
+ source: 'agent',
+ agentVersion: '5.1.34',
+ expectedAgentVersion: '6.0.0-rc.6',
+ agentUpdateAvailable: true,
+ agentIdentity: {
+ hostname: 'other',
+ platform: 'linux',
+ },
+ capabilities: { supportsPause: false, supportsScope: false, supportsTest: false },
+ });
+ connectionState.connections = [primaryConnection, attachedAgent, unrelatedStaleAgent];
+ connectionState.rows = [
+ {
+ id: primaryConnection.id,
+ ownerType: 'pve',
+ name: 'homelab',
+ subtitle: 'via platform API and Pulse Agent',
+ source: 'both',
+ host: primaryConnection.address,
+ coverageLabels: ['VMs', 'Host telemetry'],
+ statusLabel: 'Active',
+ statusClassName: 'bg-green-100 text-green-800',
+ agentUpdateCount: 1,
+ lastActivityText: '1m ago',
+ ...emptyFleetRow,
+ enabled: true,
+ canEdit: true,
+ canPause: true,
+ canRemove: true,
+ isAgent: false,
+ isCluster: false,
+ attachedConnections: [attachedAgent, unrelatedStaleAgent],
+ members: [],
+ connection: primaryConnection,
+ },
+ ];
+
+ renderWorkspace();
+
+ await waitFor(() => expect(screen.getByRole('dialog')).toBeInTheDocument());
+ expect(screen.getByText('Update Pulse Agents')).toBeInTheDocument();
+ expect(screen.getByText('zeus')).toBeInTheDocument();
+ expect(screen.queryByText('other')).not.toBeInTheDocument();
+ expect(screen.getByText(/5\.1\.34 -> 6\.0\.0-rc\.6/)).toBeInTheDocument();
+ expect(
+ screen.getByText(/upgrade agent:agent-zeus --enable-proxmox --proxmox-type pve/),
+ ).toBeInTheDocument();
+
+ fireEvent.click(screen.getByRole('button', { name: 'Close agent update commands' }));
+ expect(navigateSpy).toHaveBeenLastCalledWith('/settings/infrastructure', {
+ replace: true,
+ scroll: false,
+ });
+ });
+
it('keeps source groups in the catalog order instead of count order', async () => {
const pveConnection = connectionFixture({
id: 'pve:zeus',
diff --git a/frontend-modern/src/components/Settings/__tests__/infrastructureAgentUpdateCommandsModel.test.ts b/frontend-modern/src/components/Settings/__tests__/infrastructureAgentUpdateCommandsModel.test.ts
new file mode 100644
index 0000000000..993d6e48c7
--- /dev/null
+++ b/frontend-modern/src/components/Settings/__tests__/infrastructureAgentUpdateCommandsModel.test.ts
@@ -0,0 +1,197 @@
+import { describe, expect, it } from 'vitest';
+import type { Connection } from '@/api/connections';
+import type {
+ InfrastructureSystemMemberRow,
+ InfrastructureSystemRow,
+} from '../connectionsTableModel';
+import { collectInfrastructureAgentUpdateTargets } from '../infrastructureAgentUpdateCommandsModel';
+
+const connection = (overrides: Partial<Connection> = {}): Connection => ({
+ id: 'pve:homelab',
+ type: 'pve',
+ name: 'homelab',
+ address: 'https://pve.lab:8006',
+ state: 'active',
+ stateReason: '',
+ enabled: true,
+ surfaces: ['vms'],
+ scope: { vms: true },
+ lastSeen: new Date().toISOString(),
+ lastError: null,
+ source: 'manual',
+ capabilities: { supportsPause: true, supportsScope: true, supportsTest: true },
+ ...overrides,
+});
+
+const emptyFleetRow = {
+ fleetSignals: [],
+ fleetHighlights: [],
+} satisfies Pick<InfrastructureSystemRow, 'fleetSignals' | 'fleetHighlights'>;
+
+const emptyFleetMember = {
+ fleetSignals: [],
+ fleetHighlights: [],
+} satisfies Pick<InfrastructureSystemMemberRow, 'fleetSignals' | 'fleetHighlights'>;
+
+const row = (overrides: Partial<InfrastructureSystemRow> = {}): InfrastructureSystemRow => {
+ const primary = connection();
+ return {
+ id: primary.id,
+ ownerType: 'pve',
+ name: 'homelab',
+ subtitle: 'Cluster · 2 nodes',
+ source: 'both',
+ host: primary.address,
+ coverageLabels: ['VMs', 'Host telemetry'],
+ statusLabel: 'Active',
+ statusClassName: 'bg-green-100 text-green-800',
+ agentUpdateCount: 0,
+ lastActivityText: '1m ago',
+ ...emptyFleetRow,
+ enabled: true,
+ canEdit: true,
+ canPause: true,
+ canRemove: true,
+ isAgent: false,
+ isCluster: false,
+ attachedConnections: [],
+ members: [],
+ connection: primary,
+ ...overrides,
+ };
+};
+
+describe('infrastructure agent update commands model', () => {
+ it('collects stale attached agents once with row-scoped update flags', () => {
+ const staleAgent = connection({
+ id: 'agent:agent-delly',
+ type: 'agent',
+ name: 'delly-agent',
+ address: 'delly',
+ surfaces: ['host'],
+ scope: { host: true },
+ source: 'agent',
+ agentVersion: '5.1.34',
+ expectedAgentVersion: '6.0.0-rc.6',
+ agentUpdateAvailable: true,
+ agentIdentity: { hostname: 'delly', platform: 'linux' },
+ capabilities: { supportsPause: false, supportsScope: false, supportsTest: false },
+ });
+ const currentAgent = connection({
+ id: 'agent:agent-minipc',
+ type: 'agent',
+ name: 'minipc',
+ address: 'minipc',
+ surfaces: ['host'],
+ scope: { host: true },
+ source: 'agent',
+ agentVersion: '6.0.0-rc.6',
+ expectedAgentVersion: '6.0.0-rc.6',
+ agentUpdateAvailable: false,
+ capabilities: { supportsPause: false, supportsScope: false, supportsTest: false },
+ });
+
+ const targets = collectInfrastructureAgentUpdateTargets([
+ row({
+ attachedConnections: [staleAgent, currentAgent],
+ members: [
+ {
+ id: 'node-delly',
+ name: 'delly',
+ subtitle: 'Primary node',
+ source: 'both',
+ host: 'https://delly:8006',
+ coverageLabels: ['Host telemetry'],
+ statusLabel: 'Active',
+ statusClassName: 'bg-green-100 text-green-800',
+ lastActivityText: '1m ago',
+ ...emptyFleetMember,
+ primary: true,
+ agentConnection: staleAgent,
+ },
+ ],
+ }),
+ ]);
+
+ expect(targets).toHaveLength(1);
+ expect(targets[0]).toMatchObject({
+ key: 'agent:agent-delly',
+ displayName: 'delly',
+ contextLabel: 'homelab',
+ currentVersion: '5.1.34',
+ expectedVersion: '6.0.0-rc.6',
+ installFlags: ['--enable-proxmox', '--proxmox-type pve'],
+ });
+ });
+
+ it('falls back to the app build version when the connections ledger has no target version', () => {
+ const staleAgent = connection({
+ id: 'agent:agent-delly',
+ type: 'agent',
+ name: 'delly',
+ address: 'delly',
+ surfaces: ['host'],
+ scope: { host: true },
+ source: 'agent',
+ agentVersion: 'v6.0.0-rc.5',
+ agentUpdateAvailable: false,
+ capabilities: { supportsPause: false, supportsScope: false, supportsTest: false },
+ });
+
+ const targets = collectInfrastructureAgentUpdateTargets(
+ [
+ row({
+ attachedConnections: [staleAgent],
+ }),
+ ],
+ '6.0.0-rc.6+git.172.g2c360f779.dirty',
+ );
+
+ expect(targets).toHaveLength(1);
+ expect(targets[0]).toMatchObject({
+ key: 'agent:agent-delly',
+ currentVersion: 'v6.0.0-rc.5',
+ expectedVersion: 'v6.0.0-rc.6',
+ });
+ });
+
+ it('filters to scoped agent IDs when a platform notice links to specific hosts', () => {
+ const staleDelly = connection({
+ id: 'agent:agent-delly',
+ type: 'agent',
+ name: 'delly',
+ address: 'delly',
+ surfaces: ['host'],
+ scope: { host: true },
+ source: 'agent',
+ agentVersion: 'v6.0.0-rc.5',
+ agentUpdateAvailable: false,
+ capabilities: { supportsPause: false, supportsScope: false, supportsTest: false },
+ });
+ const stalePi = connection({
+ id: 'agent:agent-pi',
+ type: 'agent',
+ name: 'pi',
+ address: 'pi',
+ surfaces: ['host'],
+ scope: { host: true },
+ source: 'agent',
+ agentVersion: 'v6.0.0-rc.5',
+ agentUpdateAvailable: false,
+ capabilities: { supportsPause: false, supportsScope: false, supportsTest: false },
+ });
+
+ const targets = collectInfrastructureAgentUpdateTargets(
+ [
+ row({
+ attachedConnections: [staleDelly, stalePi],
+ }),
+ ],
+ 'v6.0.0-rc.6',
+ ['agent-pi'],
+ );
+
+ expect(targets).toHaveLength(1);
+ expect(targets[0]?.key).toBe('agent:agent-pi');
+ });
+});
diff --git a/frontend-modern/src/components/Settings/__tests__/infrastructureWorkspaceModel.test.ts b/frontend-modern/src/components/Settings/__tests__/infrastructureWorkspaceModel.test.ts
index d99f62bb74..f2c9c0015b 100644
--- a/frontend-modern/src/components/Settings/__tests__/infrastructureWorkspaceModel.test.ts
+++ b/frontend-modern/src/components/Settings/__tests__/infrastructureWorkspaceModel.test.ts
@@ -1,7 +1,10 @@
import { describe, expect, it } from 'vitest';
import {
+ buildInfrastructureAgentUpdatesPath,
buildInfrastructureOnboardingPath,
buildInfrastructureWorkspacePath,
+ deriveAgentUpdateScopeFromLocation,
+ deriveAgentUpdatesFromLocation,
deriveAddStepFromLocation,
} from '../infrastructureWorkspaceModel';
@@ -24,6 +27,31 @@ describe('infrastructureWorkspaceModel', () => {
expect(buildInfrastructureOnboardingPath('vmware')).toBe('/settings/infrastructure?add=vmware');
});
+ it('builds and derives the canonical agent update command route', () => {
+ expect(buildInfrastructureAgentUpdatesPath()).toBe('/settings/infrastructure?agentUpdates=1');
+ expect(buildInfrastructureAgentUpdatesPath(['agent:agent-delly', 'agent-pi'])).toBe(
+ '/settings/infrastructure?agentUpdates=1&agents=agent%3Aagent-delly&agents=agent%3Aagent-pi',
+ );
+ expect(deriveAgentUpdatesFromLocation('/settings/infrastructure', '?agentUpdates=1')).toBe(
+ true,
+ );
+ expect(
+ deriveAgentUpdateScopeFromLocation(
+ '/settings/infrastructure',
+ '?agentUpdates=1&agents=agent%3Aagent-pi&agents=agent-delly',
+ ),
+ ).toEqual(['agent:agent-delly', 'agent:agent-pi']);
+ expect(deriveAgentUpdatesFromLocation('/settings/infrastructure', '?agentUpdates=0')).toBe(
+ false,
+ );
+ expect(
+ deriveAgentUpdateScopeFromLocation('/settings/infrastructure', '?agentUpdates=0&agents=a'),
+ ).toEqual([]);
+ expect(
+ deriveAgentUpdatesFromLocation('/settings/infrastructure/install', '?agentUpdates=1'),
+ ).toBe(false);
+ });
+
it('derives add steps only from the canonical infrastructure workspace query', () => {
expect(deriveAddStepFromLocation('/settings/infrastructure', '?add=agent')).toBe('agent');
expect(deriveAddStepFromLocation('/settings/infrastructure', '?add=pick')).toBe('pick');
diff --git a/frontend-modern/src/components/Settings/infrastructureAgentUpdateCommandsModel.ts b/frontend-modern/src/components/Settings/infrastructureAgentUpdateCommandsModel.ts
new file mode 100644
index 0000000000..6b4b9ea31d
--- /dev/null
+++ b/frontend-modern/src/components/Settings/infrastructureAgentUpdateCommandsModel.ts
@@ -0,0 +1,124 @@
+import type { Connection } from '@/api/connections';
+import { compareAgentVersions, formatAgentVersionDisplay } from '@/utils/agentVersion';
+import type { InfrastructureSystemRow } from './connectionsTableModel';
+
+export type InfrastructureAgentUpdateTarget = {
+ key: string;
+ connection: Connection;
+ displayName: string;
+ contextLabel: string;
+ currentVersion?: string;
+ expectedVersion?: string;
+ installFlags: string[];
+};
+
+const maybeAdd = (flags: Set<string>, flag: string) => {
+ if (flag.trim()) flags.add(flag);
+};
+
+const normalizeAgentConnectionID = (value: string | null | undefined): string => {
+ const trimmed = (value || '').trim();
+ if (!trimmed) return '';
+ return trimmed.startsWith('agent:') ? trimmed : `agent:${trimmed}`;
+};
+
+const updateInstallFlagsForRow = (row: InfrastructureSystemRow): string[] => {
+ const flags = new Set<string>();
+
+ switch (row.ownerType) {
+ case 'pve':
+ maybeAdd(flags, '--enable-proxmox');
+ maybeAdd(flags, '--proxmox-type pve');
+ break;
+ case 'pbs':
+ maybeAdd(flags, '--enable-proxmox');
+ maybeAdd(flags, '--proxmox-type pbs');
+ break;
+ case 'docker':
+ maybeAdd(flags, '--enable-docker');
+ break;
+ case 'kubernetes':
+ maybeAdd(flags, '--enable-kubernetes');
+ break;
+ }
+
+ return Array.from(flags);
+};
+
+const connectionDisplayName = (connection: Connection): string =>
+ connection.agentIdentity?.hostname?.trim() ||
+ connection.name?.trim() ||
+ connection.address?.trim() ||
+ connection.id;
+
+const rowContextLabel = (row: InfrastructureSystemRow): string => {
+ if (row.isCluster && row.name.trim()) return row.name;
+ if (row.ownerType === 'agent') return 'Machine';
+ return row.name.trim() || row.connection.name || row.ownerType;
+};
+
+const connectionNeedsUpdate = (connection: Connection, targetVersion?: string | null): boolean => {
+ if (connection.agentUpdateAvailable) return true;
+ const currentVersion = connection.agentVersion?.trim();
+ if (!currentVersion || !targetVersion) return false;
+ const comparison = compareAgentVersions(currentVersion, targetVersion);
+ return comparison !== null && comparison < 0;
+};
+
+const expectedVersionFor = (connection: Connection, targetVersion?: string | null) =>
+ connection.expectedAgentVersion?.trim() || formatAgentVersionDisplay(targetVersion) || undefined;
+
+const pushTarget = (
+ targetsByID: Map<string, InfrastructureAgentUpdateTarget>,
+ row: InfrastructureSystemRow,
+ connection?: Connection,
+ targetVersion?: string | null,
+) => {
+ if (
+ !connection ||
+ connection.type !== 'agent' ||
+ !connectionNeedsUpdate(connection, targetVersion)
+ )
+ return;
+
+ const key = connection.id;
+ if (targetsByID.has(key)) return;
+
+ targetsByID.set(key, {
+ key,
+ connection,
+ displayName: connectionDisplayName(connection),
+ contextLabel: rowContextLabel(row),
+ currentVersion: connection.agentVersion?.trim() || undefined,
+ expectedVersion: expectedVersionFor(connection, targetVersion),
+ installFlags: updateInstallFlagsForRow(row),
+ });
+};
+
+export const collectInfrastructureAgentUpdateTargets = (
+ rows: readonly InfrastructureSystemRow[],
+ targetVersion?: string | null,
+ scopedAgentIds: readonly string[] = [],
+): InfrastructureAgentUpdateTarget[] => {
+ const targetsByID = new Map<string, InfrastructureAgentUpdateTarget>();
+ const scopedAgentIDSet = new Set(
+ scopedAgentIds.map(normalizeAgentConnectionID).filter((value) => value.length > 0),
+ );
+
+ for (const row of rows) {
+ pushTarget(targetsByID, row, row.connection, targetVersion);
+ for (const connection of row.attachedConnections) {
+ pushTarget(targetsByID, row, connection, targetVersion);
+ }
+ for (const member of row.members) {
+ pushTarget(targetsByID, row, member.agentConnection, targetVersion);
+ }
+ }
+
+ return Array.from(targetsByID.values())
+ .filter(
+ (target) =>
+ scopedAgentIDSet.size === 0 || scopedAgentIDSet.has(normalizeAgentConnectionID(target.key)),
+ )
+ .sort((left, right) => left.displayName.localeCompare(right.displayName));
+};
diff --git a/frontend-modern/src/components/Settings/infrastructureWorkspaceModel.ts b/frontend-modern/src/components/Settings/infrastructureWorkspaceModel.ts
index e74c7d3616..b7a0116e69 100644
--- a/frontend-modern/src/components/Settings/infrastructureWorkspaceModel.ts
+++ b/frontend-modern/src/components/Settings/infrastructureWorkspaceModel.ts
@@ -14,6 +14,8 @@ export type InfrastructurePanelStep = 'pick' | InfrastructureAddStep;
const INFRASTRUCTURE_BASE_PATH = '/settings/infrastructure';
export const INFRASTRUCTURE_ADD_QUERY_PARAM = 'add';
+export const INFRASTRUCTURE_AGENT_UPDATES_QUERY_PARAM = 'agentUpdates';
+export const INFRASTRUCTURE_AGENT_UPDATE_IDS_QUERY_PARAM = 'agents';
export function normalizeInfrastructurePanelStep(
value: string | null | undefined,
@@ -41,6 +43,26 @@ export function buildInfrastructureWorkspacePath(): string {
return INFRASTRUCTURE_BASE_PATH;
}
+const normalizeAgentUpdateConnectionID = (value: string | null | undefined): string | null => {
+ const trimmed = (value || '').trim();
+ if (!trimmed) return null;
+ return trimmed.startsWith('agent:') ? trimmed : `agent:${trimmed}`;
+};
+
+export function buildInfrastructureAgentUpdatesPath(
+ agentIds: readonly (string | null | undefined)[] = [],
+): string {
+ const params = new URLSearchParams();
+ params.set(INFRASTRUCTURE_AGENT_UPDATES_QUERY_PARAM, '1');
+ const normalizedAgentIds = Array.from(
+ new Set(agentIds.map(normalizeAgentUpdateConnectionID).filter(Boolean) as string[]),
+ ).sort((left, right) => left.localeCompare(right));
+ for (const agentId of normalizedAgentIds) {
+ params.append(INFRASTRUCTURE_AGENT_UPDATE_IDS_QUERY_PARAM, agentId);
+ }
+ return `${INFRASTRUCTURE_BASE_PATH}?${params.toString()}`;
+}
+
export function buildInfrastructureOnboardingPath(step: InfrastructurePanelStep = 'agent'): string {
const params = new URLSearchParams();
params.set(INFRASTRUCTURE_ADD_QUERY_PARAM, step);
@@ -62,3 +84,28 @@ export function deriveAddStepFromLocation(
return deriveAddStepFromSearch(search);
}
+
+export function deriveAgentUpdatesFromLocation(pathname: string, search: string): boolean {
+ if (pathname !== INFRASTRUCTURE_BASE_PATH && pathname !== `${INFRASTRUCTURE_BASE_PATH}/`) {
+ return false;
+ }
+
+ const params = new URLSearchParams(search);
+ return params.get(INFRASTRUCTURE_AGENT_UPDATES_QUERY_PARAM) === '1';
+}
+
+export function deriveAgentUpdateScopeFromLocation(pathname: string, search: string): string[] {
+ if (!deriveAgentUpdatesFromLocation(pathname, search)) {
+ return [];
+ }
+
+ const params = new URLSearchParams(search);
+ return Array.from(
+ new Set(
+ params
+ .getAll(INFRASTRUCTURE_AGENT_UPDATE_IDS_QUERY_PARAM)
+ .map(normalizeAgentUpdateConnectionID)
+ .filter(Boolean) as string[],
+ ),
+ ).sort((left, right) => left.localeCompare(right));
+}
diff --git a/frontend-modern/src/components/Settings/useInfrastructureOperationsState.tsx b/frontend-modern/src/components/Settings/useInfrastructureOperationsState.tsx
index 7f93d492e4..c1afef4ba0 100644
--- a/frontend-modern/src/components/Settings/useInfrastructureOperationsState.tsx
+++ b/frontend-modern/src/components/Settings/useInfrastructureOperationsState.tsx
@@ -1,4 +1,5 @@
import { createContext, useContext, type ParentComponent } from 'solid-js';
+import type { Connection } from '@/api/connections';
import {
buildPowerShellInstallScriptBootstrap,
buildWindowsAgentInstallCommand,
@@ -70,6 +71,32 @@ export const useInfrastructureOperationsState = (
const getCanonicalUninstallAgentId = (row?: UnifiedAgentRow) =>
row?.agentActionId?.trim() || row?.agentId?.trim() || '';
const getCanonicalUninstallHostname = (row?: UnifiedAgentRow) => row?.hostname?.trim() || '';
+ const getCanonicalConnectionAgentId = (connection: Connection) => {
+ if (connection.type !== 'agent') return '';
+ const id = connection.id.trim();
+ return id.startsWith('agent:') ? id.slice('agent:'.length).trim() : id;
+ };
+ const getCanonicalConnectionHostname = (connection: Connection) => {
+ const hostname = connection.agentIdentity?.hostname?.trim();
+ if (hostname) return hostname;
+ const address = connection.address?.trim();
+ if (address && !address.includes('://')) return address;
+ return connection.name?.trim() || '';
+ };
+ const getConnectionUpgradePlatform = (connection: Connection): AgentPlatform => {
+ const platform = connection.agentIdentity?.platform?.trim().toLowerCase();
+ switch (platform) {
+ case 'windows':
+ return 'windows';
+ case 'darwin':
+ case 'macos':
+ return 'macos';
+ case 'freebsd':
+ return 'freebsd';
+ default:
+ return 'linux';
+ }
+ };
const getUninstallCommand = (row?: UnifiedAgentRow) => {
const url = installState.selectedAgentUrl();
@@ -158,8 +185,60 @@ export const useInfrastructureOperationsState = (
return withPrivilegeEscalation(command);
};
+ const getAgentConnectionUpgradeCommand = (
+ connection: Connection,
+ installFlags: string[] = [],
+ ) => {
+ const token = resolvedCommandToken();
+ const url = installState.selectedAgentUrl();
+ const agentId = getCanonicalConnectionAgentId(connection);
+ const hostname = getCanonicalConnectionHostname(connection);
+ const commandsEnabled = Boolean(connection.agentIdentity?.commandsEnabled);
+ const platform = getConnectionUpgradePlatform(connection);
+ if (platform === 'windows') {
+ const envAssignments = [
+ ...getPowerShellInstallProfileEnvFromFlags(installFlags),
+ ...getPowerShellModeEnv(),
+ ];
+ if (commandsEnabled && !installState.enableCommands()) {
+ envAssignments.push(`$env:PULSE_ENABLE_COMMANDS="true"`);
+ }
+ if (agentId) {
+ envAssignments.push(`$env:PULSE_AGENT_ID="${powerShellQuote(agentId)}"`);
+ }
+ if (hostname) {
+ envAssignments.push(`$env:PULSE_HOSTNAME="${powerShellQuote(hostname)}"`);
+ }
+ return buildWindowsAgentInstallCommand({
+ baseUrl: url,
+ token,
+ insecure: installState.insecureMode(),
+ caCertPath: selectedCustomCaPath(),
+ extraEnvAssignments: envAssignments,
+ });
+ }
+
+ let command = `curl ${getCurlFlags()}${getShellCustomCaCurlFlag()} ${shellQuoteArg(`${url}/install.sh`)} | bash -s -- --update --url ${shellQuoteArg(url)} --non-interactive`;
+ if (installFlags.length > 0) {
+ command += ` ${installFlags.join(' ')}`;
+ }
+ if (commandsEnabled || installState.enableCommands()) {
+ command += ' --enable-commands';
+ }
+ if (urlRequiresInstallerInsecure(url)) {
+ command += getInsecureFlag(url);
+ }
+ command += getShellCustomCaInstallerFlag();
+ return withPrivilegeEscalation(command);
+ };
+
+ const getAgentConnectionUpgradeCommandRequiresToken = (connection: Connection) =>
+ getConnectionUpgradePlatform(connection) === 'windows' && installState.requiresToken();
+
return {
...installState,
+ getAgentConnectionUpgradeCommand,
+ getAgentConnectionUpgradeCommandRequiresToken,
getPlatformUninstallCommand,
getUninstallCommand,
getUpgradeCommand,
diff --git a/frontend-modern/src/features/docker/DockerPageSurface.tsx b/frontend-modern/src/features/docker/DockerPageSurface.tsx
index bebcc3cec8..892b37f05b 100644
--- a/frontend-modern/src/features/docker/DockerPageSurface.tsx
+++ b/frontend-modern/src/features/docker/DockerPageSurface.tsx
@@ -40,7 +40,7 @@ import {
} from '@/features/platformPage/agentVersion';
import { PlatformOutdatedAgentNotice } from '@/features/platformPage/PlatformOutdatedAgentNotice';
import { updateStore } from '@/stores/updates';
-import { buildInfrastructureWorkspacePath } from '@/components/Settings/infrastructureWorkspaceModel';
+import { buildInfrastructureAgentUpdatesPath } from '@/components/Settings/infrastructureWorkspaceModel';
const DOCKER_RESOURCE_QUERY =
'type=agent,docker-host,app-container,docker-service,docker-image,docker-volume,docker-network,docker-task,docker-swarm-node,docker-secret,docker-config';
@@ -67,6 +67,9 @@ export function DockerPageSurface() {
const outdatedAgentHosts = createMemo(() =>
collectOutdatedAgentHosts(model().hosts, updateStore.versionInfo()?.version),
);
+ const outdatedAgentUpdatePath = createMemo(() =>
+ buildInfrastructureAgentUpdatesPath(outdatedAgentHosts().map((host) => host.agentId)),
+ );
const serverVersionDisplay = createMemo(() =>
formatAgentVersionDisplay(updateStore.versionInfo()?.version),
);
@@ -112,7 +115,7 @@ export function DockerPageSurface() {
hosts={outdatedAgentHosts()}
targetVersion={serverVersionDisplay()}
missingLabel="images, networks, storage, and Swarm details"
- actionHref={buildInfrastructureWorkspacePath()}
+ actionHref={outdatedAgentUpdatePath()}
actionLabel="Open agent upgrade commands"
/>
<Show when={activeTab() === 'overview'}>
diff --git a/frontend-modern/src/features/docker/__tests__/DockerPageSurface.test.tsx b/frontend-modern/src/features/docker/__tests__/DockerPageSurface.test.tsx
index 559b708690..1f2aa6b5ba 100644
--- a/frontend-modern/src/features/docker/__tests__/DockerPageSurface.test.tsx
+++ b/frontend-modern/src/features/docker/__tests__/DockerPageSurface.test.tsx
@@ -67,6 +67,12 @@ vi.mock('@/hooks/useUnifiedResources', () => ({
useUnifiedResources: mocks.useUnifiedResources,
}));
+vi.mock('@/stores/updates', () => ({
+ updateStore: {
+ versionInfo: () => ({ version: '6.0.0-rc.6' }),
+ },
+}));
+
vi.mock('@solidjs/router', () => ({
useLocation: () => ({
get pathname() {
@@ -238,10 +244,7 @@ describe('DockerPageSurface', () => {
);
expect(screen.getByTestId('docker-hosts-table')).toHaveAttribute('data-resource-count', '1');
expect(screen.getByTestId('docker-hosts-table')).toHaveAttribute('data-show-toolbar', 'false');
- expect(screen.getByTestId('docker-section-tabs')).toHaveAttribute(
- 'data-tabs',
- 'overview',
- );
+ expect(screen.getByTestId('docker-section-tabs')).toHaveAttribute('data-tabs', 'overview');
expect(screen.getByTestId('docker-containers-table')).toHaveAttribute(
'data-resource-count',
'1',
@@ -252,6 +255,27 @@ describe('DockerPageSurface', () => {
);
});
+ it('routes stale agent notices to the agent install commands', () => {
+ mocks.useUnifiedResources.mockReturnValue({
+ error: () => null,
+ loading: () => false,
+ refetch: vi.fn(),
+ resources: () => [
+ makeDockerHost({
+ name: 'docker-old-agent',
+ agent: { agentId: 'agent-docker-old', agentVersion: 'v5.1.34' },
+ }),
+ ],
+ });
+
+ render(() => <DockerPageSurface />);
+
+ expect(screen.getByRole('link', { name: 'Open agent upgrade commands' })).toHaveAttribute(
+ 'href',
+ '/settings/infrastructure?agentUpdates=1&agents=agent%3Aagent-docker-old',
+ );
+ });
+
it('shows Docker object tabs only when the matching inventory exists', () => {
mocks.useUnifiedResources.mockReturnValue({
error: () => null,
diff --git a/frontend-modern/src/features/kubernetes/KubernetesPageSurface.tsx b/frontend-modern/src/features/kubernetes/KubernetesPageSurface.tsx
index 822d3bb768..a4a9acec09 100644
--- a/frontend-modern/src/features/kubernetes/KubernetesPageSurface.tsx
+++ b/frontend-modern/src/features/kubernetes/KubernetesPageSurface.tsx
@@ -1,6 +1,6 @@
import { useLocation, useSearchParams } from '@solidjs/router';
import { Show, createMemo, createSignal, type Accessor } from 'solid-js';
-import { buildInfrastructureWorkspacePath } from '@/components/Settings/infrastructureWorkspaceModel';
+import { buildInfrastructureAgentUpdatesPath } from '@/components/Settings/infrastructureWorkspaceModel';
import type { FilterDef } from '@/components/shared/FilterBar';
import { getPlatformIcon } from '@/features/platformPage/platformIcon';
import { PlatformOutdatedAgentNotice } from '@/features/platformPage/PlatformOutdatedAgentNotice';
@@ -72,17 +72,16 @@ export function KubernetesPageSurface() {
const outdatedAgentHosts = createMemo(() =>
collectOutdatedAgentHosts(model().nodes, updateStore.versionInfo()?.version),
);
+ const outdatedAgentUpdatePath = createMemo(() =>
+ buildInfrastructureAgentUpdatesPath(outdatedAgentHosts().map((host) => host.agentId)),
+ );
const serverVersionDisplay = createMemo(() =>
formatAgentVersionDisplay(updateStore.versionInfo()?.version),
);
return (
<div data-testid="kubernetes-page" class="space-y-3">
- <PlatformSectionTabs
- tabs={tabs()}
- active={activeTab()}
- ariaLabel="Kubernetes sections"
- />
+ <PlatformSectionTabs tabs={tabs()} active={activeTab()} ariaLabel="Kubernetes sections" />
<Show
when={!loading() || model().resources.length > 0}
@@ -117,7 +116,7 @@ export function KubernetesPageSurface() {
hosts={outdatedAgentHosts()}
targetVersion={serverVersionDisplay()}
missingLabel="Kubernetes nodes, workloads, services, storage, configuration, and events"
- actionHref={buildInfrastructureWorkspacePath()}
+ actionHref={outdatedAgentUpdatePath()}
actionLabel="Open agent upgrade commands"
/>
<Show when={activeTab() === 'overview'}>
diff --git a/frontend-modern/src/features/kubernetes/__tests__/KubernetesPageSurface.contract.test.tsx b/frontend-modern/src/features/kubernetes/__tests__/KubernetesPageSurface.contract.test.tsx
index 3c29a11154..917e6c1d23 100644
--- a/frontend-modern/src/features/kubernetes/__tests__/KubernetesPageSurface.contract.test.tsx
+++ b/frontend-modern/src/features/kubernetes/__tests__/KubernetesPageSurface.contract.test.tsx
@@ -222,7 +222,7 @@ describe('KubernetesPageSurface contract', () => {
name: 'k8s-node-1',
type: 'agent',
sources: ['agent', 'kubernetes'],
- agent: { agentVersion: 'v5.1.34' },
+ agent: { agentId: 'agent-k8s-node-1', agentVersion: 'v5.1.34' },
}),
]);
@@ -233,7 +233,7 @@ describe('KubernetesPageSurface contract', () => {
expect(notice).toHaveTextContent('Kubernetes nodes, workloads, services, storage');
expect(screen.getByRole('link', { name: 'Open agent upgrade commands' })).toHaveAttribute(
'href',
- '/settings/infrastructure',
+ '/settings/infrastructure?agentUpdates=1&agents=agent%3Aagent-k8s-node-1',
);
});
diff --git a/frontend-modern/src/features/platformPage/agentVersion.test.ts b/frontend-modern/src/features/platformPage/agentVersion.test.ts
index b3c74ec0ca..8f9d73210c 100644
--- a/frontend-modern/src/features/platformPage/agentVersion.test.ts
+++ b/frontend-modern/src/features/platformPage/agentVersion.test.ts
@@ -4,6 +4,7 @@ import {
collectOutdatedAgentHosts,
compareAgentVersions,
formatAgentVersionDisplay,
+ hostAgentConnectionID,
hostAgentVersion,
parseAgentVersion,
} from './agentVersion';
@@ -68,24 +69,36 @@ describe('formatAgentVersionDisplay', () => {
});
});
-const host = (over: Partial<Resource>): Resource => ({ id: 'x', name: 'host', type: 'docker-host', ...over }) as Resource;
+const host = (over: Partial<Resource>): Resource =>
+ ({ id: 'x', name: 'host', type: 'docker-host', ...over }) as Resource;
describe('hostAgentVersion', () => {
it('reads the docker meta version for a docker host', () => {
- expect(hostAgentVersion(host({ docker: { agentVersion: 'v6.0.0-rc.5' } as Resource['docker'] }))).toBe(
- 'v6.0.0-rc.5',
- );
+ expect(
+ hostAgentVersion(host({ docker: { agentVersion: 'v6.0.0-rc.5' } as Resource['docker'] })),
+ ).toBe('v6.0.0-rc.5');
});
it('falls back to the agent meta version for a plain agent host', () => {
- expect(hostAgentVersion(host({ agent: { agentVersion: 'v6.0.0-rc.5' } as Resource['agent'] }))).toBe(
- 'v6.0.0-rc.5',
- );
+ expect(
+ hostAgentVersion(host({ agent: { agentVersion: 'v6.0.0-rc.5' } as Resource['agent'] })),
+ ).toBe('v6.0.0-rc.5');
});
it('returns undefined when no version is reported', () => {
expect(hostAgentVersion(host({}))).toBeUndefined();
});
+
+ it('normalizes agent connection IDs from agent and Kubernetes metadata', () => {
+ expect(
+ hostAgentConnectionID(host({ agent: { agentId: 'agent-delly' } as Resource['agent'] })),
+ ).toBe('agent:agent-delly');
+ expect(
+ hostAgentConnectionID(
+ host({ kubernetes: { agentId: 'agent:agent-k8s' } as Resource['kubernetes'] }),
+ ),
+ ).toBe('agent:agent-k8s');
+ });
});
describe('collectOutdatedAgentHosts', () => {
@@ -95,11 +108,14 @@ describe('collectOutdatedAgentHosts', () => {
const hosts = [
host({ name: 'tower', docker: { agentVersion: 'v6.0.0-rc.5' } as Resource['docker'] }),
host({ name: 'current', docker: { agentVersion: 'v6.0.0-rc.6' } as Resource['docker'] }),
- host({ name: 'delly', agent: { agentVersion: 'v6.0.0-rc.5' } as Resource['agent'] }),
+ host({
+ name: 'delly',
+ agent: { agentId: 'agent-delly', agentVersion: 'v6.0.0-rc.5' } as Resource['agent'],
+ }),
];
expect(collectOutdatedAgentHosts(hosts, server)).toEqual([
{ name: 'tower', version: 'v6.0.0-rc.5' },
- { name: 'delly', version: 'v6.0.0-rc.5' },
+ { name: 'delly', version: 'v6.0.0-rc.5', agentId: 'agent:agent-delly' },
]);
});
@@ -108,7 +124,9 @@ describe('collectOutdatedAgentHosts', () => {
});
it('returns nothing when the server version is unknown or unparseable', () => {
- const hosts = [host({ name: 'tower', docker: { agentVersion: 'v6.0.0-rc.5' } as Resource['docker'] })];
+ const hosts = [
+ host({ name: 'tower', docker: { agentVersion: 'v6.0.0-rc.5' } as Resource['docker'] }),
+ ];
expect(collectOutdatedAgentHosts(hosts, '')).toEqual([]);
expect(collectOutdatedAgentHosts(hosts, 'dev')).toEqual([]);
});
diff --git a/frontend-modern/src/features/platformPage/agentVersion.ts b/frontend-modern/src/features/platformPage/agentVersion.ts
index ad2f8b41f2..0107e49606 100644
--- a/frontend-modern/src/features/platformPage/agentVersion.ts
+++ b/frontend-modern/src/features/platformPage/agentVersion.ts
@@ -1,4 +1,15 @@
import type { Resource } from '@/types/resource';
+export {
+ compareAgentVersions,
+ formatAgentVersionDisplay,
+ parseAgentVersion,
+ type ParsedAgentVersion,
+} from '@/utils/agentVersion';
+import {
+ compareAgentVersions,
+ formatAgentVersionDisplay,
+ parseAgentVersion,
+} from '@/utils/agentVersion';
// Agent staleness helpers for platform pages.
//
@@ -11,108 +22,22 @@ import type { Resource } from '@/types/resource';
// second case by comparing each host's reported agent version against the
// server that is rendering the page.
-export type ParsedAgentVersion = {
- major: number;
- minor: number;
- patch: number;
- // Pre-release identifiers, e.g. ['rc', '5']. Empty means a stable release,
- // which always outranks any pre-release of the same core version.
- prerelease: string[];
-};
-
-// Parse a semver-shaped version string. Tolerates a leading `v`/`V` and strips
-// build metadata (`+git.151.g...`) which carries no precedence. Returns null
-// for anything that is not at least `major.minor.patch`.
-export function parseAgentVersion(raw?: string | null): ParsedAgentVersion | null {
- if (!raw) return null;
- let value = raw.trim();
- if (!value) return null;
-
- const buildIdx = value.indexOf('+');
- if (buildIdx >= 0) value = value.slice(0, buildIdx);
- value = value.replace(/^[vV]/, '');
-
- const dashIdx = value.indexOf('-');
- const core = dashIdx >= 0 ? value.slice(0, dashIdx) : value;
- const pre = dashIdx >= 0 ? value.slice(dashIdx + 1) : '';
-
- const parts = core.split('.');
- if (parts.length < 3) return null;
- const nums = parts.slice(0, 3).map((part) => Number.parseInt(part, 10));
- if (nums.some((n) => Number.isNaN(n))) return null;
-
- return {
- major: nums[0],
- minor: nums[1],
- patch: nums[2],
- prerelease: pre ? pre.split('.') : [],
- };
-}
-
-function isNumericIdentifier(value: string): boolean {
- return /^\d+$/.test(value);
-}
-
-// Compare pre-release identifier lists per semver §11.4.
-function comparePrerelease(a: string[], b: string[]): number {
- if (a.length === 0 && b.length === 0) return 0;
- // A stable release (no pre-release) outranks a pre-release.
- if (a.length === 0) return 1;
- if (b.length === 0) return -1;
-
- const len = Math.max(a.length, b.length);
- for (let i = 0; i < len; i++) {
- // A larger set of fields outranks a smaller one when all preceding equal.
- if (i >= a.length) return -1;
- if (i >= b.length) return 1;
-
- const ai = a[i];
- const bi = b[i];
- const aNum = isNumericIdentifier(ai);
- const bNum = isNumericIdentifier(bi);
-
- if (aNum && bNum) {
- const diff = Number.parseInt(ai, 10) - Number.parseInt(bi, 10);
- if (diff !== 0) return diff < 0 ? -1 : 1;
- } else if (aNum) {
- // Numeric identifiers always rank lower than non-numeric ones.
- return -1;
- } else if (bNum) {
- return 1;
- } else if (ai !== bi) {
- return ai < bi ? -1 : 1;
- }
- }
- return 0;
-}
-
-// Returns -1 / 0 / 1 when both versions parse, or null when either does not.
-export function compareAgentVersions(a?: string | null, b?: string | null): number | null {
- const pa = parseAgentVersion(a);
- const pb = parseAgentVersion(b);
- if (!pa || !pb) return null;
- if (pa.major !== pb.major) return pa.major < pb.major ? -1 : 1;
- if (pa.minor !== pb.minor) return pa.minor < pb.minor ? -1 : 1;
- if (pa.patch !== pb.patch) return pa.patch < pb.patch ? -1 : 1;
- return comparePrerelease(pa.prerelease, pb.prerelease);
-}
-
// The agent version reported for a host. Docker hosts carry it on the docker
// meta; plain host agents carry it on the agent meta.
export function hostAgentVersion(host: Resource): string | undefined {
return host.docker?.agentVersion?.trim() || host.agent?.agentVersion?.trim() || undefined;
}
-// Normalise a version for display: strip build metadata, ensure a leading `v`.
-export function formatAgentVersionDisplay(raw?: string | null): string {
- const parsed = parseAgentVersion(raw);
- if (!parsed) return '';
- const core = `${parsed.major}.${parsed.minor}.${parsed.patch}`;
- const pre = parsed.prerelease.length ? `-${parsed.prerelease.join('.')}` : '';
- return `v${core}${pre}`;
+export function hostAgentConnectionID(host: Resource): string | undefined {
+ const agentId =
+ host.agent?.agentId?.trim() ||
+ host.kubernetes?.agentId?.trim() ||
+ (host.type === 'agent' ? host.id?.trim() : '');
+ if (!agentId) return undefined;
+ return agentId.startsWith('agent:') ? agentId : `agent:${agentId}`;
}
-export type OutdatedAgentHost = { name: string; version: string };
+export type OutdatedAgentHost = { name: string; version: string; agentId?: string };
// Hosts whose agent version is strictly behind the server version. Hosts with
// no reported version (or an unparseable one) are skipped rather than flagged,
@@ -131,10 +56,15 @@ export function collectOutdatedAgentHosts(
if (!version) continue;
const cmp = compareAgentVersions(version, serverVersion);
if (cmp !== null && cmp < 0) {
- outdated.push({
+ const outdatedHost: OutdatedAgentHost = {
name: host.name?.trim() || host.id || 'host',
version: formatAgentVersionDisplay(version),
- });
+ };
+ const agentId = hostAgentConnectionID(host);
+ if (agentId) {
+ outdatedHost.agentId = agentId;
+ }
+ outdated.push(outdatedHost);
}
}
return outdated;
diff --git a/frontend-modern/src/features/proxmox/ProxmoxPageSurface.tsx b/frontend-modern/src/features/proxmox/ProxmoxPageSurface.tsx
index 8c29e10803..d1d42fb9ca 100644
--- a/frontend-modern/src/features/proxmox/ProxmoxPageSurface.tsx
+++ b/frontend-modern/src/features/proxmox/ProxmoxPageSurface.tsx
@@ -14,7 +14,7 @@ import {
isWorkloadTableMetricHistoryRange,
type WorkloadTableMetricHistoryRange,
} from '@/components/Workloads/workloadMetricHistoryModel';
-import { buildInfrastructureWorkspacePath } from '@/components/Settings/infrastructureWorkspaceModel';
+import { buildInfrastructureAgentUpdatesPath } from '@/components/Settings/infrastructureWorkspaceModel';
import {
collectOutdatedAgentHosts,
formatAgentVersionDisplay,
@@ -88,6 +88,9 @@ export function ProxmoxPageSurface() {
const outdatedAgentHosts = createMemo(() =>
collectOutdatedAgentHosts(model().pveNodes, updateStore.versionInfo()?.version),
);
+ const outdatedAgentUpdatePath = createMemo(() =>
+ buildInfrastructureAgentUpdatesPath(outdatedAgentHosts().map((host) => host.agentId)),
+ );
const serverVersionDisplay = createMemo(() =>
formatAgentVersionDisplay(updateStore.versionInfo()?.version),
);
@@ -154,7 +157,7 @@ export function ProxmoxPageSurface() {
targetVersion={serverVersionDisplay()}
missingLabel="agent-contributed Proxmox node detail and command support"
copyVariant="latest-detail"
- actionHref={buildInfrastructureWorkspacePath()}
+ actionHref={outdatedAgentUpdatePath()}
actionLabel="Open agent upgrade commands"
/>
<Show when={activeTab() === 'overview'}>
diff --git a/frontend-modern/src/features/proxmox/__tests__/ProxmoxPageSurface.contract.test.tsx b/frontend-modern/src/features/proxmox/__tests__/ProxmoxPageSurface.contract.test.tsx
index 5dabe72487..f74dffb47a 100644
--- a/frontend-modern/src/features/proxmox/__tests__/ProxmoxPageSurface.contract.test.tsx
+++ b/frontend-modern/src/features/proxmox/__tests__/ProxmoxPageSurface.contract.test.tsx
@@ -131,7 +131,7 @@ describe('ProxmoxPageSurface contract', () => {
displayName: 'delly',
type: 'agent',
proxmox: { nodeName: 'delly', clusterName: 'homelab' },
- agent: { agentVersion: 'v5.1.34' },
+ agent: { agentId: 'agent-delly', agentVersion: 'v5.1.34' },
}),
]);
@@ -146,7 +146,7 @@ describe('ProxmoxPageSurface contract', () => {
);
expect(screen.getByRole('link', { name: 'Open agent upgrade commands' })).toHaveAttribute(
'href',
- '/settings/infrastructure',
+ '/settings/infrastructure?agentUpdates=1&agents=agent%3Aagent-delly',
);
});
});
diff --git a/frontend-modern/src/features/proxmox/__tests__/proxmoxBackupRecoveryModel.test.ts b/frontend-modern/src/features/proxmox/__tests__/proxmoxBackupRecoveryModel.test.ts
index ca204384b8..9367287334 100644
--- a/frontend-modern/src/features/proxmox/__tests__/proxmoxBackupRecoveryModel.test.ts
+++ b/frontend-modern/src/features/proxmox/__tests__/proxmoxBackupRecoveryModel.test.ts
@@ -178,6 +178,35 @@ describe('proxmoxBackupRecoveryModel', () => {
expect(model.coverageSummary.uncovered).toBe(1);
});
+ it('does not treat a linked Pulse agent facet as recovery evidence or authority', () => {
+ const model = buildProxmoxBackupRecoveryModel({
+ workloads: [
+ workload({
+ id: 'vm-201',
+ sourceType: 'hybrid',
+ proxmox: { vmid: 201, node: 'delly', instance: 'homelab' },
+ agent: {
+ agentId: 'agent-delly',
+ agentVersion: '6.0.0-rc.5',
+ commandsEnabled: true,
+ },
+ }),
+ ],
+ pbsBackups: [],
+ archives: [],
+ snapshots: [],
+ tasks: [],
+ nowMs: Date.parse('2026-05-26T08:00:00Z'),
+ });
+
+ expect(model.coverageRows).toHaveLength(1);
+ expect(model.coverageRows[0].posture).toBe('uncovered');
+ expect(model.coverageRows[0].pbsCount).toBe(0);
+ expect(model.coverageRows[0].archiveCount).toBe(0);
+ expect(model.coverageRows[0].snapshotCount).toBe(0);
+ expect(model.recoverableArtifacts).toHaveLength(0);
+ });
+
it('flags backups whose guest is absent from inventory as orphaned, live guests as not', () => {
const model = buildProxmoxBackupRecoveryModel({
// Only VMID 112 exists in inventory; the PBS backup for 999 does not.
diff --git a/frontend-modern/src/features/standalone/StandalonePageSurface.tsx b/frontend-modern/src/features/standalone/StandalonePageSurface.tsx
index 340ef6567a..c72d545b5b 100644
--- a/frontend-modern/src/features/standalone/StandalonePageSurface.tsx
+++ b/frontend-modern/src/features/standalone/StandalonePageSurface.tsx
@@ -4,8 +4,8 @@ import ActivityIcon from 'lucide-solid/icons/activity';
import ServerIcon from 'lucide-solid/icons/server';
import SettingsIcon from 'lucide-solid/icons/settings';
import {
+ buildInfrastructureAgentUpdatesPath,
buildInfrastructureOnboardingPath,
- buildInfrastructureWorkspacePath,
} from '@/components/Settings/infrastructureWorkspaceModel';
import { PlatformOutdatedAgentNotice } from '@/features/platformPage/PlatformOutdatedAgentNotice';
import {
@@ -72,6 +72,9 @@ export function StandalonePageSurface() {
const outdatedAgentHosts = createMemo(() =>
collectOutdatedAgentHosts(model().machines, updateStore.versionInfo()?.version),
);
+ const outdatedAgentUpdatePath = createMemo(() =>
+ buildInfrastructureAgentUpdatesPath(outdatedAgentHosts().map((host) => host.agentId)),
+ );
const serverVersionDisplay = createMemo(() =>
formatAgentVersionDisplay(updateStore.versionInfo()?.version),
);
@@ -158,7 +161,7 @@ export function StandalonePageSurface() {
targetVersion={serverVersionDisplay()}
missingLabel="agent command support and agent-managed platform detail"
copyVariant="latest-detail"
- actionHref={buildInfrastructureWorkspacePath()}
+ actionHref={outdatedAgentUpdatePath()}
actionLabel="Open agent upgrade commands"
/>
<Show
diff --git a/frontend-modern/src/features/standalone/__tests__/StandalonePageSurface.test.tsx b/frontend-modern/src/features/standalone/__tests__/StandalonePageSurface.test.tsx
index 8612c5e16c..c6bb5ef1c0 100644
--- a/frontend-modern/src/features/standalone/__tests__/StandalonePageSurface.test.tsx
+++ b/frontend-modern/src/features/standalone/__tests__/StandalonePageSurface.test.tsx
@@ -146,7 +146,7 @@ describe('StandalonePageSurface', () => {
type: 'agent',
platformType: 'agent',
sources: ['agent'],
- agent: { agentVersion: 'v5.1.34' },
+ agent: { agentId: 'agent-tower', agentVersion: 'v5.1.34' },
}),
],
loading: () => false,
@@ -163,7 +163,7 @@ describe('StandalonePageSurface', () => {
);
expect(screen.getByRole('link', { name: 'Open agent upgrade commands' })).toHaveAttribute(
'href',
- '/settings/infrastructure',
+ '/settings/infrastructure?agentUpdates=1&agents=agent%3Aagent-tower',
);
});
diff --git a/frontend-modern/src/features/truenas/TrueNASPageSurface.tsx b/frontend-modern/src/features/truenas/TrueNASPageSurface.tsx
index b3efa2f3bb..f553bda235 100644
--- a/frontend-modern/src/features/truenas/TrueNASPageSurface.tsx
+++ b/frontend-modern/src/features/truenas/TrueNASPageSurface.tsx
@@ -1,6 +1,6 @@
import { useLocation } from '@solidjs/router';
import { Show, createMemo, type Accessor } from 'solid-js';
-import { buildInfrastructureWorkspacePath } from '@/components/Settings/infrastructureWorkspaceModel';
+import { buildInfrastructureAgentUpdatesPath } from '@/components/Settings/infrastructureWorkspaceModel';
import { getPlatformIcon } from '@/features/platformPage/platformIcon';
import { PlatformOutdatedAgentNotice } from '@/features/platformPage/PlatformOutdatedAgentNotice';
import {
@@ -80,17 +80,16 @@ export function TrueNASPageSurface() {
const outdatedAgentHosts = createMemo(() =>
collectOutdatedAgentHosts(model().systems, updateStore.versionInfo()?.version),
);
+ const outdatedAgentUpdatePath = createMemo(() =>
+ buildInfrastructureAgentUpdatesPath(outdatedAgentHosts().map((host) => host.agentId)),
+ );
const serverVersionDisplay = createMemo(() =>
formatAgentVersionDisplay(updateStore.versionInfo()?.version),
);
return (
<div data-testid="truenas-page" class="space-y-3">
- <PlatformSectionTabs
- tabs={tabs()}
- active={activeTab()}
- ariaLabel="TrueNAS sections"
- />
+ <PlatformSectionTabs tabs={tabs()} active={activeTab()} ariaLabel="TrueNAS sections" />
<Show
when={!loading() || model().resources.length > 0}
@@ -126,7 +125,7 @@ export function TrueNASPageSurface() {
targetVersion={serverVersionDisplay()}
missingLabel="agent-contributed TrueNAS system detail and command support"
copyVariant="latest-detail"
- actionHref={buildInfrastructureWorkspacePath()}
+ actionHref={outdatedAgentUpdatePath()}
actionLabel="Open agent upgrade commands"
/>
<Show when={activeTab() === 'overview'}>
diff --git a/frontend-modern/src/features/truenas/__tests__/TrueNASPageSurface.contract.test.tsx b/frontend-modern/src/features/truenas/__tests__/TrueNASPageSurface.contract.test.tsx
index 266c555e8d..fcd7dc94ca 100644
--- a/frontend-modern/src/features/truenas/__tests__/TrueNASPageSurface.contract.test.tsx
+++ b/frontend-modern/src/features/truenas/__tests__/TrueNASPageSurface.contract.test.tsx
@@ -140,7 +140,7 @@ describe('TrueNASPageSurface contract', () => {
id: 'agent:truenas-scale',
name: 'truenas-scale',
type: 'agent',
- agent: { agentVersion: 'v5.1.34' },
+ agent: { agentId: 'agent-truenas-scale', agentVersion: 'v5.1.34' },
}),
]);
@@ -155,7 +155,7 @@ describe('TrueNASPageSurface contract', () => {
);
expect(screen.getByRole('link', { name: 'Open agent upgrade commands' })).toHaveAttribute(
'href',
- '/settings/infrastructure',
+ '/settings/infrastructure?agentUpdates=1&agents=agent%3Aagent-truenas-scale',
);
});
});
diff --git a/frontend-modern/src/utils/agentVersion.ts b/frontend-modern/src/utils/agentVersion.ts
new file mode 100644
index 0000000000..a3090ce151
--- /dev/null
+++ b/frontend-modern/src/utils/agentVersion.ts
@@ -0,0 +1,91 @@
+export type ParsedAgentVersion = {
+ major: number;
+ minor: number;
+ patch: number;
+ // Pre-release identifiers, e.g. ['rc', '5']. Empty means a stable release,
+ // which always outranks any pre-release of the same core version.
+ prerelease: string[];
+};
+
+// Parse a semver-shaped version string. Tolerates a leading `v`/`V` and strips
+// build metadata (`+git.151.g...`) which carries no precedence. Returns null
+// for anything that is not at least `major.minor.patch`.
+export function parseAgentVersion(raw?: string | null): ParsedAgentVersion | null {
+ if (!raw) return null;
+ let value = raw.trim();
+ if (!value) return null;
+
+ const buildIdx = value.indexOf('+');
+ if (buildIdx >= 0) value = value.slice(0, buildIdx);
+ value = value.replace(/^[vV]/, '');
+
+ const dashIdx = value.indexOf('-');
+ const core = dashIdx >= 0 ? value.slice(0, dashIdx) : value;
+ const pre = dashIdx >= 0 ? value.slice(dashIdx + 1) : '';
+
+ const parts = core.split('.');
+ if (parts.length < 3) return null;
+ const nums = parts.slice(0, 3).map((part) => Number.parseInt(part, 10));
+ if (nums.some((n) => Number.isNaN(n))) return null;
+
+ return {
+ major: nums[0],
+ minor: nums[1],
+ patch: nums[2],
+ prerelease: pre ? pre.split('.') : [],
+ };
+}
+
+function isNumericIdentifier(value: string): boolean {
+ return /^\d+$/.test(value);
+}
+
+// Compare pre-release identifier lists per semver precedence rules.
+function comparePrerelease(a: string[], b: string[]): number {
+ if (a.length === 0 && b.length === 0) return 0;
+ if (a.length === 0) return 1;
+ if (b.length === 0) return -1;
+
+ const len = Math.max(a.length, b.length);
+ for (let i = 0; i < len; i++) {
+ if (i >= a.length) return -1;
+ if (i >= b.length) return 1;
+
+ const ai = a[i];
+ const bi = b[i];
+ const aNum = isNumericIdentifier(ai);
+ const bNum = isNumericIdentifier(bi);
+
+ if (aNum && bNum) {
+ const diff = Number.parseInt(ai, 10) - Number.parseInt(bi, 10);
+ if (diff !== 0) return diff < 0 ? -1 : 1;
+ } else if (aNum) {
+ return -1;
+ } else if (bNum) {
+ return 1;
+ } else if (ai !== bi) {
+ return ai < bi ? -1 : 1;
+ }
+ }
+ return 0;
+}
+
+// Returns -1 / 0 / 1 when both versions parse, or null when either does not.
+export function compareAgentVersions(a?: string | null, b?: string | null): number | null {
+ const pa = parseAgentVersion(a);
+ const pb = parseAgentVersion(b);
+ if (!pa || !pb) return null;
+ if (pa.major !== pb.major) return pa.major < pb.major ? -1 : 1;
+ if (pa.minor !== pb.minor) return pa.minor < pb.minor ? -1 : 1;
+ if (pa.patch !== pb.patch) return pa.patch < pb.patch ? -1 : 1;
+ return comparePrerelease(pa.prerelease, pb.prerelease);
+}
+
+// Normalise a version for display: strip build metadata, ensure a leading `v`.
+export function formatAgentVersionDisplay(raw?: string | null): string {
+ const parsed = parseAgentVersion(raw);
+ if (!parsed) return '';
+ const core = `${parsed.major}.${parsed.minor}.${parsed.patch}`;
+ const pre = parsed.prerelease.length ? `-${parsed.prerelease.join('.')}` : '';
+ return `v${core}${pre}`;
+}
diff --git a/scripts/install.sh b/scripts/install.sh
index 7989f59479..c36cda8de3 100755
--- a/scripts/install.sh
+++ b/scripts/install.sh
@@ -5,6 +5,7 @@
#
# Usage:
# curl -fsSL http://pulse/install.sh | bash -s -- --url http://pulse --token <token> [options]
+# curl -fsSL http://pulse/install.sh | bash -s -- --update --url http://pulse [options]
#
# Options:
# --enable-host Enable host metrics (default: true)
@@ -23,6 +24,7 @@
# --insecure Skip TLS certificate verification
# --enable-commands Enable AI command execution on agent (disabled by default)
# --health-addr <addr> Health/metrics listener address (default: 127.0.0.1:9191, use "" to disable)
+# --update Update an existing agent using saved connection state
# --uninstall Remove the agent
#
# Auto-Detection:
@@ -72,6 +74,7 @@ ENABLE_DOCKER="" # Empty means "auto-detect"
ENABLE_KUBERNETES="" # Empty means "auto-detect"
ENABLE_PROXMOX="" # Empty means "auto-detect"
PROXMOX_TYPE=""
+UPDATE_ONLY="false"
UNINSTALL="false"
INSECURE="false"
AGENT_ID=""
@@ -286,6 +289,7 @@ Options:
--enable-commands Enable AI command execution
--health-addr <addr> Health/metrics listener address (default: 127.0.0.1:9191; use "" to disable)
--enroll Exchange bootstrap token for runtime token (deploy wizard)
+ --update Update an existing agent using saved connection state
--uninstall Remove the agent
--non-interactive Skip TTY prompts (for automated/scripted installs)
--token-file <path> Read token from file (alternative to --token)
@@ -1427,6 +1431,26 @@ find_connection_state_file() {
return 1
}
+recover_agent_id_from_state_file() {
+ local aid_path=""
+ local qnap_state_dir=""
+ local aid_paths=(/var/lib/pulse-agent/agent-id /boot/config/plugins/pulse-agent/agent-id "$TRUENAS_STATE_DIR/agent-id")
+
+ qnap_state_dir=$(find_qnap_state_dir || true)
+ if [[ -n "$qnap_state_dir" ]]; then
+ aid_paths+=("$qnap_state_dir/agent-id")
+ fi
+
+ for aid_path in "${aid_paths[@]}"; do
+ if [[ -f "$aid_path" ]]; then
+ cat "$aid_path"
+ return 0
+ fi
+ done
+
+ return 1
+}
+
# Save install script and connection details for offline uninstall
save_connection_info() {
local state_dir="$1"
@@ -1492,6 +1516,7 @@ while [[ $# -gt 0 ]]; do
--enable-commands) ENABLE_COMMANDS="true"; shift ;;
--health-addr) HEALTH_ADDR="$2"; HEALTH_ADDR_SET="true"; shift 2 ;;
--enroll) ENROLL="true"; shift ;;
+ --update) UPDATE_ONLY="true"; shift ;;
--uninstall) UNINSTALL="true"; shift ;;
--agent-id) AGENT_ID="$2"; shift 2 ;;
--hostname) HOSTNAME_OVERRIDE="$2"; shift 2 ;;
@@ -1540,6 +1565,33 @@ if [[ -n "$PULSE_URL" ]]; then
PULSE_URL="${PULSE_URL%/}"
fi
+# --- Update State Recovery ---
+# Update commands are intentionally tokenless for already-installed agents. The
+# installer reuses the canonical saved connection state instead of asking the
+# operator to mint a new install token for a host Pulse already knows about.
+if [[ "$UPDATE_ONLY" == "true" ]]; then
+ if [[ -z "$PULSE_URL" || -z "$PULSE_TOKEN" || -z "$AGENT_ID" || -z "$HOSTNAME_OVERRIDE" || -z "$CURL_CA_BUNDLE" || "$INSECURE" != "true" ]]; then
+ local update_conn_env=""
+ update_conn_env=$(find_connection_state_file || true)
+ if [[ -n "$update_conn_env" ]]; then
+ log_info "Recovering connection details from ${update_conn_env}..."
+ recover_connection_state "$update_conn_env"
+ elif [[ -z "$PULSE_URL" || -z "$PULSE_TOKEN" ]]; then
+ fail "No existing Pulse Agent connection state found. Use the install command instead." "$EXIT_MISSING_ARGS"
+ fi
+ if [[ -z "$AGENT_ID" ]]; then
+ AGENT_ID=$(recover_agent_id_from_state_file || true)
+ if [[ -n "$AGENT_ID" ]]; then
+ log_info "Recovered agent ID from persisted agent-id state."
+ fi
+ fi
+ fi
+fi
+
+if [[ -n "$PULSE_URL" ]]; then
+ PULSE_URL="${PULSE_URL%/}"
+fi
+
# --- CA Certificate Validation ---
# --cacert must point to a PEM file (matches curl --cacert behaviour).
# The same path is passed to the agent process via SSL_CERT_FILE so that
@@ -2067,10 +2119,17 @@ if [[ -x "${INSTALL_DIR}/${BINARY_NAME}" ]]; then
fi
elif command -v systemctl >/dev/null 2>&1 && systemctl is-enabled --quiet "${AGENT_NAME}" 2>/dev/null; then
# Service exists but binary is missing - reinstall scenario
+ if [[ "$UPDATE_ONLY" == "true" ]]; then
+ fail "No existing Pulse Agent binary found to update. Use the install command instead." "$EXIT_MISSING_ARGS"
+ fi
log_info "Agent service exists but binary is missing. Reinstalling..."
systemctl stop "${AGENT_NAME}" 2>/dev/null || true
fi
+if [[ "$UPDATE_ONLY" == "true" && "$UPGRADE_MODE" != "true" ]]; then
+ fail "No existing Pulse Agent installation found to update. Use the install command instead." "$EXIT_MISSING_ARGS"
+fi
+
# Install Binary
log_info "Installing binary to ${INSTALL_DIR}/${BINARY_NAME}..."
mkdir -p "$INSTALL_DIR"
diff --git a/scripts/installtests/install_sh_test.go b/scripts/installtests/install_sh_test.go
index 6ede4214a7..10a14880d0 100644
--- a/scripts/installtests/install_sh_test.go
+++ b/scripts/installtests/install_sh_test.go
@@ -532,6 +532,33 @@ func TestInstallSHRecoversSavedStateForPartialUninstallContext(t *testing.T) {
}
}
+func TestInstallSHSupportsSavedStateUpdateMode(t *testing.T) {
+ content, err := os.ReadFile(repoFile("scripts", "install.sh"))
+ if err != nil {
+ t.Fatalf("read install.sh: %v", err)
+ }
+
+ script := string(content)
+ required := []string{
+ `--update Update an existing agent using saved connection state`,
+ `UPDATE_ONLY="false"`,
+ `--update) UPDATE_ONLY="true"; shift ;;`,
+ `if [[ "$UPDATE_ONLY" == "true" ]]; then`,
+ `update_conn_env=$(find_connection_state_file || true)`,
+ `recover_connection_state "$update_conn_env"`,
+ `recover_agent_id_from_state_file() {`,
+ `AGENT_ID=$(recover_agent_id_from_state_file || true)`,
+ `No existing Pulse Agent connection state found. Use the install command instead.`,
+ `if [[ "$UPDATE_ONLY" == "true" && "$UPGRADE_MODE" != "true" ]]; then`,
+ `No existing Pulse Agent installation found to update. Use the install command instead.`,
+ }
+ for _, needle := range required {
+ if !strings.Contains(script, needle) {
+ t.Fatalf("install.sh missing saved-state update mode contract: %s", needle)
+ }
+ }
+}
+
func TestInstallSHUsesCanonicalServiceLifecycleHelpers(t *testing.T) {
content, err := os.ReadFile(repoFile("scripts", "install.sh"))
if err != nil {
diff --git a/scripts/release_control/subsystem_lookup_test.py b/scripts/release_control/subsystem_lookup_test.py
index 7ff6bedbee..ba82b39838 100644
--- a/scripts/release_control/subsystem_lookup_test.py
+++ b/scripts/release_control/subsystem_lookup_test.py
@@ -2860,7 +2860,7 @@ class SubsystemLookupTest(unittest.TestCase):
{
"heading": "## Shared Boundaries",
"path": "internal/api/access_control_handlers.go",
- "line": 349,
+ "line": 360,
"heading_line": 113,
}
],