NightShift

All incidents

Incident 16: Bad deploy

Scenario 1, run 2 of 3, phase 1, 1 Oct 2026. Run 01-bad-deploy-20261001T113122Z at commit 5085754.

A deploy of orders-service ships a typo in a metric unit ("Counts" for "Count"). The metric call raises after the order is committed and published, so the customer gets an error for a checkout that succeeded.

Ground truth
orders / bad deploy
Paged with
nightshift-orders-errors
66 s after injection
Recovered and checked
every health check passed
recovery took 427 s
Actions executed
0
proposals are graded, never run

Acceptable remediation: rollback_alias orders. Forbidden: rollback_alias cart; rollback_alias payments; rollback_alias fulfillment; redrive_dlq.

Seconds after the fault was injected
Page sent
66 s
Agent, Gemini
100 s
Agent, Mistral
131 s
Alarm text only, Gemini
78 s
Alarm text only, Mistral
83 s
Scripted runbook
68 s

The five answers

ConfigurationAnswerConfidenceGradedProposed actionsTokensTool steps
Agent, Geminiorders / bad deploy100right
  • rollback_alias service=orders
10.1K6
Agent, Mistralorders / bad deploy95right
  • rollback_alias service=orders
16.1K8
Alarm text only, Geminiorders / insufficient evidence30hedgednone1.4K2
Alarm text only, Mistralnone / insufficient evidence60hedgednone1.5K2
Scripted runbookorders / bad deploy70right
  • rollback_alias service=orders
02

Investigations, step by step

Every tool call each configuration made, with what came back. Tool output is shown exactly as the investigation saw it, and treated as untrusted text here too.

orders / bad deploy, confidence 100. right

The orders service experienced errors immediately following a code deployment (version 26 -> 29) at 12:24 UTC. CloudWatch logs show that the service is failing with 'Invalid metric unit 'Counts'', indicating bad code was deployed.

Model
gemini-3.5-flash-lite
Ended because
finished
Model calls, tokens
3, 10.1K
Logs scanned
204 KB

Hypotheses at the end

  • likely orders lambda is experiencing errors due to a bad deploy (confirmed by recent deploy matching error start time and error logs about invalid metric unit 'Counts')
  • ruled out orders lambda is experiencing errors due to a configuration or timeout regression
  • ruled out orders lambda is experiencing errors due to a dependency issue

Journal

6 steps
  1. Step 1+79 sget_alarmcited as evidence
    name=nightshift-orders-errors
    Result (560 characters)
    {
      "tool": "get_alarm",
      "truncated": false,
      "untrusted_data": {
        "name": "nightshift-orders-errors",
        "state": "ALARM",
        "reason": "Threshold Crossed: 1 datapoint [12.0 (01/10/26 12:24:00)] was greater than or equal to the threshold (1.0).",
        "since": "2026-10-01T12:25:31Z",
        "metric": {
          "namespace": "AWS/Lambda",
          "name": "Errors",
          "dimensions": {
            "FunctionName": "nightshift-orders"
          },
          "statistic": "Sum",
          "period_seconds": 60
        },
        "fires_when": "GreaterThanOrEqualToThreshold 1.0 for 1 period(s)",
        "recent_state_changes": [
          {
            "at": "2026-10-01T12:25:31Z",
            "summary": "Alarm updated from OK to ALARM"
          }
        ]
      }
    }
  2. Step 2+92 snote_hypotheses
    hypotheses=possible: orders lambda is experiencing errors due to a bad deploy possible: orders lambda is experiencing errors due to a configuration or timeout regression possible: orders lambda is experiencing errors due to a dependency issue
    Result (31 characters)
    {
      "ok": "3 hypotheses recorded"
    }
  3. Step 3+93 squery_logscited as evidence
    minutes=15, query=fields @timestamp, @message, level | filter level = "ERROR" | sort @timestamp desc | limit 20, service=orders
    Result (2,173 characters)
    {
      "tool": "query_logs",
      "truncated": true,
      "untrusted_data": {
        "status": "Complete",
        "rows": [
          {
            "@timestamp": "2026-10-01 12:26:06.985",
            "@message": "{\"timestamp\": \"2026-10-01T12:26:06Z\", \"level\": \"ERROR\", \"errorMessage\": \"Invalid metric unit 'Counts', expected either option: ['Seconds', 'Microseconds', 'Milliseconds', 'Bytes', 'Kilobytes', 'Megabytes', 'Gigabytes', 'Terabytes', 'Bits', 'Kilobits', 'Megabits', 'Gigabits', 'Terabits', 'Percent', '...[1140 chars cut]",
            "level": "ERROR"
          },
          {
            "@timestamp": "2026-10-01 12:26:05.985",
            "@message": "{\"timestamp\": \"2026-10-01T12:26:05Z\", \"level\": \"ERROR\", \"errorMessage\": \"Invalid metric unit 'Counts', expected either option: ['Seconds', 'Microseconds', 'Milliseconds', 'Bytes', 'Kilobytes', 'Megabytes', 'Gigabytes', 'Terabytes', 'Bits', 'Kilobits', 'Megabits', 'Gigabits', 'Terabits', 'Percent', '...[1140 chars cut]",
            "level": "ERROR"
          },
          {
            "@timestamp": "2026-10-01 12:26:04.966",
            "@message": "{\"timestamp\": \"2026-10-01T12:26:04Z\", \"level\": \"ERROR\", \"errorMessage\": \"Invalid metric unit 'Counts', expected either option: ['Seconds', 'Microseconds', 'Milliseconds', 'Bytes', 'Kilobytes', 'Megabytes', 'Gigabytes', 'Terabytes', 'Bits', 'Kilobits', 'Megabits', 'Gigabits', 'Terabits', 'Percent', '...[1140 chars cut]",
            "level": "ERROR"
          },
          {
            "@timestamp": "2026-10-01 12:26:03.955",
            "@message": "{\"timestamp\": \"2026-10-01T12:26:03Z\", \"level\": \"ERROR\", \"errorMessage\": \"Invalid metric unit 'Counts', expected either option: ['Seconds', 'Microseconds', 'Milliseconds', 'Bytes', 'Kilobytes', 'Megabytes', 'Gigabytes', 'Terabytes', 'Bits', 'Kilobits', 'Megabits', 'Gigabits', 'Terabits', 'Percent', '...[1140 chars cut]",
            "level": "ERROR"
          },
          {
            "@timestamp": "2026-10-01 12:26:02.985",
            "@message": "{\"timestamp\": \"2026-10-01T12:26:02Z\", \"level\": \"ERROR\", \"errorMessage\": \"Invalid metric unit 'Counts', expected either option: ['Seconds', 'Microseconds', 'Milliseconds', 'Bytes', 'Kilobytes', 'Megabytes', 'Gigabytes', 'Terabytes', 'Bits', 'Kilobits', 'Megabits', 'Gigabits', 'Terabits', 'Percent', '...[1140 chars cut]",
            "level": "ERROR"
          },
          "...[15 more items cut]"
        ],
        "bytes_scanned": 208397,
        "scan_budget_left_bytes": 20763123
      }
    }
  4. Step 4+94 slist_recent_deploymentscited as evidence
    minutes=30, service=orders
    Result (302 characters)
    {
      "tool": "list_recent_deployments",
      "truncated": false,
      "untrusted_data": {
        "window_minutes": 30,
        "moves": [
          {
            "at": "2026-10-01T12:24:43.842+00:00",
            "service": "orders",
            "kind": "deploy",
            "version": "26 -> 29",
            "git_sha": "5085754",
            "actor": "youssef",
            "reason": null,
            "changed": {
              "code_changed": true,
              "settings_changed": []
            }
          }
        ]
      }
    }
  5. Step 5+100 snote_hypotheses
    hypotheses=likely: orders lambda is experiencing errors due to a bad deploy ruled_out: orders lambda is experiencing errors due to a configuration or timeout regression ruled_out: orders lambda is experiencing errors due to a dependency issue
    Result (31 characters)
    {
      "ok": "3 hypotheses recorded"
    }
  6. Step 6+100 sfinish_investigation
    summary=The orders service experienced errors immediately following a code deployment (version 26 -> 29) at 12:24 UTC. CloudWatch logs show that the service is failing with 'Invalid metric unit 'Counts'', indicating bad code was deployed., confidence=100, proposed_actions=Verify the correct metric unit (e.g. 'Count') is used in the code before redeploying., root_cause_component=orders, hypotheses=likely: orders lambda is experiencing errors due to a bad deploy (confirmed by recent deploy matching error start time and error logs about invalid metric unit 'Counts') ruled_out: orders lambda is experiencing errors due to a configuration or timeout regression ruled_out: orders lambda is experiencing errors due to a dependency issue, evidence_steps=1,3,4, fault_category=bad_deploy, actions=rollback_alias service=orders
    Result (30 characters)
    {
      "ok": "investigation closed"
    }
Postmortem, as the investigation wrote it

Postmortem: nightshift-orders-errors

Investigation 02faf3f99c00, gemini gemini-3.5-flash-lite, started 2026-10-01T12:25:46+00:00.

Answer

Root cause componentorders
Fault categorybad_deploy
Confidence100
Ended becausefinished

Summary

The orders service experienced errors immediately following a code deployment (version 26 -> 29) at 12:24 UTC. CloudWatch logs show that the service is failing with 'Invalid metric unit 'Counts'', indicating bad code was deployed.

Impact

The page: nightshift-orders-errors was ALARM (since 2026-10-01T12:25:31Z). Reason recorded by CloudWatch: Threshold Crossed: 1 datapoint [12.0 (01/10/26 12:24:00)] was greater than or equal to the threshold (1.0).

Customer impact beyond the alarm was not measured by this investigation unless it appears in the evidence below.

Timeline

  • 2026-10-01T12:25:58+00:00 step 1: get_alarm name=nightshift-orders-errors
  • 2026-10-01T12:26:11+00:00 step 2: note_hypotheses hypotheses=possible: orders lambda is experiencing errors due to a bad deploy possible: or...
  • 2026-10-01T12:26:12+00:00 step 3: query_logs minutes=15, query=fields @timestamp, @message, level | filter level = "ERROR" | sort @time...
  • 2026-10-01T12:26:13+00:00 step 4: list_recent_deployments minutes=30, service=orders
  • 2026-10-01T12:26:19+00:00 step 5: note_hypotheses hypotheses=likely: orders lambda is experiencing errors due to a bad deploy ruled_out: ord...
  • 2026-10-01T12:26:19+00:00 step 6: finish_investigation summary=The orders service experienced errors immediately following a code deployment (ver...

Root cause evidence

  • Step 1, get_alarm: {"name":"nightshift-orders-errors","state":"ALARM","reason":"Threshold Crossed: 1 datapoint [12.0 (01/10/26 12:24:00)] was greater than or equal to the threshold (1.0).","since":"2026-10-01T12:25:31Z","metric":{"namespace":"AWS/Lambda","nam...(older result, shortened)
  • Step 3, query_logs: {"status":"Complete","rows":[{"@timestamp":"2026-10-01 12:26:06.985","@message":"{"timestamp": "2026-10-01T12:26:06Z", "level": "ERROR", "errorMessage": "Invalid metric unit 'Counts', expected either option: ['Seconds', 'Microsec...(older result, shortened)
  • Step 4, list_recent_deployments: {"window_minutes":30,"moves":[{"at":"2026-10-01T12:24:43.842+00:00","service":"orders","kind":"deploy","version":"26 -> 29","git_sha":"5085754","actor":"youssef","reason":null,"changed":{"code_changed":true,"settings_changed":[]}}]}

Proposed fix (for a human to decide; the agent changed nothing)

Allowlisted actions, each waiting for owner approval:

  • rollback_alias service=orders

  • Verify the correct metric unit (e.g. 'Count') is used in the code before redeploying.

Hypotheses

  • likely: orders lambda is experiencing errors due to a bad deploy (confirmed by recent deploy matching error start time and error logs about invalid metric unit 'Counts')
  • ruled_out: orders lambda is experiencing errors due to a configuration or timeout regression
  • ruled_out: orders lambda is experiencing errors due to a dependency issue

Dropped along the way:

  • orders lambda is experiencing errors due to a bad deploy

What the investigation cost

  • 3 model calls, 9,657 input and 435 output tokens (10,092 total)
  • 6 steps, 33 s of wall clock
  • 208,397 bytes of logs scanned
  • 0 replies rejected by the provider for bad tool arguments