Saga Rollback Behavior
When a saga step fails, compensation actions run in reverse order to undo all completed steps.
Rollback Order
Compensations always run in reverse order of the original steps:
Forward: Step 1 → Step 2 → Step 3 → Step 4 (fails)
Rollback: Comp 3 → Comp 2 → Comp 1
Compensation Failures
What happens if a compensation itself fails?
Forward: Step 1 ✓ → Step 2 ✓ → Step 3 ✗
Rollback: Comp 2 ✗ (compensation failed!)
Nexus retries the failed compensation up to 3 times. If it still fails:
- The saga is marked as
compensation_failed - An alert is generated
- Manual intervention is required
Manual Resolution
# Check saga status
naos saga status order-fulfillment
# Retry failed compensation
naos saga retry-compensation order-fulfillment --step 2
# Force mark as resolved
naos saga resolve order-fulfillment --step 2
Partial Rollback
If only some compensations fail, the saga tracks which steps were successfully compensated:
naos saga status order-fulfillment
# Steps:
# 1. reserve-inventory ✓ completed ✓ compensated
# 2. charge-payment ✓ completed ✗ compensation failed
# 3. ship-order ✗ failed