From 688bdd42465ddad9efa91b2b477347cf2fb74f7a Mon Sep 17 00:00:00 2001 From: rcourtman Date: Sat, 18 Apr 2026 22:37:24 +0100 Subject: [PATCH] Fix PVE connection health key in registration check The isKnownDisconnected helper was building the key as instanceType+"-"+instanceName ("pve-delly"), but the PVE PollProvider's connectionKey function returns the bare instance name ("delly"). PBS uses "pbs-"+name. The mismatch meant the disconnected-node check always missed, rendering the server-side stale-token detection inert. Fix: use type-specific key construction matching the PollProvider connectionKey implementations. --- internal/api/config_setup_handlers.go | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/internal/api/config_setup_handlers.go b/internal/api/config_setup_handlers.go index 6d22f99f9..c8c9b6ae0 100644 --- a/internal/api/config_setup_handlers.go +++ b/internal/api/config_setup_handlers.go @@ -517,6 +517,10 @@ func (h *ConfigHandlers) autoRegisteredNodeExists(ctx context.Context, req *Auto // entry for the given instance. Returns false (i.e., assume connected) when // there is no monitor data yet so we don't mistakenly trigger re-registration // on every cold startup before the monitor has had a chance to poll. +// +// Key format must match the PollProvider connectionKey functions: +// - pve: bare instance name (e.g. "delly") +// - pbs: "pbs-" + instance name func isKnownDisconnected(connStatuses map[string]bool, instanceType, name, host string) bool { if connStatuses == nil { return false @@ -528,7 +532,15 @@ func isKnownDisconnected(connStatuses map[string]bool, instanceType, name, host if instanceName == "" { return false } - key := instanceType + "-" + instanceName + var key string + switch instanceType { + case "pve": + key = instanceName // PVE connectionKey returns bare name + case "pbs": + key = "pbs-" + instanceName + default: + key = instanceType + "-" + instanceName + } connected, known := connStatuses[key] return known && !connected }