Recently I’ve been logged into a laptop remotely a lot. Logging out from “main” session makes my Gnome on Debian 12 go to suspend after a while. To avoid it you just have to tell:
sudo dbus-launch gsettings set org.gnome.settings-daemon.plugins.power sleep-inactive-ac-type 'nothing'
Thanks to WinEunuuchs2Unix for the answer I took from Prevent sleep/suspend when not logged in to a specific account; the only change is that GDM on Debian runs as root