Skip to content

Idle stop never stops with ProPR Connect: wake hint uses WS frames Connect doesn't implement (use POST /v1/wake-hint, wake_status) #3944

Done

Description

@integry

Problem: idle stop never stops an instance using ProPR Connect

Found in the 0.9.4 release-candidate test (Fly, PROPR_IDLE_SHUTDOWN=on, which is now the setup default after #3922). The instance went idle and started draining, then aborted ten seconds later. It stayed up for 30+ minutes:

23:46:27 Idle shutdown: instance idle, draining   (idleForMs 929975)
23:46:37 Idle shutdown aborted: Connect did not acknowledge the wake hint, so nothing would wake the instance or replay its deliveries; staying up

The wake target was registered: connect.wakeTarget = https://<app>.fly.dev/wake in the launch config, verified by registerWakeTarget.

Cause: ProPR implements a WebSocket protocol that Connect never shipped

The ProPR side, in packages/core/src/intake/routingIdleFrames.ts, added in #3772:

  • sends a WS frame { type: 'wake_hint', reason: 'idle_shutdown', nextDueAt } and waits for a wake_hint_ack frame;
  • after waking, sends { type: 'replay', reason: 'idle_wake', since } and waits for replay_ack.

The Connect side, integry/propr-routing#336, is deployed and documented in docs/instance-wake.md:

  • The scheduled-wake hint is HTTP: POST /v1/wake-hint, authenticated with the relay token, body {"wake_at": "<ISO-8601>" | null}. The HTTP response is the acknowledgement.
  • Connect also accepts a WS wake_hint frame, but validates wakeAt. ProPR's frame has no wakeAt (it sends nextDueAt), so Connect rejects it. Connect never sends a wake_hint_ack frame in any case.
  • Replay needs no request. On the hello from a token with a wake target, Connect sends a wake_status frame (replayQueued, cache, overflow), then replays the cached deliveries in order. There is no replay / replay_ack frame.
  • Wake ping: with a wake target registered, any delivery arriving while the instance has no socket makes Connect POST <wakeTarget>. A hint is only needed for scheduled work, with wake_at set to the next due time.

Fix (ProPR only, no Connect change needed)

  1. Before an idle exit, call POST /v1/wake-hint over the relay HTTP client with { wake_at: nextDueAt ?? null }. A 2xx response means acknowledged. 404 wake_target_not_found means the wake target is missing: re-register it (or report it), and don't stop. Any other failure: don't stop, and log the code.
  2. Drop the WS wake_hint/wake_hint_ack and replay/replay_ack exchange, or keep it only as an optional extension behind a capability that Connect doesn't advertise today.
  3. After a wake, treat the wake_status frame as the replay confirmation, and log replayQueued and any overflow. Show overflow (deliveries dropped while asleep) as a notification.
  4. Make the Connect idle wake idle-signal source reflect the HTTP result, so the dashboard and logs show why the instance stays up.
  5. Update the setup and docs text if they describe the frames.

Tests and live check

  • Tests: a unit test against a mock relay: 2xx stops, 404 re-registers and stays up, and a timeout or 5xx stays up. A wake_status frame after hello clears the pending replay.
  • Live check on Fly: with no dashboard tab open, the instance stops about 15 minutes after its last activity. A new AI issue on the monitored repo then wakes it through Connect's ping, and the task runs. A delivery made while it was stopped is replayed after it wakes.

Activity

  1. propr-dev commented on Dec 1, 2026

    @propr-dev
    Contributor

    🤖 AI processing has started for this issue using codex agent with gpt-6.2-sol model.

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

    Processing Details:

    • Agent: codex
    • Model: gpt-6.2-sol
    • Branch: 3944/gpt-6.2-sol-idle-stop-never-stops-wit-20261201-0001-zcx
    • Base Branch: 3758-epic-runtime-abstraction-sc0
    • Worktree: issue-3944-20261201-0001-gpt-6.2-sol-zcx

    🔍 Track Task Execution

  2. added a commit that references this issue on Dec 1, 2026
    9a6ddf9
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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