Repository navigation
Done
Labels
Description
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 awake_hint_ackframe; - after waking, sends
{ type: 'replay', reason: 'idle_wake', since }and waits forreplay_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_hintframe, but validateswakeAt. ProPR's frame has nowakeAt(it sendsnextDueAt), so Connect rejects it. Connect never sends awake_hint_ackframe in any case. - Replay needs no request. On the hello from a token with a wake target, Connect sends a
wake_statusframe (replayQueued,cache,overflow), then replays the cached deliveries in order. There is noreplay/replay_ackframe. - 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, withwake_atset to the next due time.
Fix (ProPR only, no Connect change needed)
- Before an idle exit, call
POST /v1/wake-hintover the relay HTTP client with{ wake_at: nextDueAt ?? null }. A 2xx response means acknowledged.404 wake_target_not_foundmeans 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. - Drop the WS
wake_hint/wake_hint_ackandreplay/replay_ackexchange, or keep it only as an optional extension behind a capability that Connect doesn't advertise today. - After a wake, treat the
wake_statusframe as the replay confirmation, and logreplayQueuedand any overflow. Show overflow (deliveries dropped while asleep) as a notification. - Make the
Connect idle wakeidle-signal source reflect the HTTP result, so the dashboard and logs show why the instance stays up. - 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_statusframe 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
AIissue 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
propr-dev commentedon Dec 1, 2026
🤖 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:
codexgpt-6.2-sol3944/gpt-6.2-sol-idle-stop-never-stops-wit-20261201-0001-zcx3758-epic-runtime-abstraction-sc0issue-3944-20261201-0001-gpt-6.2-sol-zcx🔍 Track Task Execution
fix: require Connect wake-hint POST before idle stop