Skip to content

Add a --caffeine flag to keep the computer awake during a session #1611

@maxbeizer

Description

@maxbeizer

Summary

When running long Copilot CLI sessions (builds, tests, multi-step tasks), the computer may go to sleep, interrupting the work. A --caffeine flag would prevent the system from sleeping while a session is active.

Proposed Behavior

  • copilot-cli --caffeine — keeps the machine awake for the duration of the session, releasing on exit.
  • copilot-cli --caffeine=30m (or similar) — keeps the machine awake for a specified duration, with a sensible default (e.g., 2 hours) if no value is provided.
  • On macOS, this could use caffeinate under the hood.
  • On Linux, systemd-inhibit or similar.
  • On Windows, SetThreadExecutionState or equivalent.

Motivation

During long-running agent tasks (complex refactors, large test suites, background CI monitoring), the session can be interrupted if the machine sleeps. Users currently have to manually run caffeinate or adjust system settings. Integrating this into the CLI would be a nice quality-of-life improvement.

Open Questions

  • Should this be opt-in per session or configurable as a default?
  • What should the default timeout be if no duration is specified? (e.g., match session lifetime, or a fixed cap like 2h)
  • Should it also prevent display sleep, or only system sleep?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions