Skip to content

Opt-in idle shutdown and wake for the control plane #3770

Done

Description

@integry

Part of the runtime abstraction epic (plan "Runtime abstraction and lighter footprint", #3758–#3769). Depends on #3763 (slim control plane). Feeds #3768 (propr deploy fly) and #3769 (Fly docs + E2E). Paired with integry/propr-routing wake-ping issue (linked below).

Why

On small or metered hosts (a 1 GB Fly Machine costs ~$6.94/mo always-on, more than the Free plan's $5), the control plane should be able to stop when there is nothing to do and start again on demand. Example budget with this in place: control plane awake ~4 h/day ≈ $1.14, storage ≈ $0.40, leaving ~$2.40+ for agent runs on Sprites. It also suits home servers and laptops (wake-on-LAN, systemd socket activation).

Opt-in only. Default behaviour stays unchanged: the control plane runs continuously unless an operator explicitly enables idle shutdown.

Acceptance

  • New setting, off by default: PROPR_IDLE_SHUTDOWN=off|on plus PROPR_IDLE_SHUTDOWN_AFTER (e.g. 15m). Exposed in .env, Web UI settings (instance admin) and propr check.
  • Idle detector considers: running or queued jobs (BullMQ, all queues), active agent runs on any runtime, open Web UI/Socket.IO sessions, in-flight MCP requests, pending followup handoffs, Connect deliveries being processed, and the next scheduled item (automations, goals, polling, ultrafix loops). Not idle if anything is due within the shutdown window.
  • When idle for the configured time: drain gracefully (stop accepting new work, finish acks, close Connect socket cleanly, flush logs, close SQLite/Redis), then exit with code 0 so a supervisor can stop the host (Fly restart policy on-failure, systemd, etc.).
  • Before exiting, publish a wake hint: the next due time for scheduled work, sent to Connect (see linked propr-routing issue) and written locally for other supervisors.
  • On start, recover cleanly: reconnect Connect, drain the Connect replay cache for deliveries received while stopped, resume scheduled work that became due during sleep (at most once).
  • Fly specifics, documented and generated by propr deploy fly: auto_stop_machines = "off" (Fly proxy autostop is traffic-based and would stop the Machine during an agent run), auto_start_machines = true so HTTP to the UI/API/MCP/webhook URL starts it, restart policy on-failure.
  • Metrics/logs: last idle shutdown, reason, wake source (HTTP, Connect ping, schedule), cold-start duration.
  • Tests: idle detector unit tests per signal; integration test that a queued job, open UI session or due schedule prevents shutdown; restart recovery test.

Notes

  • Expected cold start: Machine start plus Node boot, roughly 5–10 s. Acceptable for jobs that take minutes; document it.
  • Connect already keeps offline deliveries (free tier: newest 25 for 1 h; paid: 500 for 24 h, propr-routing/src/relayTier.ts). Confirm whether replay on reconnect is automatic or needs to be requested, and handle both.

Activity

  1. propr-dev commented on Nov 24, 2026

    @propr-dev
    Contributor

    🤖 AI processing has started for this issue using claude agent with claude-opus-5-5 model.

    I'll analyze the problem and work on a solution. This may take a few minutes.

    Processing Details:

    • Agent: claude
    • Model: claude-opus-5-5
    • Branch: 3770/claude-opus-5-5-opt-in-idle-shutdown-and--20261124-0023-b3m
    • Base Branch: 3758-epic-runtime-abstraction-sc0
    • Worktree: issue-3770-20261124-0023-claude-opus-5-5-b3m

    🔍 Track Task Execution

  2. integry commented on Dec 1, 2026

    @integry
    OwnerAuthor

    Done in #3772, which merged into the runtime epic; the epic merged into main with #3774 and ships in 0.9.4.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions