---
description: Diagnose unexpected behavior, not just failures (race conditions, perf regressions, weird output)
argument-hint: "[symptom or observed behavior]"
subagent: true
fork: true
---
Diagnose the following unexpected behavior: $@

Structure your answer as:
1. **What's wrong** — restate the observed behavior vs the expected behavior in one sentence each
2. **Where in the code** — point at the specific functions, lines, or modules most likely responsible
3. **Hypotheses** — 2–4 ranked explanations with the evidence for and against each
4. **Disambiguation** — the cheapest experiment (log, flag, breakpoint, minimal repro) that would confirm or rule out each hypothesis
5. **Likely fix** — once a hypothesis is confirmed, the smallest change that would correct it
6. **Why it wasn't caught** — what test, type, or invariant would have caught this earlier

Use this when nothing is "failing" but behavior is wrong: a value drifts, a UI flashes, a query is slow, two users see different results. Distinguish carefully between "the test fails" (use `p-debug`) and "the test passes but production is broken" (this prompt).
