diff --git a/internal/models/models.go b/internal/models/models.go index 8a64817c1..40d50df67 100644 --- a/internal/models/models.go +++ b/internal/models/models.go @@ -1136,6 +1136,13 @@ func (s *State) UpsertDockerHost(host DockerHost) { if existing.CustomDisplayName != "" { host.CustomDisplayName = existing.CustomDisplayName } + // Preserve Hidden and PendingUninstall flags + host.Hidden = existing.Hidden + host.PendingUninstall = existing.PendingUninstall + // Preserve Command if it exists + if existing.Command != nil { + host.Command = existing.Command + } s.DockerHosts[i] = host updated = true break diff --git a/internal/monitoring/monitor.go b/internal/monitoring/monitor.go index f2ef55fff..48e078304 100644 --- a/internal/monitoring/monitor.go +++ b/internal/monitoring/monitor.go @@ -1304,14 +1304,6 @@ func findMatchingDockerHost(hosts []models.DockerHost, report agentsdocker.Repor } } - if tokenID != "" { - for _, host := range hosts { - if strings.TrimSpace(host.TokenID) == tokenID { - return host, true - } - } - } - if machineID != "" && hostname != "" { for _, host := range hosts { if strings.TrimSpace(host.MachineID) == machineID && strings.TrimSpace(host.Hostname) == hostname {