Windows: "Keep this computer awake" does not prevent Modern Standby (S0) sleep on display-off

Aperta
#357 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
59/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
typescript
Ambito
desktop

Direzione di ricerca

Read electron/main.mjs and compare syncCompanionKeepAwake with createRoutineWakeHold in electron/routine-wake.mjs and the power handling in electron/vps-link-awake.mjs. Check Chromium’s Windows power request behavior described in the issue, including battery events. Done looks like the keep-awake settings prevent Modern Standby on AC and handle battery transitions consistently.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Environment

  • OS: Windows 11 x64 with Modern Standby (Standby (S0 Low Power Idle) Network Connected, S3 unavailable)
  • App: dusk bot desktop v0.2.31
  • Settings:
    • Settings -> Phone -> Advanced -> Remote access enabled, Keep this computer awake enabled (companion-settings.json has "enabled": true, "keepAwake": true), app running in the Windows system tray
    • Also affects Settings -> Computer -> Keep this computer awake for scheduled automations and Keep PC awake while plugged in (routine-wake.json)

Symptoms

With Keep this computer awake (or Keep PC awake while plugged in) turned on and the laptop plugged into AC power, the screen still turns off once Windows reaches its idle display-off timeout (e.g., 1 hour on AC / 2 minutes on battery). On a Windows Modern Standby (S0) machine, turning off the display immediately transitions the system into Modern Standby (Kernel-Power Event ID 506, Reason: Idle Timeout).

Once Windows enters Modern Standby, dusk bot's background processes are suspended and the phone cannot connect from outside. Desktop logs show:

  • routines: held while this computer sleeps
  • [companion] bonjour: no LAN addresses: advertising paused until a network appears
  • phone relay: link: phone channel read retrying

Closing the window to the system tray does not disable the setting (keepAwake stays enabled), so this happens whenever the PC sits idle past its display-off timeout.

Steps to reproduce

  1. On a Windows 11 laptop using Modern Standby (powercfg /a reports Standby (S0 Low Power Idle)), enable Settings -> Phone -> Advanced -> Remote access and Keep this computer awake (and/or Settings -> Computer -> Keep PC awake while plugged in).
  2. Leave the laptop plugged in (with dusk bot open or minimized to the system tray).
  3. Wait past Windows' "Turn off my screen after" idle timeout.
  4. Check Windows Event Viewer (Microsoft-Windows-Kernel-Power, Event ID 506) or attempt to reach the desktop from the phone app.

Root cause

  1. Both syncCompanionKeepAwake in electron/main.mjs and createRoutineWakeHold in electron/routine-wake.mjs (ROUTINE_WAKE_BLOCKER) start powerSaveBlocker.start("prevent-app-suspension").
  2. On Windows, Chromium's power_save_blocker_win.cc maps kPreventAppSuspension to PowerRequestExecutionRequired rather than PowerRequestDisplayRequired.
  3. PowerRequestExecutionRequired permits the display to turn off. On Windows 11 Modern Standby (S0) hardware, display-off idle timeout still enters Modern Standby, throttling/suspending dusk bot's child processes (local server, companion sidecar, relay/tunnel) and dropping network connectivity. As documented in Chromium's power_save_blocker_win.cc, on Windows 11 only PowerRequestDisplayRequired (powerSaveBlocker.start("prevent-display-sleep")) prevents Modern Standby entry on idle.
  4. Additionally, syncCompanionKeepAwake in electron/main.mjs does not observe powerMonitor AC/battery power state (isOnBatteryPower, on-battery, on-ac), unlike electron/routine-wake.mjs and electron/vps-link-awake.mjs (on Modern Standby, Windows also terminates execution power requests on battery 5 minutes after the sleep timeout).
Lingua principale
TypeScript
Stelle
277
Fork
27
Merge medio
15h 30m
PR unite (30g)
147

Preparare l'ambiente

Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di DuskBotAI/duskbot

Tutte le issue di DuskBotAI/duskbot

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.