---
name: "Server-enforced retry limits for failed merge and empty-diff stories"
---

# Story 311: Server-enforced retry limits for failed merge and empty-diff stories

## User Story

As a project owner, I want the server to enforce retry limits on stories that fail merge or produce empty diffs, so that agents don't loop infinitely on broken stories and waste tokens.

## Acceptance Criteria

- [ ] auto_assign_available_work checks the merge_failure front matter flag and skips stories in 4_merge that already have a reported failure
- [ ] Server tracks retry count per story per stage in front matter (e.g. retry_count: 2)
- [ ] After N retries (configurable in project.toml, default 2), story is flagged as blocked and auto-assign stops trying
- [ ] Blocked stories show a clear indicator in pipeline status (MCP and bot status command)
- [ ] Server detects 'coder finished with no commits on feature branch' at gate-check stage and fails the gates early instead of advancing to QA
- [ ] Empty-diff merge failures are detected and reported without needing the mergemaster agent to discover them

## Out of Scope

- TBD
