Harness incident response

From Intense-Visions/harness-engineering · View interactive version

Harness incident response is an AI agent skill from the GitHub repository Intense-Visions/harness-engineering. > Runbook generation, postmortem analysis, and SLO/SLA tracking. Diagnoses incidents by tracing symptoms through services, produces structured postmortems, and maintains error budget accounting.

How to use this skill

Skill file

Harness Incident Response

Runbook generation, postmortem analysis, and SLO/SLA tracking. Diagnoses incidents by tracing symptoms through services, produces structured postmortems, and maintains error budget accounting.

When to Use

Process

Phase 1: ASSESS -- Determine Scope and Severity

  1. Identify the incident signal. Scan available evidence to determine what triggered the investigation:
  1. Map affected services. Trace the blast radius from the incident signal:
  1. Classify severity. Apply the project's severity matrix if one exists in docs/runbooks/severity-matrix.md. Otherwise, use standard classification:
  1. Establish timeline boundaries. Determine:
  1. Check for existing runbooks. Search docs/runbooks/ and runbooks/ for procedures matching the affected service or failure mode. If a runbook exists, evaluate whether it was followed and whether it was effective.

Phase 2: INVESTIGATE -- Trace Root Cause

  1. Correlate with recent changes. Run git log --oneline --since="7 days ago" and cross-reference commits with the incident timeline. Flag commits that touched affected services or their dependencies.
  1. Analyze error patterns. Search the codebase for error handling related to the failure:
  1. Trace data flow. Map the request path from entry point to failure point:
  1. Identify contributing factors. Distinguish between root cause and contributing factors:
  1. Validate the hypothesis. Confirm the root cause by checking:

Phase 3: DOCUMENT -- Generate Artifacts

  1. Generate the postmortem report. Create a structured document in docs/postmortems/YYYY-MM-DD-<slug>.md with these sections:
  1. Create or update runbooks. For each failure mode identified:
  1. Update the incident log. If docs/incidents/index.md exists, append the new incident with date, severity, MTTR, and link to the postmortem.
  1. Tag related code. Add or update // INCIDENT-YYYY-MM-DD: <description> comments at the code locations involved in the root cause. This creates a searchable history of incident-prone code.

Phase 4: IMPROVE -- SLO Adjustments and Prevention

  1. Calculate SLO impact. If slo.yaml or equivalent SLO definitions exist:
  1. Evaluate alerting effectiveness. For each alert that fired (or should have fired):
  1. Propose SLO adjustments. Based on the incident analysis:
  1. Generate preventive action items. Categorize actions by type:
  1. Produce the improvement summary. Output a prioritized action list with effort estimates and expected impact on MTTD and MTTR.

Harness Integration

Success Criteria

Examples

Example: Node.js API Timeout Incident with Datadog Alerts

Phase 1: ASSESS
  Signal: Datadog alert "api-gateway p99 latency > 2000ms" fired at 14:32 UTC
  Affected: api-gateway -> user-service -> PostgreSQL
  Severity: SEV2 (major degradation, 40% of requests timing out)
  MTTD: 4 minutes (alert fired 4 min after first error)
  MTTR: 47 minutes (resolved at 15:19 UTC)

Phase 2: INVESTIGATE
  Correlated change: commit abc123 "add user preferences join" deployed at 14:25 UTC
  Root cause: N+1 query in GET /api/users/:id/preferences — new LEFT JOIN
    on unindexed column `preferences.user_id` caused full table scan
  Contributing factors:
    - No query performance test for the preferences endpoint
    - Missing database index on preferences.user_id
    - No circuit breaker between api-gateway and user-service

Phase 3: DOCUMENT
  Created: docs/postmortems/2026-03-15-user-service-timeout.md
  Created: docs/runbooks/user-service-database-slow-query.md
  Updated: docs/incidents/index.md

Phase 4: IMPROVE
  SLO impact: Consumed 12% of monthly error budget (88% remaining)
  Action items:
    1. [P0] Add index on preferences.user_id (owner: @backend, due: 2026-03-16)
    2. [P1] Add query execution time assertions to integration tests (owner: @backend, due: 2026-03-22)
    3. [P1] Add circuit breaker on api-gateway -> user-service (owner: @platform, due: 2026-03-22)
    4. [P2] Add Datadog query performance monitor for user-service (owner: @sre, due: 2026-03-29)

Example: Kubernetes Pod CrashLoopBackOff with PagerDuty Escalation

Phase 1: ASSESS
  Signal: PagerDuty incident #4521 — payment-service pods in CrashLoopBackOff
  Affected: payment-service -> Stripe API -> order-service (downstream)
  Severity: SEV1 (payment processing completely down)
  MTTD: 2 minutes (PagerDuty auto-detected from Kubernetes health checks)
  MTTR: 23 minutes

Phase 2: INVESTIGATE
  Root cause: Environment variable STRIPE_WEBHOOK_SECRET rotated in Vault
    but payment-service pods were not restarted to pick up new value.
    Stripe signature verification failed on all incoming webhooks, causing
    panic in the webhook handler (no error recovery).
  Contributing factors:
    - Vault secret rotation did not trigger pod restart
    - Webhook handler used panic instead of returning error
    - No runbook for secret rotation procedures

Phase 3: DOCUMENT
  Created: docs/postmortems/2026-03-20-payment-service-crashloop.md
  Created: docs/runbooks/payment-service-secret-rotation.md
  Created: docs/runbooks/payment-service-stripe-webhook-failure.md
  Updated: docs/incidents/index.md

Phase 4: IMPROVE
  SLO impact: Consumed 100% of weekly error budget. Feature freeze recommended.
  Action items:
    1. [P0] Add Vault agent sidecar with auto-restart on secret change (owner: @platform)
    2. [P0] Replace panic with error return in webhook handler (owner: @payments)
    3. [P1] Add synthetic Stripe webhook test to canary suite (owner: @payments)
    4. [P2] Create secret rotation runbook for all services (owner: @sre)

Rationalizations to Reject

| Rationalization | Reality |

| --------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |

| "The root cause was human error — someone pushed a bad config" | Human error is a symptom, not a root cause. The root cause is the system that allowed a bad config to reach production undetected. A postmortem that stops at "human error" prevents no future incidents because it identifies no systemic fix. |

| "We know what happened — we don't need to write a full postmortem for a minor incident" | The decision about what is "minor" is made under the stress of recovery, not under calm analysis. Contributing factors and near-misses that look minor in the moment are frequently the root cause of the next major incident. Document while the context is fresh. |

| "The action items are in Slack — we don't need to track them formally" | Action items not tracked in a formal system with owners and due dates are not completed. Slack messages are buried within hours. The improvement phase of an incident exists only if its outputs are tracked to completion. |

| "We don't have SLOs yet so we can't calculate error budget impact" | The absence of SLOs is itself a finding. Without SLOs, there is no objective basis for deciding whether reliability is acceptable. The incident is the forcing function to establish baseline SLOs. Document this gap as a P0 action item. |

| "The incident was caused by a third-party outage — nothing we could have done" | Third-party outages expose missing circuit breakers, absent fallbacks, and insufficient multi-region routing. The postmortem should document why the third-party outage caused a customer-visible incident and what resilience improvements would have isolated the blast radius. |

Gates

Escalation

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.