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.

Clear stale PBS backup-running state

pulse-triage[bot]8c639846969c
diff --git a/docs/release-control/v6/internal/subsystems/agent-lifecycle.md b/docs/release-control/v6/internal/subsystems/agent-lifecycle.md
index 576d8df3db..07fd520bf1 100644
--- a/docs/release-control/v6/internal/subsystems/agent-lifecycle.md
+++ b/docs/release-control/v6/internal/subsystems/agent-lifecycle.md
@@ -15,6 +15,14 @@
## Purpose
+`models.PBSBackup` may carry monitoring-owned write-activity evidence for an
+incomplete PBS snapshot. `inProgress` means the snapshot has no completed
+manifest; `writeActivityObserved` and `writeActive` distinguish a successfully
+observed live PBS writer from absent task visibility. These shared model fields
+grant no agent enrollment, identity, profile, reporting, command, update, or
+removal authority, and an absent observation must not be interpreted as an
+agent lifecycle fact.
+
Agent-profile assignment presents one actionable identity per connected host.
When a PBS or PMG provider resource projects an agent ID that is not an active
host-telemetry surface control, the provider projection is excluded so the
diff --git a/docs/release-control/v6/internal/subsystems/api-contracts.md b/docs/release-control/v6/internal/subsystems/api-contracts.md
index 1b96d49be8..75e818feb8 100644
--- a/docs/release-control/v6/internal/subsystems/api-contracts.md
+++ b/docs/release-control/v6/internal/subsystems/api-contracts.md
@@ -20,6 +20,15 @@
## Purpose
+The public `PBSBackup` projection keeps `inProgress` as the compatibility field
+for an incomplete, manifestless snapshot. Optional
+`writeActivityObserved: true` says the collector obtained a complete bounded
+view of current PBS backup/sync writers for that poll, while optional
+`writeActive: true` says one of those writers accounts for the artifact. When
+the observation field is absent, clients must preserve the prior conservative
+running interpretation; they must not infer that no writer exists. Completed
+snapshots omit both fields.
+
The Unified Agent helper artifact has a distinct rate-limited public download
contract at `GET|HEAD /download/pulse-agent-helper?arch=linux-*`. The route
rejects missing and non-Linux architectures, never substitutes the collector
diff --git a/docs/release-control/v6/internal/subsystems/frontend-primitives.md b/docs/release-control/v6/internal/subsystems/frontend-primitives.md
index e2a6891ee9..a033f29585 100644
--- a/docs/release-control/v6/internal/subsystems/frontend-primitives.md
+++ b/docs/release-control/v6/internal/subsystems/frontend-primitives.md
@@ -20,6 +20,16 @@
## Purpose
+Proxmox backup presentation treats every manifestless PBS artifact as
+non-recoverable. It renders the artifact as `Running` when current writer
+visibility is absent or a matching writer is active, and as danger-tone
+`Failed` when a complete current-task observation finds no live writer.
+Running and failed/incomplete artifacts remain inspectable but cannot become a
+workload's latest recoverable point; search includes `running`, `failed`, and
+`incomplete` state vocabulary. The compact recovery table reserves enough of
+its fixed phone-width layout for the complete state badge instead of clipping
+that recovery answer at the horizontal scroll edge.
+
Own reusable frontend primitives and canonical page-shell patterns so feature
work extends shared components instead of creating new local variants.
Feature-owned warning cards, including notification delivery health, compose
diff --git a/docs/release-control/v6/internal/subsystems/monitoring.md b/docs/release-control/v6/internal/subsystems/monitoring.md
index 7e64851aed..0d286701bd 100644
--- a/docs/release-control/v6/internal/subsystems/monitoring.md
+++ b/docs/release-control/v6/internal/subsystems/monitoring.md
@@ -17,6 +17,15 @@
## Purpose
+Direct PBS backup polling correlates manifestless snapshots with current
+writer tasks before publishing guest backup-running state. The client queries
+running `backup` and `syncjob` task families separately with bounded pagination;
+an HTTP, permission, decode, or page-cap failure leaves task visibility unknown
+and preserves the conservative running interpretation. A complete empty result
+marks the incomplete artifact observed but inactive. Backup workers match their
+datastore and `vm|ct/id` subject when that shape is available; a running sync
+job remains an instance-wide writer because it may touch multiple groups.
+
Own polling, typed collection, runtime state assembly, and canonical monitoring
truth for live infrastructure data.
Monitoring supplies the live unified-resource snapshot used by the alerts-owned
diff --git a/docs/release-control/v6/internal/subsystems/storage-recovery.md b/docs/release-control/v6/internal/subsystems/storage-recovery.md
index 83cd197e77..c980bb34cc 100644
--- a/docs/release-control/v6/internal/subsystems/storage-recovery.md
+++ b/docs/release-control/v6/internal/subsystems/storage-recovery.md
@@ -21,6 +21,14 @@
## Purpose
+A manifestless PBS snapshot never becomes a successful recovery point and
+never advances backup age. Recovery mapping reports it as running while a live
+writer accounts for it or current-task visibility is unavailable; after a
+complete current-task observation finds no writer, it is a failed/incomplete
+artifact with no completion time and no verification verdict. Recovery tables
+keep both states inspectable while excluding them from latest-recoverable
+pointers.
+
The shared `internal/api/` helper-binary download route is isolated from
storage and recovery semantics. `/download/pulse-agent-helper` serves a signed
Linux runtime artifact only; it cannot read, mutate, restore, export, or select
diff --git a/frontend-modern/browser-verification.json b/frontend-modern/browser-verification.json
index 07b1b9b433..cd1f65ca9d 100644
--- a/frontend-modern/browser-verification.json
+++ b/frontend-modern/browser-verification.json
@@ -1,17 +1,22 @@
{
"version": 1,
- "base_sha": "fda955627f3dd8d4c844de040e56d209864815e7",
- "verified_at": "2026-08-31T01:58:05Z",
+ "base_sha": "bad717f16eb7620dfd9c9f3f135be95f9a2f9642",
+ "verified_at": "2026-08-31T05:57:10Z",
"result": "passed",
"changed_paths": [
- "frontend-modern/src/utils/alertDestinationsPresentation.ts"
+ "frontend-modern/src/features/proxmox/proxmoxBackupRecoveryModel.ts",
+ "frontend-modern/src/features/proxmox/proxmoxBackupsTablePresentation.ts",
+ "frontend-modern/src/features/proxmox/proxmoxBackupsTableShared.tsx",
+ "frontend-modern/src/types/api.ts"
],
"content_sha256": {
- "frontend-modern/src/utils/alertDestinationsPresentation.ts": "30cda34c77ce5b7f92b7ef71dc5715ddccf831419f258d4419204152c718baea"
+ "frontend-modern/src/features/proxmox/proxmoxBackupRecoveryModel.ts": "ba9e8a4eb3588bc7486d58f98342e9f5bf53a3f8f8247cb4c5597ebce31b41e5",
+ "frontend-modern/src/features/proxmox/proxmoxBackupsTablePresentation.ts": "83fb8ae7e26900368b8413bcf771b2b44d3dc32134996db2ebe058378468521a",
+ "frontend-modern/src/features/proxmox/proxmoxBackupsTableShared.tsx": "254da9ce1fe77adf5c28d9c6f690cc0940d1236337e5d2f24acf810f07108eea",
+ "frontend-modern/src/types/api.ts": "e69bd7171e43f92d75e844cd138fbd2f7a11b24dea2cb3a118dfdfffa505fba1"
},
"routes": [
- "/alerts/overview",
- "/alerts/notifications"
+ "/proxmox/backups/date"
],
"viewports": [
{
@@ -24,14 +29,16 @@
}
],
"states": [
- "active alert with a rate-limited delivery diagnosis",
- "degraded delivery health with retained failures and 7/30-day retention",
- "delivery activity interleaving a held notification and a delivered attempt",
- "delivery activity after held-event refresh becomes unavailable"
+ "incomplete PBS snapshot with authoritative active writer rendered Running",
+ "terminally incomplete PBS snapshot with authoritative no-writer observation rendered Failed in danger tone",
+ "completed PBS snapshots retained Verified state below incomplete artifacts",
+ "failed/incomplete search result and restored unfiltered Running plus Failed results",
+ "full desktop and compact narrow recovery-table layouts with complete unclipped state badges"
],
"interactions": [
- "navigated from alert overview to notifications",
- "focused and activated Refresh delivery status with the keyboard",
- "verified retained delivered evidence remains after held-event refresh fallback"
+ "signed in to the final production build and navigated to the Proxmox By date backups route",
+ "scrolled the terminally incomplete artifact into view and inspected its Failed badge placement and clipping",
+ "entered failed incomplete in the backup search with the keyboard and verified only the failed artifact remained",
+ "selected and cleared the search with the keyboard and verified Running and Failed artifacts both returned"
]
}
diff --git a/frontend-modern/src/features/proxmox/__tests__/proxmoxBackupRecoveryModel.test.ts b/frontend-modern/src/features/proxmox/__tests__/proxmoxBackupRecoveryModel.test.ts
index 14c4f8fd5e..b36989fa32 100644
--- a/frontend-modern/src/features/proxmox/__tests__/proxmoxBackupRecoveryModel.test.ts
+++ b/frontend-modern/src/features/proxmox/__tests__/proxmoxBackupRecoveryModel.test.ts
@@ -162,6 +162,34 @@ describe('proxmoxBackupRecoveryModel', () => {
);
});
+ it('keeps a terminally incomplete PBS artifact out of latest recovery', () => {
+ const model = buildProxmoxBackupRecoveryModel({
+ workloads: [workload({})],
+ pbsBackups: [
+ pbsBackup({
+ id: 'failed-offsite-sync',
+ backupTime: '2026-05-26T06:00:00Z',
+ size: 0,
+ verified: false,
+ files: ['pct.conf.blob'],
+ inProgress: true,
+ writeActivityObserved: true,
+ writeActive: false,
+ }),
+ pbsBackup({ backupTime: '2026-05-25T01:34:25Z' }),
+ ],
+ archives: [],
+ snapshots: [],
+ tasks: [],
+ nowMs: Date.parse('2026-05-26T08:00:00Z'),
+ });
+
+ const failed = model.recoverableArtifacts.find((artifact) => artifact.id.includes('failed'));
+ expect(failed).toMatchObject({ failed: true, running: false, verified: undefined });
+ expect(model.coverageRows[0].latestRecovery?.createdAt).toBe('2026-05-25T01:34:25Z');
+ expect(recoverableArtifactMatchesSearch(failed!, 'failed incomplete')).toBe(true);
+ });
+
it('uses canonical workload attention while retaining the failed task as evidence', () => {
const model = buildProxmoxBackupRecoveryModel({
workloads: [workload({})],
diff --git a/frontend-modern/src/features/proxmox/__tests__/proxmoxBackupsTablePresentation.test.ts b/frontend-modern/src/features/proxmox/__tests__/proxmoxBackupsTablePresentation.test.ts
index 57f1ecc033..8817787792 100644
--- a/frontend-modern/src/features/proxmox/__tests__/proxmoxBackupsTablePresentation.test.ts
+++ b/frontend-modern/src/features/proxmox/__tests__/proxmoxBackupsTablePresentation.test.ts
@@ -129,6 +129,7 @@ describe('Proxmox backups responsive table presentation', () => {
'state',
]);
expect(getRecoverableColumnWidthStyle('workload', 'compact')).toEqual({ width: '40%' });
+ expect(getRecoverableColumnWidthStyle('state', 'compact')).toEqual({ width: '16%' });
expect(ids(getRecoverableColumns('basic'))).toEqual([
'workload',
'source',
diff --git a/frontend-modern/src/features/proxmox/proxmoxBackupRecoveryModel.ts b/frontend-modern/src/features/proxmox/proxmoxBackupRecoveryModel.ts
index 5c62bf976f..c71846a6ae 100644
--- a/frontend-modern/src/features/proxmox/proxmoxBackupRecoveryModel.ts
+++ b/frontend-modern/src/features/proxmox/proxmoxBackupRecoveryModel.ts
@@ -51,6 +51,8 @@ export interface RecoverableArtifact {
verified?: boolean;
/** A still-running backup is writing this artifact; it is not recoverable yet. */
running?: boolean;
+ /** A terminal task left an incomplete artifact which is not recoverable. */
+ failed?: boolean;
fileCount?: number;
}
@@ -523,6 +525,13 @@ export function buildProxmoxBackupRecoveryModel(
backup.datastore,
]);
const createdMs = parseTimestampMs(backup.backupTime);
+ const running =
+ backup.inProgress === true &&
+ (backup.writeActivityObserved !== true || backup.writeActive === true);
+ const failed =
+ backup.inProgress === true &&
+ backup.writeActivityObserved === true &&
+ backup.writeActive !== true;
addArtifact({
id: `pbs:${backup.id}`,
nativeId: backup.id,
@@ -538,7 +547,8 @@ export function buildProxmoxBackupRecoveryModel(
detail: pbsBackupFileDetailLabel(backup.files.length),
protected: backup.protected,
verified: backup.inProgress ? undefined : backup.verified,
- running: backup.inProgress === true,
+ running,
+ failed,
fileCount: backup.files.length,
});
}
@@ -612,10 +622,10 @@ export function buildProxmoxBackupRecoveryModel(
}
for (const row of rows.values()) {
- // A running artifact cannot be restored from yet, so the "latest"
- // pointers (which answer "what can I recover to?") skip it. The artifact
- // itself stays listed with a Running state.
- const completed = row.artifacts.filter((artifact) => !artifact.running);
+ // Running and terminally incomplete artifacts cannot be restored from, so
+ // the "latest" pointers (which answer "what can I recover to?") skip them.
+ // The artifacts themselves stay listed with an honest state.
+ const completed = row.artifacts.filter((artifact) => !artifact.running && !artifact.failed);
row.latestPBS = newest(
completed.filter((artifact) => artifact.sourceKind === 'pbs'),
(artifact) => artifact.createdMs,
@@ -726,6 +736,7 @@ export function recoverableArtifactMatchesSearch(
? 'unverified'
: undefined,
artifact.running ? 'running' : undefined,
+ artifact.failed ? 'failed incomplete' : undefined,
artifact.protected ? 'protected' : 'unprotected',
];
return haystack.filter(Boolean).join(' ').toLowerCase().includes(normalizedTerm);
diff --git a/frontend-modern/src/features/proxmox/proxmoxBackupsTablePresentation.ts b/frontend-modern/src/features/proxmox/proxmoxBackupsTablePresentation.ts
index fe11ee814d..1b15aea8ac 100644
--- a/frontend-modern/src/features/proxmox/proxmoxBackupsTablePresentation.ts
+++ b/frontend-modern/src/features/proxmox/proxmoxBackupsTablePresentation.ts
@@ -292,7 +292,10 @@ const RECOVERABLE_WEIGHTS: Record<
ProxmoxBackupsTableLayoutMode,
Partial<Record<RecoverableColumnId, number>>
> = {
- compact: { workload: 40, source: 15, location: 20, created: 15, state: 10 },
+ // Reserve enough phone-width space for complete state badges (including
+ // Failed and Running) rather than clipping the recovery answer at the
+ // scroll edge. Identity remains on the canonical 40% anchor.
+ compact: { workload: 40, source: 12, location: 17, created: 15, state: 16 },
basic: { workload: 28, source: 14, location: 23, created: 18, state: 17 },
operational: {
workload: 24,
diff --git a/frontend-modern/src/features/proxmox/proxmoxBackupsTableShared.tsx b/frontend-modern/src/features/proxmox/proxmoxBackupsTableShared.tsx
index 3600340ea6..17b5bd4bcf 100644
--- a/frontend-modern/src/features/proxmox/proxmoxBackupsTableShared.tsx
+++ b/frontend-modern/src/features/proxmox/proxmoxBackupsTableShared.tsx
@@ -239,9 +239,9 @@ export function artifactStateLabel(artifact: RecoverableArtifact): string {
if (artifact.sourceKind === 'snapshot') {
return getProxmoxBackupSourcePresentation('snapshot').stateFallbackLabel;
}
- // Running outranks everything: whatever else is true of the artifact, it
- // is not a restorable backup yet.
+ // Runtime/terminal incompleteness outranks every completed-artifact state.
if (artifact.running) return 'Running';
+ if (artifact.failed) return 'Failed';
if (artifact.protected) return 'Protected';
if (artifact.verified === true) return 'Verified';
if (artifact.verified === false) return 'Unverified';
@@ -256,6 +256,13 @@ export function ArtifactStateBadge(props: { artifact: RecoverableArtifact; label
</MetadataBadge>
);
}
+ if (props.artifact.failed) {
+ return (
+ <MetadataBadge {...PROXMOX_BACKUP_METADATA_BADGE_PROPS} tone="danger">
+ {props.label}
+ </MetadataBadge>
+ );
+ }
if (props.artifact.sourceKind === 'snapshot') {
return (
<MetadataBadge {...PROXMOX_BACKUP_METADATA_BADGE_PROPS} tone="indigo">
diff --git a/frontend-modern/src/types/api.ts b/frontend-modern/src/types/api.ts
index e246d4d81d..edfd4f1ad0 100644
--- a/frontend-modern/src/types/api.ts
+++ b/frontend-modern/src/types/api.ts
@@ -777,8 +777,12 @@ export interface PBSBackup {
size: number;
protected: boolean;
verified: boolean;
- /** In-flight snapshot the backup client is still writing (no manifest yet); not a completed backup. */
+ /** Incomplete snapshot with no manifest; never a completed backup. */
inProgress?: boolean;
+ /** Whether the collector successfully observed PBS's current running-task set. */
+ writeActivityObserved?: boolean;
+ /** Whether a running backup or sync task currently accounts for this incomplete snapshot. */
+ writeActive?: boolean;
verificationRaw?: unknown;
comment?: string;
files: string[];
diff --git a/internal/models/backup_in_progress_test.go b/internal/models/backup_in_progress_test.go
index 8e8dc50e4b..714af884b8 100644
--- a/internal/models/backup_in_progress_test.go
+++ b/internal/models/backup_in_progress_test.go
@@ -72,6 +72,37 @@ func TestSyncGuestBackupTimesInProgressOnlyNeverSetsLastBackup(t *testing.T) {
}
}
+func TestSyncGuestBackupTimesTerminalIncompletePBSSnapshotIsNotRunningOrComplete(t *testing.T) {
+ state := NewState()
+ state.UpdateVMs([]VM{
+ {VMID: 117, Name: "win11-pvepc", Instance: "pve-pc", Node: "pve-pc"},
+ })
+
+ state.mu.Lock()
+ state.PBSBackups = []PBSBackup{{
+ ID: "failed-sync-117",
+ VMID: "117",
+ BackupType: "vm",
+ BackupTime: time.Now().Add(-time.Hour),
+ Instance: "offsite",
+ Datastore: "main",
+ Namespace: "pve-pc",
+ InProgress: true,
+ WriteActivityObserved: true,
+ WriteActive: false,
+ }}
+ state.mu.Unlock()
+
+ state.SyncGuestBackupTimes()
+ vm := state.GetSnapshot().VMs[0]
+ if vm.BackupInProgress {
+ t.Error("BackupInProgress = true for an incomplete snapshot after its PBS task terminated")
+ }
+ if !vm.LastBackup.IsZero() {
+ t.Errorf("LastBackup = %v, want zero because a failed sync artifact is not complete", vm.LastBackup)
+ }
+}
+
func TestSyncGuestBackupTimesRunningVzdumpTaskSetsBackupInProgress(t *testing.T) {
state := NewState()
now := time.Now()
diff --git a/internal/models/metrics_types_test.go b/internal/models/metrics_types_test.go
index 6f76862285..1b839bc69c 100644
--- a/internal/models/metrics_types_test.go
+++ b/internal/models/metrics_types_test.go
@@ -292,6 +292,32 @@ func TestPBSInstanceNodeNameSerializesCamelCaseAndOmitsWhenEmpty(t *testing.T) {
}
}
+func TestPBSBackupWriteActivityWireContract(t *testing.T) {
+ withActivity, err := json.Marshal(PBSBackup{
+ ID: "incomplete-vm-117",
+ InProgress: true,
+ WriteActivityObserved: true,
+ WriteActive: true,
+ })
+ if err != nil {
+ t.Fatalf("marshal PBS backup write activity: %v", err)
+ }
+ wire := string(withActivity)
+ for _, field := range []string{`"inProgress":true`, `"writeActivityObserved":true`, `"writeActive":true`} {
+ if !strings.Contains(wire, field) {
+ t.Fatalf("payload = %s, want %s", wire, field)
+ }
+ }
+
+ withoutActivity, err := json.Marshal(PBSBackup{ID: "completed-vm-117"})
+ if err != nil {
+ t.Fatalf("marshal completed PBS backup: %v", err)
+ }
+ if strings.Contains(string(withoutActivity), "writeActivity") || strings.Contains(string(withoutActivity), "writeActive") {
+ t.Fatalf("payload = %s, absent write-activity evidence must be omitted", withoutActivity)
+ }
+}
+
func TestPBSGuestConfirmationEvidenceStaysOutOfSerializedState(t *testing.T) {
state := NewState()
state.UpdatePBSGuestConfirmationsForInstance("cluster-a", []PBSGuestConfirmation{
diff --git a/internal/models/models.go b/internal/models/models.go
index 4f3432b0e1..d24de3ec10 100644
--- a/internal/models/models.go
+++ b/internal/models/models.go
@@ -2786,14 +2786,22 @@ type PBSBackup struct {
Protected bool `json:"protected"`
Verified bool `json:"verified"`
// InProgress marks a snapshot the PBS API listed while the backup is
- // still being written: the manifest (index.json.blob) does not exist yet,
- // so the listing has no size and only the guest config blob in files. It
- // is not a completed backup and must not advance any last-backup age.
- InProgress bool `json:"inProgress,omitempty"`
- VerificationRaw any `json:"verificationRaw,omitempty"`
- Comment string `json:"comment,omitempty"`
- Files []string `json:"files"`
- Owner string `json:"owner,omitempty"` // User who created the backup
+ // incomplete: the manifest (index.json.blob) does not exist, so the listing
+ // has no size and only the guest config blob in files. A terminal failed
+ // backup or sync can leave the same shape behind, so write activity is
+ // tracked separately below. Incomplete snapshots never advance backup age.
+ InProgress bool `json:"inProgress,omitempty"`
+ // WriteActivityObserved says the PBS running-task query succeeded for the
+ // poll which produced this snapshot. WriteActive is true only when a live
+ // backup or sync task can account for it. InProgress remains the public
+ // incomplete-artifact contract; these fields let consumers distinguish a
+ // live write from an incomplete artifact left by a terminal task.
+ WriteActivityObserved bool `json:"writeActivityObserved,omitempty"`
+ WriteActive bool `json:"writeActive,omitempty"`
+ VerificationRaw any `json:"verificationRaw,omitempty"`
+ Comment string `json:"comment,omitempty"`
+ Files []string `json:"files"`
+ Owner string `json:"owner,omitempty"` // User who created the backup
}
func (b PBSBackup) NormalizeCollections() PBSBackup {
@@ -4525,7 +4533,14 @@ func (s *State) SyncGuestBackupTimes() {
}
key := pbsSubjectKey{backupType: backupType, vmid: vmid}
if backup.InProgress {
- pbsInProgressBySubject[key] = append(pbsInProgressBySubject[key], backup)
+ // When task visibility is unavailable, retain the conservative
+ // historical behaviour and report a manifestless snapshot as
+ // running. With an authoritative running-task read, only a live
+ // writer may drive the guest badge; failed sync artifacts remain
+ // incomplete but no longer pin "Backup Running" indefinitely.
+ if !backup.WriteActivityObserved || backup.WriteActive {
+ pbsInProgressBySubject[key] = append(pbsInProgressBySubject[key], backup)
+ }
continue
}
pbsBackupsBySubject[key] = append(pbsBackupsBySubject[key], backup)
diff --git a/internal/monitoring/monitor_backups.go b/internal/monitoring/monitor_backups.go
index 832b207e15..31e4bfbc01 100644
--- a/internal/monitoring/monitor_backups.go
+++ b/internal/monitoring/monitor_backups.go
@@ -1816,6 +1816,23 @@ func (m *Monitor) pollPBSBackups(ctx context.Context, instanceName string, clien
return
}
+ // A manifestless snapshot is incomplete, but it is not necessarily still
+ // being written: failed backup and PBS-to-PBS sync tasks can leave that
+ // shape behind. Correlate incomplete artifacts with PBS's live task view
+ // before they feed guest "Backup Running" state. If task visibility is
+ // denied or transiently unavailable, keep the previous conservative
+ // inference rather than claiming that no write is active.
+ if hasIncompletePBSBackup(allBackups) {
+ runningDataTasks, runningTasksErr := client.ListRunningDataTasks(ctx)
+ if runningTasksErr != nil {
+ log.Warn().Err(runningTasksErr).
+ Str("instance", instanceName).
+ Msg("Could not correlate incomplete PBS snapshots with running tasks")
+ } else {
+ applyPBSWriteActivity(allBackups, runningDataTasks)
+ }
+ }
+
m.prunePBSBackupCacheTimes(instanceName, retainedGroups)
// Update state
@@ -1871,6 +1888,57 @@ func (m *Monitor) pollPBSBackups(ctx context.Context, instanceName string, clien
m.broadcastStateUpdate()
}
+func hasIncompletePBSBackup(backups []models.PBSBackup) bool {
+ for _, backup := range backups {
+ if backup.InProgress {
+ return true
+ }
+ }
+ return false
+}
+
+// applyPBSWriteActivity marks whether each incomplete snapshot is accounted
+// for by a task which PBS currently reports as running. Backup task worker IDs
+// normally identify "<store>:<type>/<id>". If a server version returns a less
+// specific backup ID, the task remains a conservative instance-wide writer.
+// Sync tasks can touch many groups and therefore apply instance-wide.
+func applyPBSWriteActivity(backups []models.PBSBackup, tasks []pbs.RunningDataTask) {
+ for i := range backups {
+ if !backups[i].InProgress {
+ continue
+ }
+ backups[i].WriteActivityObserved = true
+ backups[i].WriteActive = runningPBSTaskMatchesBackup(tasks, backups[i])
+ }
+}
+
+func runningPBSTaskMatchesBackup(tasks []pbs.RunningDataTask, backup models.PBSBackup) bool {
+ subject := strings.ToLower(strings.TrimSpace(backup.BackupType + "/" + backup.VMID))
+ store := strings.ToLower(strings.TrimSpace(backup.Datastore))
+ for _, task := range tasks {
+ switch strings.ToLower(strings.TrimSpace(task.WorkerType)) {
+ case "syncjob":
+ return true
+ case "backup":
+ workerID := strings.ToLower(strings.TrimSpace(task.WorkerID))
+ if workerID == "" {
+ return true
+ }
+ if !strings.Contains(workerID, "/") {
+ // Unknown legacy/new worker-ID shape: do not hide a real write.
+ return true
+ }
+ if !strings.HasSuffix(workerID, subject) {
+ continue
+ }
+ if store == "" || strings.HasPrefix(workerID, store+":") || strings.Contains(workerID, ":"+store+":") {
+ return true
+ }
+ }
+ }
+ return false
+}
+
func (m *Monitor) buildPBSBackupCache(instanceName string) map[pbsBackupGroupKey]cachedPBSGroup {
snapshot := m.state.GetSnapshot()
cache := make(map[pbsBackupGroupKey]cachedPBSGroup)
diff --git a/internal/monitoring/pbs_convert_test.go b/internal/monitoring/pbs_convert_test.go
index 2dad18c5a9..63e8b869f2 100644
--- a/internal/monitoring/pbs_convert_test.go
+++ b/internal/monitoring/pbs_convert_test.go
@@ -4,6 +4,7 @@ import (
"testing"
"time"
+ "github.com/rcourtman/pulse-go-rewrite/internal/models"
"github.com/rcourtman/pulse-go-rewrite/pkg/pbs"
)
@@ -449,3 +450,41 @@ func TestConvertPBSSnapshotsInProgress(t *testing.T) {
})
}
}
+
+func TestApplyPBSWriteActivityClearsTerminalIncompleteSnapshots(t *testing.T) {
+ backups := []models.PBSBackup{
+ {Datastore: "main", BackupType: "vm", VMID: "117", InProgress: true},
+ {Datastore: "main", BackupType: "ct", VMID: "105", InProgress: true},
+ }
+
+ applyPBSWriteActivity(backups, nil)
+
+ for i, backup := range backups {
+ if !backup.WriteActivityObserved {
+ t.Fatalf("backup %d did not record authoritative task observation", i)
+ }
+ if backup.WriteActive {
+ t.Fatalf("backup %d remained active with no running PBS task", i)
+ }
+ }
+}
+
+func TestApplyPBSWriteActivityMatchesBackupSubjectAndSync(t *testing.T) {
+ backups := []models.PBSBackup{
+ {Datastore: "main", BackupType: "vm", VMID: "117", InProgress: true},
+ {Datastore: "main", BackupType: "vm", VMID: "118", InProgress: true},
+ }
+
+ applyPBSWriteActivity(backups, []pbs.RunningDataTask{{WorkerType: "backup", WorkerID: "main:vm/117"}})
+ if !backups[0].WriteActive {
+ t.Fatal("matching backup task did not mark its incomplete snapshot active")
+ }
+ if backups[1].WriteActive {
+ t.Fatal("backup task for vm/117 incorrectly marked vm/118 active")
+ }
+
+ applyPBSWriteActivity(backups, []pbs.RunningDataTask{{WorkerType: "syncjob", WorkerID: "offsite"}})
+ if !backups[0].WriteActive || !backups[1].WriteActive {
+ t.Fatal("running sync task must account for incomplete snapshots across its PBS instance")
+ }
+}
diff --git a/internal/recovery/mapper/proxmox/mapper.go b/internal/recovery/mapper/proxmox/mapper.go
index 1dc5401a8a..cf4c83129a 100644
--- a/internal/recovery/mapper/proxmox/mapper.go
+++ b/internal/recovery/mapper/proxmox/mapper.go
@@ -539,25 +539,33 @@ func FromPBSBackups(backups []models.PBSBackup, candidatesByKey map[string][]Gue
verified := b.Verified
verifiedPtr := &verified
details := map[string]any{
- "datastore": strings.TrimSpace(b.Datastore),
- "namespace": strings.TrimSpace(b.Namespace),
- "backupType": strings.TrimSpace(b.BackupType),
- "vmid": vmidStr,
- "comment": strings.TrimSpace(b.Comment),
- "owner": strings.TrimSpace(b.Owner),
- "files": append([]string(nil), b.Files...),
- "inProgress": b.InProgress,
+ "datastore": strings.TrimSpace(b.Datastore),
+ "namespace": strings.TrimSpace(b.Namespace),
+ "backupType": strings.TrimSpace(b.BackupType),
+ "vmid": vmidStr,
+ "comment": strings.TrimSpace(b.Comment),
+ "owner": strings.TrimSpace(b.Owner),
+ "files": append([]string(nil), b.Files...),
+ "inProgress": b.InProgress,
+ "writeActivityObserved": b.WriteActivityObserved,
+ "writeActive": b.WriteActive,
}
- // An in-flight snapshot (no manifest yet) is a running recovery
- // point: it has no completion time and cannot be verified. Keeping
- // it out of OutcomeSuccess also keeps posture/rollup freshness
- // anchored to the last COMPLETED backup.
+ // A manifestless snapshot is never a successful recovery point. It is
+ // running while a live PBS task accounts for it (or task visibility is
+ // unavailable); after an authoritative task read finds no writer, it is
+ // a failed/incomplete artifact left by a terminal backup or sync task.
outcome := recovery.OutcomeSuccess
completedAt := &t
if b.InProgress {
- outcome = recovery.OutcomeRunning
+ // The snapshot timestamp is its source backup identity, not the
+ // terminal task time; no completion time is available here.
completedAt = nil
+ if b.WriteActivityObserved && !b.WriteActive {
+ outcome = recovery.OutcomeFailed
+ } else {
+ outcome = recovery.OutcomeRunning
+ }
verifiedPtr = nil
}
diff --git a/internal/recovery/mapper/proxmox/mapper_test.go b/internal/recovery/mapper/proxmox/mapper_test.go
index bab2042bb0..59914f9629 100644
--- a/internal/recovery/mapper/proxmox/mapper_test.go
+++ b/internal/recovery/mapper/proxmox/mapper_test.go
@@ -793,6 +793,36 @@ func TestFromPBSBackups_InProgressMapsToRunning(t *testing.T) {
}
}
+func TestFromPBSBackups_TerminalIncompleteMapsToFailed(t *testing.T) {
+ started := time.Date(2026, 8, 30, 23, 15, 0, 0, time.UTC)
+ result := FromPBSBackups([]models.PBSBackup{{
+ ID: "pbs-offsite-main-vm-117-terminal",
+ VMID: "117",
+ Instance: "offsite",
+ Datastore: "main",
+ BackupType: "vm",
+ BackupTime: started,
+ Files: []string{"qemu-server.conf.blob"},
+ InProgress: true,
+ WriteActivityObserved: true,
+ WriteActive: false,
+ }}, nil)
+
+ if len(result) != 1 {
+ t.Fatalf("expected 1 point, got %d", len(result))
+ }
+ p := result[0]
+ if p.Outcome != recovery.OutcomeFailed {
+ t.Errorf("Outcome = %v, want %v", p.Outcome, recovery.OutcomeFailed)
+ }
+ if p.Verified != nil {
+ t.Errorf("Verified = %v, want nil for an incomplete artifact", *p.Verified)
+ }
+ if p.CompletedAt != nil {
+ t.Errorf("CompletedAt = %v, want nil because PBS did not report a terminal time for the artifact", p.CompletedAt)
+ }
+}
+
func TestFromPVEStorageBackups_InProgressMapsToRunning(t *testing.T) {
started := time.Date(2026, 8, 20, 9, 39, 1, 0, time.UTC)
backups := []models.StorageBackup{
diff --git a/pkg/pbs/client.go b/pkg/pbs/client.go
index 571a7aa2b1..94e4d2197a 100644
--- a/pkg/pbs/client.go
+++ b/pkg/pbs/client.go
@@ -1043,6 +1043,83 @@ type BackupSnapshot struct {
Verification interface{} `json:"verification,omitempty"` // Can be string or object
}
+// RunningDataTask describes a PBS task which may currently be writing a
+// backup snapshot. Backup tasks identify one backup group through WorkerID;
+// sync jobs can write several groups during one task.
+type RunningDataTask struct {
+ WorkerType string
+ WorkerID string
+ StartTime int64
+}
+
+var (
+ pbsRunningTaskPageLimit = 200
+ pbsRunningTaskMaxPages = 3
+)
+
+// ListRunningDataTasks returns the currently running backup and sync tasks.
+// Querying each writer type separately prevents unrelated running tasks from
+// consuming the bounded result window. Reaching the page cap returns an error
+// rather than a partial set so callers retain conservative running state.
+func (c *Client) ListRunningDataTasks(ctx context.Context) ([]RunningDataTask, error) {
+ limit := pbsRunningTaskPageLimit
+ if limit <= 0 {
+ limit = 200
+ }
+ maxPages := pbsRunningTaskMaxPages
+ if maxPages <= 0 {
+ maxPages = 1
+ }
+
+ tasks := make([]RunningDataTask, 0)
+ for _, requestedType := range []string{pbsTaskTypeBackup, pbsTaskTypeSyncJob} {
+ for page := 0; page < maxPages; page++ {
+ params := url.Values{}
+ params.Set("limit", fmt.Sprintf("%d", limit))
+ params.Set("running", "true")
+ params.Set("typefilter", requestedType)
+ if page > 0 {
+ params.Set("start", fmt.Sprintf("%d", page*limit))
+ }
+
+ resp, err := c.get(ctx, "/nodes/localhost/tasks?"+params.Encode())
+ if err != nil {
+ return nil, err
+ }
+ var result struct {
+ Data []map[string]interface{} `json:"data"`
+ }
+ decodeErr := json.NewDecoder(resp.Body).Decode(&result)
+ closeErr := resp.Body.Close()
+ if decodeErr != nil {
+ return nil, fmt.Errorf("failed to decode running PBS %s tasks: %w", requestedType, decodeErr)
+ }
+ if closeErr != nil {
+ return nil, fmt.Errorf("failed to close running PBS %s task response: %w", requestedType, closeErr)
+ }
+
+ for _, raw := range result.Data {
+ workerType := strings.ToLower(stringJobField(raw, "worker-type", "worker_type", "type"))
+ if workerType != requestedType {
+ continue
+ }
+ tasks = append(tasks, RunningDataTask{
+ WorkerType: workerType,
+ WorkerID: stringJobField(raw, "worker-id", "worker_id", "id"),
+ StartTime: int64JobField(raw, "starttime", "start-time", "start_time"),
+ })
+ }
+ if len(result.Data) < limit {
+ break
+ }
+ if page == maxPages-1 {
+ return nil, fmt.Errorf("running PBS %s task listing reached bounded cap (%d pages x %d limit)", requestedType, maxPages, limit)
+ }
+ }
+ }
+ return tasks, nil
+}
+
// JobHealthOptions selects which PBS job families should be collected.
type JobHealthOptions struct {
MonitorBackups bool
diff --git a/pkg/pbs/client_http_test.go b/pkg/pbs/client_http_test.go
index b1f0650a1e..cb2dfa0a05 100644
--- a/pkg/pbs/client_http_test.go
+++ b/pkg/pbs/client_http_test.go
@@ -68,6 +68,83 @@ func TestNewClient_TokenAuth_SetsAuthorizationHeader(t *testing.T) {
}
}
+func TestClient_ListRunningDataTasks(t *testing.T) {
+ var requests []string
+ server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
+ if r.URL.Path != "/api2/json/nodes/localhost/tasks" {
+ t.Fatalf("unexpected path: %s", r.URL.Path)
+ }
+ if got := r.URL.Query().Get("running"); got != "true" {
+ t.Fatalf("running query = %q, want true", got)
+ }
+ if got := r.URL.Query().Get("limit"); got != "200" {
+ t.Fatalf("limit query = %q, want 200", got)
+ }
+ workerType := r.URL.Query().Get("typefilter")
+ requests = append(requests, workerType)
+ data := []map[string]any{}
+ switch workerType {
+ case "backup":
+ data = append(data,
+ map[string]any{"worker_type": "backup", "worker_id": "main:vm/117", "starttime": 1800000000},
+ map[string]any{"worker_type": "verificationjob", "worker_id": "verify-main", "starttime": 1800000200},
+ )
+ case "syncjob":
+ data = append(data, map[string]any{"worker-type": "syncjob", "worker-id": "offsite", "start-time": 1800000100})
+ default:
+ t.Fatalf("unexpected typefilter: %q", workerType)
+ }
+ _ = json.NewEncoder(w).Encode(map[string]any{"data": data})
+ }))
+ defer server.Close()
+
+ client, err := NewClient(ClientConfig{Host: server.URL, TokenName: "root@pam!token", TokenValue: "secret"})
+ if err != nil {
+ t.Fatalf("NewClient: %v", err)
+ }
+ tasks, err := client.ListRunningDataTasks(context.Background())
+ if err != nil {
+ t.Fatalf("ListRunningDataTasks: %v", err)
+ }
+ if len(tasks) != 2 {
+ t.Fatalf("running data tasks = %#v, want backup and sync only", tasks)
+ }
+ if !slices.Equal(requests, []string{"backup", "syncjob"}) {
+ t.Fatalf("type-filtered requests = %v, want backup then syncjob", requests)
+ }
+ if tasks[0].WorkerType != "backup" || tasks[0].WorkerID != "main:vm/117" || tasks[0].StartTime != 1800000000 {
+ t.Fatalf("backup task = %#v", tasks[0])
+ }
+ if tasks[1].WorkerType != "syncjob" || tasks[1].WorkerID != "offsite" || tasks[1].StartTime != 1800000100 {
+ t.Fatalf("sync task = %#v", tasks[1])
+ }
+}
+
+func TestClient_ListRunningDataTasksRejectsTruncatedWriterSet(t *testing.T) {
+ oldLimit, oldMaxPages := pbsRunningTaskPageLimit, pbsRunningTaskMaxPages
+ pbsRunningTaskPageLimit, pbsRunningTaskMaxPages = 2, 1
+ t.Cleanup(func() {
+ pbsRunningTaskPageLimit, pbsRunningTaskMaxPages = oldLimit, oldMaxPages
+ })
+
+ server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
+ _ = json.NewEncoder(w).Encode(map[string]any{"data": []map[string]any{
+ {"worker_type": "backup", "worker_id": "main:vm/117"},
+ {"worker_type": "backup", "worker_id": "main:vm/118"},
+ }})
+ }))
+ defer server.Close()
+
+ client, err := NewClient(ClientConfig{Host: server.URL, TokenName: "root@pam!token", TokenValue: "secret"})
+ if err != nil {
+ t.Fatalf("NewClient: %v", err)
+ }
+ tasks, err := client.ListRunningDataTasks(context.Background())
+ if err == nil || !strings.Contains(err.Error(), "bounded cap") {
+ t.Fatalf("ListRunningDataTasks() tasks = %#v, err = %v; want bounded-cap error", tasks, err)
+ }
+}
+
func TestClient_GetJobHealthEvidence_MergesConfigAndTaskFacts(t *testing.T) {
server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
switch r.URL.Path {