Emergency rollback to previous deployment version - supports automatic and manual rollback triggers, validates rollback success, and creates incident report. Use when a deployment fails or needs to be reverted.
From popkit-opsnpx claudepluginhub jrc1883/popkit-ai --plugin popkit-opsThis skill uses the workspace's default tool permissions.
scripts/rollback_deployment.pyDesigns and optimizes AI agent action spaces, tool definitions, observation formats, error recovery, and context for higher task completion rates.
Implements structured self-debugging workflow for AI agent failures: capture errors, diagnose patterns like loops or context overflow, apply contained recoveries, and generate introspection reports.
Compares coding agents like Claude Code and Aider on custom YAML-defined codebase tasks using git worktrees, measuring pass rate, cost, time, and consistency.
Emergency rollback to a previous deployment version with verification and incident reporting.
Trigger: /popkit-ops:deploy rollback or when a deployment fails
Purpose: Safely revert a deployment to the last known good version. Validates rollback success and generates an incident report for post-mortem analysis.
| Step | When | Decision ID |
|---|---|---|
| 1 | Strategy selection | rollback_strategy |
| 2 | Before execution | confirm_rollback |
| 3 | After rollback | incident_report |
Skipping these violates PopKit UX standard.
python scripts/rollback_deployment.py --dir . --action assess --target docker
This:
Use AskUserQuestion:
- question: "How should I roll back?"
- header: "Strategy"
- options:
- "Previous version (Recommended)" - Last successful deployment
- "Specific version" - Choose a specific version
- "Investigate first" - Gather more info
Use AskUserQuestion:
- question: "Confirm rollback? This will revert the deployment."
- header: "Confirm"
- options:
- "Roll back now" - Execute immediately
- "Dry run first" - Simulate the rollback
- "Abort" - Cancel rollback
python scripts/rollback_deployment.py --dir . --action rollback --target docker --version 1.1.0
python scripts/rollback_deployment.py --dir . --action verify --target docker
Use AskUserQuestion:
- question: "Rollback complete. Create incident report?"
- header: "Report"
- options:
- "Create report (Recommended)" - Generate for post-mortem
- "Skip report" - No report needed
latest dist-tag to previous versionkubectl rollout undo for deploymentsDeployment Rollback
===================
Target: docker
Current: 1.2.0 (FAILED)
Rollback to: 1.1.0 (last successful)
Steps:
[1/4] Pulling previous image... done
[2/4] Stopping current... done
[3/4] Starting rollback version... done
[4/4] Health check... passed
Result: ROLLBACK SUCCESS
Duration: 25s
Incident Report: .claude/popkit/incidents/incident-20260318-143500.md
Next: Investigate root cause, then /popkit-ops:deploy execute when fixed
Generated at .claude/popkit/incidents/incident-{timestamp}.md:
# Deployment Incident Report
## Summary
- **Date:** 2026-03-18T14:35:00Z
- **Target:** docker
- **Failed Version:** 1.2.0
- **Rolled Back To:** 1.1.0
- **Duration of Outage:** ~5 minutes
- **Severity:** P2
## Timeline
- 14:30:00 - Deployment of v1.2.0 initiated
- 14:30:45 - Deployment completed
- 14:31:00 - Health check failures detected
- 14:33:00 - Rollback initiated
- 14:35:00 - Rollback completed, service restored
## Root Cause
[To be filled during post-mortem]
## Impact
[To be filled during post-mortem]
## Action Items
- [ ] Investigate root cause
- [ ] Add regression test
- [ ] Update deployment validation checks
Called by:
/popkit-ops:deploy rollback commandpop-deploy-execute workflow (on failure)Triggers:
Followed by:
pop-deploy-validate - Re-validate after fixing issuespop-deploy-execute - Re-deploy when fixed| Component | Relationship |
|---|---|
pop-deploy-execute | Deployment that may need rollback |
pop-deploy-validate | Post-rollback validation |
rollback-specialist | Agent for rollback operations |
deploy.json | Configuration and history |