Repository navigation
Description
Part of the runtime-abstraction epic (#3758). This blocks #3804: its live smoke can't pass until this lands.
Problem: with direct webhooks, idle shutdown loses the event that wakes the instance
Evidence from a live run of the Fly smoke workflow (https://github.com/integry/propr/actions/runs/45654340384; fixture webhook delivery log):
| Time (UTC) | Event | Result |
|---|---|---|
| 16:34:25–29 | ping, issues.opened, issues.labeled (llm-claude) |
200 in under 1 s, instance awake |
| 16:37:01 | issues.labeled (AI), sent while the Machine was stopped |
timeout after 10 s: "context deadline exceeded (Client.Timeout exceeded while awaiting headers)", 1 attempt |
GitHub gives a webhook delivery 10 seconds and does not retry automatically. Fly's proxy starts the stopped Machine on that request, but a cold wake takes about 16 s to the first 200 (measured earlier on the tutorial deploy). The instance comes up, but the AI label that woke it is never processed: issue #7 in the fixture repository got no ProPR comment for 20+ minutes.
docs/docs/operations/idle-shutdown.md covers this only for Connect intake: the relay caches deliveries and the instance asks for a replay on wake. Direct webhooks have no equivalent. The docs also assume a cold start of 5–10 s, which is optimistic.
Fix: redeliver failed deliveries after an idle wake (direct-webhook mode)
- When: on startup after an idle stop, i.e. when the idle state shows a stop (
shutdownAt/intakeStoppedAt) andGITHUB_EVENT_INTAKE_MODE=direct_webhook. Run it once the webhook endpoint is accepting requests, so redeliveries are processed. - What: list the App webhook's deliveries with the App JWT (
GET /app/hook/deliveries, paginated withcursor, newest first) back to the stop time minus a small margin (about 2 min). Select failed deliveries (status_code0 or ≥ 400, or status notOK) for which no later successful delivery with the sameguidexists. Request redelivery withPOST /app/hook/deliveries/{delivery_id}/attempts.- Cap the count (for example 200) and log any skipped.
- Respect rate limits.
- Never redeliver deliveries older than the stop window.
- Deduplication: make sure a redelivered event (same
X-GitHub-DeliveryGUID) is processed exactly once, even if the original was partly received. Check the existing webhook duplicate suppression and extend it if needed. - Observability: log a summary at info level (
scanned,failed,redelivered,skipped), and expose the last result in the idle-shutdown status the API already reports. - Repository-level webhooks: document that only the GitHub App's own webhook is recovered (that's what the tutorial sets up). A repository webhook would need a token with repository-hook access; mention it, but don't implement it unless it's trivial.
- The smoke workflow (
.github/workflows/fly-e2e.yml): stop creating a repository webhook with the PAT. Point the fixture GitHub App's own webhook at the disposable instance instead (PATCH /app/hook/configwith the App JWT, using the App credentials fromFLY_E2E_APP_ENV: URLhttps://$APP.fly.dev/webhook, the generated secret, content type JSON). Restore or clear it in analways()cleanup step. The App must be subscribed to Issues and Pull request events: check that, and document the requirement. This makes the smoke exercise exactly the tutorial's path, including recovery. - Docs: in
idle-shutdown.mdand the Fly tutorial, explain that the waking delivery times out on GitHub's side and is redelivered by the instance after start, and put the measured cold start (about 15–20 s to first response) in place of the 5–10 s claim.
Acceptance
- Unit tests:
- delivery selection (failed vs. succeeded with the same GUID, the time window, pagination, the cap);
- no recovery outside direct-webhook mode or without a recorded stop;
- redelivery requests are made once.
- Live: the Fly smoke workflow passes end to end: idle stop, wake by the
AIlabel, the PR created on Sprites, cleanup. Run it through the temporary branch that adds apushtrigger (workflow_dispatchneeds the workflow on the default branch), and link the run in the PR.
Activity
propr-dev commentedon Nov 25, 2026
🤖 AI processing has started for this issue using codex agent with gpt-6.2-astra model.
I'll analyze the problem and work on a solution. This may take a few minutes.
Processing Details:
codexgpt-6.2-astra3811/gpt-6.2-astra-idle-shutdown-redeliver-t-20261125-1715-kfx3758-epic-runtime-abstraction-sc0issue-3811-20261125-1715-gpt-6.2-astra-kfx🔍 Track Task Execution
chore: redeliver GitHub webhooks that woke an idle instance
ci: remove Fly smoke workflow and tutorial from runtime recovery
integry commentedon Dec 1, 2026
Done in #3812, which merged into the runtime epic; the epic merged into
mainwith #3774 and ships in 0.9.4.