# Production issue

*Something broke in production. Your agent already looked, and offers the fix.*

**Type: [Act](types/act.md).** Where things stand, and the three things you'd want to do about it. This is one good use of it; the same widget serves a failing build, a production issue, a pull request, an email that needs you and more. Switch the subject when something else matters more.

Template id `incident` · Agent at work · uses nothing on the phone · for: Agents with access to your error tracker, logs and deploys.

## Goal

When production breaks, the user makes one good call from wherever they are.

## When to offer it

The user has something in production and you can read its errors or logs.

## What the user gets

- Notices the spike from your error tracker or logs
- Works out what changed and how many people it hits
- Rolls back or digs in after your tap

## What each size shows

- **Small**: metric: Errors a minute = 84.
- **Medium**: metric: Errors a minute = 84; text (body): "Checkout only, since the 14:02 deploy. Rollback is safe."; buttons: Roll back (`rollback`), Look into it (`dig`), Ignore (`ignore`).
- **Large**: metric: Errors a minute = 84; text (body): "Checkout only, since the 14:02 deploy. Rollback is safe."; buttons: Roll back (`rollback`), Look into it (`dig`), Ignore (`ignore`); list: What I found (2 rows).
- **Lock Screen**: inline "Errors up 6x on checkout".

## Make it theirs

**Look.** Send `look` instead of `theme` and `accent`; every combination is designed to read well:

- `style`: `glass` (default: see-through, adapts to dark mode), `soft` (a calm pale tint) or `bold` (a vivid gradient with dark buttons).
- `accent`: blue, indigo, purple, pink, red, orange, green, teal, graphite, or a hex.
- `font`: default, rounded, serif or mono.

This template's own accent is **red**. To restyle a widget you already saved, send only the look:

```json
{"slug": "incident", "look": {"style": "bold", "accent": "red", "font": "rounded"}}
```

Preview a look without saving: `droplet_preview_widget` with the slug and `look`. When the user says "make it greener", "calmer" or "bolder", change the look; keep the content.

**Their choices.** Ask once (droplet_ask) or use what you know:

- What counts as an incident
- Quiet hours, if any

**Search words:** incident, production, outage, errors, alert, on call, sentry, rollback, down.


## Before you build

- You need: Agents with access to your error tracker, logs and deploys.
- Ask once: If a rollback would undo a migration or lose data, use droplet_ask with risk high.

## Fill it with real data

Start from the template (`droplet_library` with `id: "incident"`), keep the design, and replace each sample value:

| Block | Real value |
|---|---|
| 0 · metric | The number that shows how bad it is. |
| 1 · text | Where, since when, and whether rollback is safe. |
| 2 · buttons | Roll back, investigate or ignore. |
| 3 · list | What you found. |

Sources:
- Error rate and top error (Sentry, Datadog, your logs).
- The last deploys and which one lines up.
- Whether rollback is safe, such as no migration since.

## The widget

Sample values; send it with `droplet_set_widget` on your widget's slug (or a new slug with `new_widget: true` if the user asked for a separate widget). Preview it and fix every warning first.

```json
{
  "slug": "incident",
  "title": "Errors up 6x",
  "symbol": "exclamationmark.triangle.fill",
  "accent": "#FF453A",
  "blocks": [
    {"type": "metric", "label": "Errors a minute", "value": "84", "trend": "up"},
    {"type": "text", "text": "Checkout only, since the 14:02 deploy. Rollback is safe.", "style": "body"},
    {"type": "buttons", "items": [{"id": "rollback", "label": "Roll back", "symbol": "arrow.uturn.backward"}, {"id": "dig", "label": "Look into it", "symbol": "magnifyingglass"}, {"id": "ignore", "label": "Ignore", "symbol": "bell.slash.fill"}]},
    {"type": "list", "title": "What I found", "items": [{"title": "TypeError in cart total", "detail": "1,204 times"}, {"title": "Deploy a41c9 at 14:02", "detail": "likely cause"}]}
  ],
  "sizes": {"medium": [0, 1, 2], "large": [0, 1, 2, 3]},
  "lock": {"inline": "Errors up 6x on checkout", "circular": 0}
}
```

## Keep it fresh

As soon as the alert fires, then on every real change. Show 'Back to normal' when it clears.

## Handle the taps

Each tap reaches you once on `droplet_get_events` (keep a waker running, SKILL.md Process C). Answer within seconds by updating the widget.

**Roll back** (`rollback`)

```json
{"widget": "incident", "kind": "button", "target": "rollback", "value": {"label": "Roll back"}}
```

Roll back to the version named, watch the error rate, then show the result with the numbers.

**Look into it** (`dig`)

```json
{"widget": "incident", "kind": "button", "target": "dig", "value": {"label": "Look into it"}}
```

Investigate, show progress, then come back with a fix or a clearer choice.

**Ignore** (`ignore`)

```json
{"widget": "incident", "kind": "button", "target": "ignore", "value": {"label": "Ignore"}}
```

Don't act, and don't alert again for this error today.

## Ask first

If a rollback would undo a migration or lose data, use droplet_ask with risk high.

For example:

```json
{"question": "Roll back past migration 042? New signups since 14:02 would be lost.", "kind": "decision", "options": ["Roll back", "Don't"], "risk": "high"}
```

## Phone actions

Send a notification: this one is worth interrupting for.

```json
{"kind": "notify", "params": {"title": "Errors up 6x on checkout", "body": "Started with the 14:02 deploy"}}
```

Send it with `droplet_phone_action` and tell the user what you set.

## Edge cases

- It clears by itself: show 'Back to normal' and what happened.
- You don't know the cause yet: say that, and take Roll back off the widget.

## Never

Never alert on noise. If this fires often, the user stops trusting it.

## Done when

- [ ] Every sample value is replaced with real data (no "Dr. Lee" on a real widget).
- [ ] `droplet_preview_widget` shows no warnings at the sizes the user placed (`placed` in `droplet_whoami`).
- [ ] Every button has a handler and a waker is running.
- [ ] Refresh is set up as above.
- [ ] You told the user in one line what it does on its own and what it asks first.

## Same widget, other uses

- [Meeting prep](meeting-prep.md): Before every meeting: who, why, and your notes ready.
- [Calendar clash](schedule-clash.md): Two things landed at the same time. Your agent found the fix; you tap it.
- [Worth your time](news-brief.md): One story that matters to your work, why it matters, and what to do about it.
- [Smart buttons](smart-buttons.md): The buttons you need right now. Your agent changes them by time, place and what's next.
- [Meeting controls](meeting-controls.md): Only around a meeting: join it, say you're late, then send the recap when it ends.
- [Home controls](home-scenes.md): At home, the controls for this moment: leaving, evening or bedtime.
- [Release room](release-room.md): A small app for one job: everything about a release, with the controls, built by your agent.
- [Needs a reply](inbox-zero.md): Your agent drafts the replies. You tap send.
- [Follow up](follow-up.md): Someone never replied. Your agent noticed and wrote the nudge.
- [Ship status](ship-status.md): Builds, failing tests and the fix, all one tap from your agent.
- [PR review](pr-review.md): Your agent read the pull request. You get the verdict and merge with a tap.
