# What Occurs When a Story Fails Quality Checks in Ralph

> Discover what happens when a story fails quality checks in Ralph. Learn how Ralph discards changes, preserves status, and retries failed stories until success or max iterations.

- Repository: [Ryan Carson/ralph](https://github.com/snarktank/ralph)
- Tags: how-to-guide
- Published: 2026-04-13

---

**When quality checks fail in Ralph, the AI discards all changes without committing, preserves the story's `passes: false` status in [`prd.json`](https://github.com/snarktank/ralph/blob/main/prd.json), and automatically retries the same story in the next iteration until either the checks succeed or the `MAX_ITERATIONS` limit is reached.**

Ralph is an autonomous coding tool from the snarktank/ralph repository that processes user stories through a strict validation workflow. Understanding its failure handling mechanism is essential for debugging stuck iterations and managing development pipelines. The system implements a "run-quality-checks-then-commit" protocol