Chapter 17. Production Failures and the Evaluation Data Flywheel
In a fictional Juniper support case, an agent mishandles a return request containing two similar order IDs. The team copies the trace straight into training data, only to notice two problems: the expected label follows an outdated policy, and the log contains an email address. The failure is real enough to investigate, but the copied trace is not yet a trustworthy test—or a safe training example.
A useful data flywheel turns a verified failure into a reviewed case, a clearer guideline or grader, and eventually a measurable improvement. That loop is not automatic: the team must establish what happened, which policy applied, and what evidence the case actually needs before deciding whether it belongs in evaluation, development, or optimization. These decisions protect both the people whose data appears in a trace and the credibility of the next release result.
After this chapter you will be able to:
- convert production failures into minimized, versioned test cases;
- use open and axial coding to organize qualitative failures;
- distinguish agent, tool, evaluator, label, dataset, and guideline causes;
- build review queues and route findings into operational fixes;
- maintain a useful failure taxonomy and prioritize fixes;
- connect verified evals to training and reward design without leaking holdouts.
17.1 From production failures to test cases
Chapter 14: Production Trace Evaluation describes how a production trace is collected and evaluated before a finding reaches this review process.
The first report says that Juniper chose the wrong order. That is a useful lead, but not yet a diagnosis. Compare the trace with the authoritative environment state, identify the policy version in force, and establish whether the wrong record was actually changed or only named in the response. A user-facing claim, a tool call, and a persisted state change are different pieces of evidence, and each may point the investigation in a different direction.
Before turning the interaction into a test, define its task, acceptable and prohibited behavior, and authoritative oracle. Then minimize or redact the record to what is needed to reproduce and judge the failure. Keep the incident link access-controlled, use synthetic or de-identified values in the fixture, and apply the relevant purpose, access, retention, and deletion rules to the source trace. If the test cannot be reproduced safely, it should remain an investigation record rather than silently becoming a dataset row.
Candidate cases move through triage, privacy screening, reproduction, labeling, adjudication, evaluator validation, and release. Each step should leave enough provenance to explain where the case came from, which policy and environment it represents, and what limitations remain. Datasheets offer a structure for recording that provenance alongside the case’s motivation and limitations [1].
The capstone feedback-loop lab demonstrates these transitions with synthetic approvals and cases, including rejection of unresolved findings and protection of an independent holdout. Its review labels are illustrative, not substitutes for actual human or privacy review.
17.2 Error analysis: open and axial coding
Once a case is safe to review, the next question is how to describe it without deciding the cause too early. Open coding assigns descriptive labels to individual failures while leaving room for new patterns; axial coding then groups related codes and examines their relationships. In Juniper’s case, “wrong entity” describes the visible result, which may connect to an ambiguous request, a missed clarification, a faulty order lookup, or an unsafe write.
Have two reviewers code an initial sample independently. Their disagreements can reveal where a definition is unclear or where the evidence supports more than one interpretation. Refine the codebook with positive examples and boundary cases, then check whether reviewers can apply the revised definitions consistently. One case may receive a symptom code, a contributing-factor code, and—only when evidence supports it—a confirmed root-cause code. Keeping those labels separate prevents the first plausible explanation from becoming the official account.
17.3 Root-cause analysis methods
Coding describes what reviewers see; root-cause analysis asks what conditions produced it and what change could prevent recurrence. The 5 Whys can expose contributing conditions, but the answers are prompts for investigation, not proof that a single causal chain exists. A fault tree takes another route, starting from an unwanted event and laying out combinations of conditions that could produce it. Slice analysis can show whether failures cluster by tool, language, policy version, or task type, although a cluster alone does not establish cause.
For Juniper, plausible explanations include an ambiguous user request, stale policy guidance, incorrect order data from the lookup tool, or a grader that treated the response text as proof of a successful state change. The investigation therefore needs to check the evaluation system as well as the agent: tool, grader, label, dataset, guideline, environment, and measurement pipeline failures can all distort the conclusion. Record which facts are observed, which explanations remain hypotheses, and what test or intervention would distinguish them. More than one condition may be necessary for the incident; do not force the evidence into a single-root story.
17.4 Building RCA tooling
The investigation tools should follow the questions reviewers ask. A useful drill-down starts at a metric shift, narrows to task slices, opens the relevant trace, compares expected with observed evidence, and records a disposition. By making policy, model, tool, grader, and dataset versions visible, it helps reviewers compare like with like without exposing unnecessary personal data.
The review queue also needs more than one sampling strategy. Random audits can support estimates about a defined population when inclusion probabilities and weighting are handled appropriately. Risk-based samples serve a different purpose: they find rare, consequential failures, while disagreement samples help diagnose reviewers or graders. Those targeted queues are valuable, but their raw failure rates do not estimate traffic prevalence.
After adjudication, route the finding to the artifact that can address it: a tool issue, agent fix, rubric clarification, grader test, dataset refresh, or policy decision. A useful ticket links to a minimized reproducer, the relevant version, impact, and an acceptance test, giving the owner a way to verify the fix. If a judge and a human reviewer disagree, do not tune the prompt to match either one until adjudication establishes which judgment is supported.
17.5 Building a failure taxonomy
The taxonomy should help a team find patterns without pretending that every incident has one neat label. Keep it small enough for reviewers to apply consistently, and distinguish the observable symptom (wrong order ID), process failure (skipped confirmation), contributing condition (ambiguous context), and root cause (not yet established). Because these are different dimensions, allow multiple labels and use “unknown” when evidence is incomplete rather than filling the gap with a guess.
Version definitions and keep examples with them. If “wrong entity” once covered both lookup errors and agent selection errors, splitting it may improve diagnosis—but the taxonomy change can also create a false trend break. Retire or merge categories only with a migration plan that preserves historical interpretation. As reviewers learn and adjudicate the categories, monitor agreement while recognizing that agreement does not by itself prove a label is correct [2].
17.6 Prioritizing fixes
The queue now contains better-described cases, but the team still has to decide what to fix first. Consider severity, exposure, recurrence, confidence in the diagnosis, and feasibility of a remedy. A rare catastrophic issue may deserve attention before a frequent cosmetic defect, while an uncertain diagnosis may justify investigation before implementation. Keep the dimensions visible so a convenient aggregate score does not conceal a hard safety concern.
Estimate exposure and impact with representative evidence. A queue deliberately enriched for severe cases can help teams find important failures, but it cannot estimate how often those failures occur in production without an appropriate sampling design and weighting. Confirmed critical issues may require immediate containment regardless of prevalence; that operational response is separate from estimating population rates.
For each fix, name the expected outcome or metric movement and add a regression test that checks the underlying requirement. In Juniper’s case, that means verifying the selected order and resulting state—not merely rewarding a response that sounds confident. Avoid changing a label or grader just to improve the score. If the requirement itself changes, version the policy and, where possible, report results under both the old and new definitions so readers can tell a system change from a measurement change.
17.7 Connecting evals to fine-tuning and RL
After a case has been verified, it may help improve the agent: the same return example might become a supervised demonstration, a preference comparison, a reward-model example, or part of a reinforcement-learning signal. Its role must nevertheless be explicit. Once a case is repeatedly exposed during optimization, it no longer provides an independent test of generalization. Keep training, development, and sealed test data separate, record dataset lineage, and retire or replace holdout cases that have leaked into tuning.
Optimization can also reward shortcuts. An agent trained to maximize a process score may learn to produce the appearance of a verified step without achieving the task outcome. Test process rewards for gaming and distribution shift, and check that each deterministic verifier measures a property tied to the user’s goal. Research on process supervision shows potential for step-level feedback in specific reasoning settings; it does not establish that the approach will improve every agent domain [3].
Chapter summary
- A production report becomes a test only after safe minimization, reproduction, and an authoritative oracle establish what happened.
- Open and axial coding help organize failures without confusing a visible symptom with a confirmed cause.
- Investigate the agent and the measurement system: tools, graders, labels, datasets, guidelines, environments, and pipelines can all shape the evidence.
- Use representative samples to estimate population behavior and targeted samples to find rare risks or diagnose disagreement.
- Route adjudicated findings to an owner, a testable fix, and a regression case tied to the intended outcome.
- Version taxonomies and data lineage so changes remain interpretable and holdouts stay independent.
For product managers. How does a user-impacting failure become a verified test? Who adjudicates policy ambiguity, and how do you know the fix addressed the cause? Ask whether improvements generalize beyond the examples used to tune the system.
Hands-on lab (Python)
Run python code\ch24\lab_flywheel.py. The fictional records are synthetic, and the helper ranks cases using severity, the supplied frequency value, and diagnosis confidence. This small example illustrates triage, not a universal priority formula or an estimate of production prevalence.
from bookkit.system_eval import prioritize_failures
cases = [
{"case_id": "wrong-id", "severity": 5, "frequency": 2, "confidence": 0.9},
{"case_id": "tone", "severity": 1, "frequency": 8, "confidence": 0.8},
]
print([row["case_id"] for row in prioritize_failures(cases)])['wrong-id', 'tone']
Exercises
- Coding. Create symptom and contributing-factor codes for an incorrect citation.
- Hands-on. Change the confidence values and discuss how review priority changes.
- RCA. Build a fault tree for an unauthorized state change.
- Sampling. Explain why a risk-only queue cannot estimate a production error rate.
- Discussion. How will you prevent a failure case used in fine-tuning from being reported as a blind test?
Further reading
- Gebru et al., Datasheets for Datasets, for data documentation and provenance [1].
- Artstein and Poesio, for annotation agreement and disagreement [2].
- Ratner et al., Snorkel, for weak supervision and training-data creation [4].
- Lightman et al., Let’s Verify Step by Step, for step-level process supervision [3].