Skip to content

feat(runner): the computer doesn't idle-sleep while the AI is working on it - #260

Merged
hoangsnowy merged 1 commit into
mainfrom
feat/runner-keep-awake
Oct 22, 2026
Merged

hoangsnowy merged 1 commit into
mainfrom
feat/runner-keep-awake

Conversation

@hoangsnowy

Copy link
Copy Markdown
Owner

Summary

The lab's paired laptop idled to sleep at 08:41 with two tasks mid-run; everything (lab, runner, Autopilot) paused until 20:00 — 11 hours of nothing. While the runner has work in flight (a CLI run in either lane, or a Try-the-app preview) it now resets the Windows idle timer every 30 s (SetThreadExecutionState(ES_SYSTEM_REQUIRED), non-continuous). It never keeps the display on, never blocks a sleep the person asks for (lid / Start › Sleep), and stops as soon as the work ends. REMOTE_AGENT_KEEP_AWAKE=off opts out. README notes it.

Test plan

  • KeepAwakeTests: opt-out parsing; holds count work in flight and release exactly once.
  • Full suite green locally.
  • Lab: leave a run going with the screen idle → the machine stays up until the run ends.

🤖 Generated with Claude Code

https://claude.ai/code/session_018WAdQ7Rm24xss5QDSvXtJB

… on it

On the lab the paired laptop idled to sleep at 08:41 with two tasks mid-run; Autopilot and both runs sat still until
20:00. While the runner has a CLI run or a preview in flight it now resets the system idle timer every 30 s
(SetThreadExecutionState, non-continuous — never holds the display, never blocks a sleep the person asks for, and
stops as soon as the work ends). Windows only; REMOTE_AGENT_KEEP_AWAKE=off opts out.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018WAdQ7Rm24xss5QDSvXtJB
var second = awake.Hold();
awake.Active.ShouldBe(2);

first.Dispose();
awake.Active.ShouldBe(2);

first.Dispose();
first.Dispose(); // a double release must not under-count
first.Dispose(); // a double release must not under-count
awake.Active.ShouldBe(1);

second.Dispose();
@hoangsnowy
hoangsnowy merged commit a82ff54 into main Oct 22, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants