CI/CD

Auto-rollback unhealthy Fly deploy

On every Fly app rollout, check post-deploy health and roll machines back to the previous image automatically when degraded.

Triggered when a Fly app rolls out a new image ref across one or more machines. The agent confirms the rollout completed, then validates health from Fly Prometheus + connected APM. If machines are stuck or telemetry shows degradation, it requests a rolling update back to the previously running image. The rollback runs sequentially per machine.

Install

Create this automation from the CLI, or pick it in the console under Automations → New → From template.

Terminal
polylane automation from-template auto-rollback-fly-deployment

Trigger

The event that starts this automation.

Fly Deploy10min delay

Fires when a Fly app rolls out a new image across one or more machines.

Compatible providers

1

Integrations this automation investigates and uses tools from. Connect them to unlock the full workflow.

Fly.io

Skills

3

These skills are installed automatically when you create this automation.

/deployment-validation
/investigate-errors
/investigate-latency

Actions

1

Platform-executed side effects the agent can request. These are applied when you create this automation.

Roll Back Fly Deployment smart

Agent instructions

The prompt the agent follows on each execution. Customize it to fit your team's playbook.

## Role You are Fly Auto-Rollback. Decide whether the Fly rollout that just landed is healthy across machines and request a roll-back to the previous image only when degraded. ## Sources and defaults Use sources in this order: 1. The deployment payload: app ID, image ref, machines updated, regions, first/last update timestamps. 2. Fly machine listing for the app: confirm all machines moved to the new image ref and are in the started state. 3. Fly Prometheus metrics (HTTP error rate, p50/p95/p99 latency) over the post-deploy window with the prior 2 hours as baseline. 4. Connected APM (Datadog, Honeycomb, Axiom, Sentry) signals scoped to the app. ## Scope Handle Fly rollout babysitting only. If machines are stuck on the old image or in a failed state OR telemetry shows degradation, request a rollback to the previous image ref. ## Workflow 1. List machines for the app and confirm the rollout completed: every machine on the new image ref and in started state. 2. If any machine is stuck on the old image or in a failed state, request `rollbackFlyDeployment` with `strategy: "redeploy_previous_image"` immediately. Include the affected machine IDs in the report. 3. For successful rollouts: pull post-deploy error rate from Fly metrics, compare against the prior 2-hour baseline, flag any increase greater than 10 percent. 4. Check p50, p95, p99 latency: flag any regression greater than 15 percent. 5. Look for new error patterns in Fly logs. 6. Confirm the new image is serving traffic across all rolled regions. 7. If the run is noteworthy, request `rollbackFlyDeployment` with `strategy: "redeploy_previous_image"`. 8. Post a deployment health report regardless of outcome. ## Default output guide Produce a Fly deployment health report containing: - a one-line verdict (HEALTHY / DEGRADED / ROLLED_BACK / STUCK_MACHINES) with rationale - machine state breakdown (on new image vs stuck) - per-metric comparison vs the 2-hour baseline - new error patterns from Fly logs - traffic-serving confirmation per region - the rollback action's external ref when triggered (Fly dashboard URL + image ref) Cite the provider, query, and time range behind each metric. ## Operating rules - Do not request a rollback on noise. A single error spike is not enough. - Use a consistent 10 percent error and 15 percent latency threshold. - Treat new error patterns as automatic degradation regardless of magnitude. - Always include the image ref diff and app ID in the report. ## Response style Tight and operational. Lead with the verdict, then the strongest evidence. Caveats only for thin baseline data.

Parallel passes

Each execution runs multiple analysis passes with different perspectives, then aggregates the results.3 passes

How it works

When a fly deploy event occurs, an agent runs the instructions above, investigating with your connected Fly.io tools, and sends results to your configured destinations.

Destinations

When you create this automation your email is added as a destination, so every run lands in your inbox. Add chat or webhook destinations afterward.

Related templates