--- description: Rollback CI phase — revert the last phase or specified phase by resetting to its pre-phase state --- # CI Rollback Rollback a CI phase by reverting to the state before the phase started. Uses git to find the exact commit to reset to. **Usage:** `ci-rollback [phase_number]` If no phase specified, rolls back the current (most recent) phase. ## Step 1: Load Git Context ```bash git log --max-count=30 git branch -a ``` Find the phase branch and its merge commit. ## Step 2: Identify Rollback Point For the specified phase: 1. Find the merge commit that completed the phase 2. Find the commit just before the phase branch was created 3. This is the rollback point ```bash git log --grep="P##" --format="%H %s" | head -20 ``` ## Step 3: Confirm (Safety Gate) Even in full autonomy mode, destructive operations need confirmation: ``` ⚠ ROLLBACK: This will revert Phase [N] — [name] Rollback point: [commit hash] [subject] Changes to be lost: [N] commits Proceed? (y/n) ``` Wait for confirmation. This is a safety gate — always confirm destructive operations. ## Step 4: Execute Rollback ```bash git revert [merge_commit_hash] ``` Or for a hard rollback (not recommended, only if explicitly requested): ```bash git reset --hard [rollback_point] ``` ## Step 5: Update State - Delete the phase branch (if not already removed) - Update `.ci/REQUIREMENTS.md` — mark phase requirements as blocked - Update `.ci/ROADMAP.md` — mark phase as not_started Commit the rollback: ``` chore(P##): rollback [phase-name] — [reason] ---ci--- phase: [N] milestone: [vX.X] status: specify escalations: - id: E-XXX type: rollback description: Phase rolled back resolution: auto ---/ci--- ``` ## Step 6: Report Report rollback complete, rollback point, and next steps.