The method folder:getPhotos() always returns the empty array on device folders created by cloud sync. To reproduce:
1. Install this script as "lrmobile-folder-bug.lua" in the Scripts folder and restart LR:
local LrDialogs = import "LrDialogs"
local LrTasks = import "LrTasks"
local catalog = import "LrApplication".activeCatalog ()
LrTasks.startAsyncTask (function ()
local folder = catalog:getActiveSources ()[1]
LrDialogs.message (string.format ("%d photos in %s",
#folder:getPhotos (), folder:getPath ()))
end)
2. In the Folder panel, select a device folder created by cloud sync.
3. Do the menu command Scripts > lrmobile-folder-bug.lua and observe this output:

Tested on LR 12.0.1 / Mac OS 12.6.1.