Real-time monitoring dashboard for Proxmox VE, PBS, Docker, Kubernetes, TrueNAS and vSphere. Self-hosted, with alerts for failed backups, full disks, unhealthy containers and offline nodes.
Go aialertsdashboarddockerdocker-monitoringgohomelabinfrastructure-monitoringkubernetesmonitoringmspproxmoxproxmox-backup-serverproxmox-mail-gatewayproxmox-veself-hostedtruenastypescriptvspherewebhooks
Fix auto-register refresh notifications
rcourtman1a47c03b2b57
diff --git a/docs/release-control/v6/internal/subsystems/agent-lifecycle.md b/docs/release-control/v6/internal/subsystems/agent-lifecycle.mdindex 5b0d766d8a..dd85d77a9c 100644--- a/docs/release-control/v6/internal/subsystems/agent-lifecycle.md+++ b/docs/release-control/v6/internal/subsystems/agent-lifecycle.md@@ -263,6 +263,11 @@ profile and assignment columns, but embedded table framing must route throughthe one-time `authToken` only and must not also send the long-lived`X-API-Token` header. The header-backed `agent:report` fallback exists onlyfor update-only re-registration when setup-token fetch is unavailable.+ Canonical auto-register WebSocket semantics must distinguish first-time node+ creation from idempotent existing-node refreshes: only newly created PVE/PBS+ nodes may emit `node_auto_registered`, while matched existing nodes that+ rotate or refresh credentials must emit a non-toast configuration refresh+ such as `nodes_changed`.Shared `internal/api/` session and auth changes consumed by lifecycleroutes must preserve durable principal IDs as the authorization key. Agentlifecycle surfaces may display contact email when supplied by the shareddiff --git a/docs/release-control/v6/internal/subsystems/api-contracts.md b/docs/release-control/v6/internal/subsystems/api-contracts.mdindex 049f9a6da7..8b7808acf9 100644--- a/docs/release-control/v6/internal/subsystems/api-contracts.md+++ b/docs/release-control/v6/internal/subsystems/api-contracts.md@@ -252,6 +252,11 @@ checks, merge tenants, or become the source of truth for telemetry freshness.That same shared boundary also owns reachable-host selection truth for canonical Proxmox registration: runtime callers may propose ordered `candidateHosts`, but the API contract must persist and echo the first candidate Pulse can actually reach instead of freezing the caller's rejected first preference into the stored node endpoint.That same canonical payload contract also owns strict-TLS truth for that selected host: `/api/auto-register` may only persist `VerifySSL=true` when Pulse actually captured a certificate fingerprint for the selected candidate, and it must not pretend public-CA verification is safe after every candidate fingerprint probe failed.That same contract now owns stale-marker verification as well: setup-token-authenticated `checkRegistration` requests may omit token completion fields and must answer `{registered:boolean}` from canonical candidate-host matching so runtime repair can distinguish real registrations from stale local marker files without rotating tokens first.+ That same contract owns auto-register WebSocket event intent: a successful+ completion that creates a new PVE/PBS node may broadcast+ `node_auto_registered`, but successful idempotent matches or credential+ refreshes for an already configured node must use a non-toast config-change+ event such as `nodes_changed` instead of re-announcing first registration.That same shared setup contract also owns teardown symmetry for script-managed Proxmox nodes: `/api/auto-unregister` must accept the canonical `type`, normalized `host`, explicit `serverName`, optional canonical `tokenId`, request-body `authToken`, and `source:"script"` payload, and it must answer the same canonical success envelope on both real removals and idempotent no-op reruns so browser/runtime callers do not invent a second uninstall vocabulary.That same setup-script payload contract owns the Proxmox permission shapefor generated scripts, runtime-side host-agent setup, and installerdiff --git a/docs/release-control/v6/internal/subsystems/storage-recovery.md b/docs/release-control/v6/internal/subsystems/storage-recovery.mdindex 84cb6676c6..ba0f78c44d 100644--- a/docs/release-control/v6/internal/subsystems/storage-recovery.md+++ b/docs/release-control/v6/internal/subsystems/storage-recovery.md@@ -396,6 +396,12 @@ bypass the API fail-closed execution gate.11. Preserve the canonical setup-script `source="script"` marker through those same shared auto-register helpers, and reject non-canonical source labels there, so later canonical reruns can keep treating script-confirmed tokens differently from agent-created tokens without reviving arbitrary caller-label compatibility.12. Preserve the canonical auto-register node-type boundary in those same shared helpers so only supported `pve` and `pbs` registrations can complete, and unsupported runtime labels cannot bleed fake node identities into adjacent transport or recovery-adjacent state.13. Preserve the canonical auto-register token-identity boundary in those same shared helpers so only Pulse-managed `pulse-monitor@{pve|pbs}!pulse-<canonical-scope-slug>` token IDs matching the requested node type can complete, and arbitrary, cross-type, or non-Pulse-managed token identities cannot bleed into adjacent transport or recovery-adjacent state.+ Preserve canonical auto-register event intent in those same shared helpers:+ only first-time node creation may emit the toast-bearing+ `node_auto_registered` WebSocket event, while idempotent existing-node+ refreshes must stay on non-toast configuration-change events so adjacent+ storage/recovery transport does not infer a second protected-system+ admission from a credential refresh.That same adjacent transport boundary must also preserve disabledprovider-connection admission truth. Storage- and recovery-adjacent setupsurfaces may reflect zero-delta or removal-only monitored-system previewsdiff --git a/internal/api/config_handlers_canonical_auto_register_test.go b/internal/api/config_handlers_canonical_auto_register_test.goindex 36e6cc1338..74999921b6 100644--- a/internal/api/config_handlers_canonical_auto_register_test.go+++ b/internal/api/config_handlers_canonical_auto_register_test.go@@ -724,6 +724,15 @@ func TestBuildAutoRegisterEventDataUsesCanonicalAutoRegisterTokenIdentity(t *tes}}+func TestAutoRegisterWebSocketEventTypeDistinguishesCreatedFromExistingRefresh(t *testing.T) {+ if got := autoRegisterWebSocketEventType(true); got != "node_auto_registered" {+ t.Fatalf("created event type = %q, want node_auto_registered", got)+ }+ if got := autoRegisterWebSocketEventType(false); got != "nodes_changed" {+ t.Fatalf("existing-node refresh event type = %q, want nodes_changed", got)+ }+}+func TestHandleCanonicalAutoRegister_PVERotatesStoredPulseTokenOnCallerReplacement(t *testing.T) {tempDir := t.TempDir()t.Setenv("PULSE_DATA_DIR", tempDir)diff --git a/internal/api/config_setup_handlers.go b/internal/api/config_setup_handlers.goindex aaa3e49cb4..40744475b5 100644--- a/internal/api/config_setup_handlers.go+++ b/internal/api/config_setup_handlers.go@@ -800,7 +800,14 @@ func buildAutoRegisterEventData(req *AutoRegisterRequest, host string, actualNam}}-func (h *ConfigHandlers) notifyAutoRegistrationSuccess(ctx context.Context, req *AutoRegisterRequest, host string, actualName string, tokenID string) {+func autoRegisterWebSocketEventType(created bool) string {+ if created {+ return "node_auto_registered"+ }+ return "nodes_changed"+}++func (h *ConfigHandlers) notifyAutoRegistrationSuccess(ctx context.Context, req *AutoRegisterRequest, host string, actualName string, tokenID string, created bool) {if h.getMonitor(ctx) != nil && h.getMonitor(ctx).GetDiscoveryService() != nil {log.Info().Msg("Triggering discovery refresh after auto-registration")h.getMonitor(ctx).GetDiscoveryService().ForceRefresh()@@ -813,7 +820,7 @@ func (h *ConfigHandlers) notifyAutoRegistrationSuccess(ctx context.Context, reqnodeInfo := buildAutoRegisterEventData(req, host, actualName, tokenID)h.wsHub.BroadcastMessage(websocket.Message{- Type: "node_auto_registered",+ Type: autoRegisterWebSocketEventType(created),Data: nodeInfo,Timestamp: time.Now().Format(time.RFC3339),})@@ -838,7 +845,7 @@ func (h *ConfigHandlers) notifyAutoRegistrationSuccess(ctx context.Context, reqlog.Info().Str("host", host).Str("name", actualName).- Str("type", "node_auto_registered").+ Str("type", autoRegisterWebSocketEventType(created)).Msg("Broadcasted auto-registration success via WebSocket")}@@ -1204,6 +1211,7 @@ func (h *ConfigHandlers) handleCanonicalAutoRegister(w http.ResponseWriter, r *hStr("source", registrationSource).Msg("Using caller-supplied token for canonical /api/auto-register completion")// Add the node to configuration+ created := falseif req.Type == "pve" {pveDisplayName := h.disambiguateNodeName(r.Context(), serverName, host, "pve")pveNode := config.PVEInstance{@@ -1278,6 +1286,7 @@ func (h *ConfigHandlers) handleCanonicalAutoRegister(w http.ResponseWriter, r *h}h.getConfig(r.Context()).PVEInstances = append(h.getConfig(r.Context()).PVEInstances, pveNode)h.normalizePVEConfigState(r.Context())+ created = true}} else if req.Type == "pbs" {pbsDisplayName := h.disambiguateNodeName(r.Context(), serverName, host, "pbs")@@ -1353,6 +1362,7 @@ func (h *ConfigHandlers) handleCanonicalAutoRegister(w http.ResponseWriter, r *hreturn}h.getConfig(r.Context()).PBSInstances = append(h.getConfig(r.Context()).PBSInstances, pbsNode)+ created = true}}@@ -1379,7 +1389,7 @@ func (h *ConfigHandlers) handleCanonicalAutoRegister(w http.ResponseWriter, r *h}()}- h.notifyAutoRegistrationSuccess(r.Context(), req, host, actualName, fullTokenID)+ h.notifyAutoRegistrationSuccess(r.Context(), req, host, actualName, fullTokenID, created)response := buildCanonicalAutoRegisterResponse(req, host, actualName, fullTokenID, tokenValue)