Skip to content

root-cause-analyzer

Recipe card from the charly-internals plugin (Development — contributor internals).

The root-cause-analyzer is an enforcer agent at marketplace/internals/agents/root-cause-analyzer.md. It is the mandatory first response to any failure, error, warning, or anomaly (R1).

MUST be invoked when ANY of the following occurs:

  • A build, test, or deploy command fails unexpectedly
  • A warning or error message appears in output
  • A check step fails or times out
  • A validator reports an anomaly
  • A validation failure on your own PR: a charly/pr-validator BLOCK or INCONCLUSIVE, a red CI check, or an auto-close. Each is an anomaly in YOUR process, not just in the code. The RCA runs BEFORE the fix, its step 5 names the missed control (why your own pre-push gate did not catch it), and the root fix goes into that control as well as into the code. Post the RCA summary in the round’s PR comment (the project rulebook “Before every update push: read everything, fix everything”).
  • Documentation, a skill, or a comment diverges from observed reality
  • Any unexpected behavior that cannot be immediately explained

The agent runs ONE 8-step process, defined once in its spec (marketplace/internals/agents/root-cause-analyzer.md, authored at the umbrella’s .agents/agents/root-cause-analyzer.md). In short: stop → expected vs actual, with evidence → enumerate the failure signatures and investigate → the mechanism (a hypothesis, tested) → the missed control → the blast radius → root cause and root fix: every candidate solution spiked (R12), the working one implemented and verified → classify and record. A working candidate is what proves the RCA; a round in which none works means the cause is wrong, and the analysis returns to the signatures.

The last step decides the path (the project rulebook R1, fix it or file it; /charly-internals:strict-policy “R1, applied”):

  • Blocking (this change introduces it, this change’s gate is red or warns because of it, or this change’s claim is false without the fix; unsure → blocking): fixed in this change. If it needs its own issue — for example, a producer-first fix in another repo — that issue is filed with --blocking, so it is CLAIMED by you at filing, and you fix it.
  • Non-blocking, genuinely separable: FILED with --non-blocking and left unclaimed for a later session, then listed under the PR body’s ## Filed issues.

An issue is the RCA’s OUTPUT, never a substitute for it. It is filed only once the process has run to its end: its body states verified facts (commands with output, file:line, measurements) and the conclusion — mechanism, missed control, blast radius, root fix, and the R12 spike round’s result (or none, with the reason). node scripts/gh/cli.ts issue refuses to file without those fields. An untested hypothesis means the RCA is unfinished, so nothing is filed yet.

Failure-signature enumeration and measurement discipline

Section titled “Failure-signature enumeration and measurement discipline”

A full RCA is not one named cause. A visible symptom is usually a CONJUNCTION of independent issues, so naming a single cause and moving on is repeatedly wrong while the others stay live — the field failure this section exists to prevent (a single cause named three times in a row, each time wrong, and once declared fixed from a measurement taken inside a downtime window). Three rules bind every RCA:

  • Enumerate EVERY distinct failure signature FIRST, before naming any cause. One symptom (“the server restarts”) usually has MULTIPLE independent signatures. Bucket them from the raw log before you theorize:

    grep -o 'cause="[^"]*"' <log> | sort | uniq -c | sort -rn

    Adapt the key to the log’s shape — whatever field names the failure reason. A histogram with more than one signature means more than one issue; never explain them away as a single cause.

  • Never verify a fix from a single sample. Measure against a stable baseline over a window in which the system is PROVABLY UP — readiness confirmed by a separate probe, never by the mere absence of errors. A zero reading during downtime is NOT evidence: it is the expected output of a system that could not attempt the operation at all.

  • Distinguish “the symptom stopped because it was fixed” from “it stopped because the system was down.” Both read as “zero failures”; only the first is a fix. State the measurement window and how you proved the system was up during it.

Enumerate per-issue, fix each, and re-measure EACH independently. A fix validated only against the conjunction’s aggregate reading is unproven.

Worked example — three independent issues under one “server restarts” symptom. A restart-loop symptom had three independent causes: a snapshot loop exhausting a resource, a blocking plugin stalling a request thread, and a stale worktree serving an old binary. Naming one cause and shipping its fix — three times in a row — each time left the loop running, because the other two were still live; one “fix confirmed” came from a 0 failures / 90s reading taken while the server was down, so no attempt could have occurred. Enumerating the failure signatures FIRST surfaced all three at once; each was fixed and re-measured independently against a stable baseline window, and only then did the symptom clear.

Invoke when you need to understand the root-cause-analyzer agent’s purpose, when it must be invoked, or what its 8-step process covers. The agent itself is at marketplace/internals/agents/root-cause-analyzer.md.