---
name: "Rate-limited mergemaster exits advance stories to done without merging"
---

# Bug 445: Rate-limited mergemaster exits advance stories to done without merging

## Description

When the mergemaster agent is immediately rate-limited (zero turns, zero tool calls), it exits and run_server_owned_completion runs acceptance gates on the existing worktree. Since the coder already committed working code, the gates pass, and the pipeline advances the story to done — even though the mergemaster never executed run_squash_merge and the code was never cherry-picked onto master.

## How to Reproduce

Observed on stories 439 and 442. All mergemaster log entries show: init → rate_limit_event → error result. Zero turns, zero MCP tool calls, duration under 350ms. Yet both stories ended up in done with no merge commit on master.

## Actual Result

Stories advance to done with no code on master. The mergemaster never ran but the pipeline treated its exit as a successful completion.

## Expected Result

If the mergemaster exits without completing its work (no merge commit produced), the story should stay in the merge stage for retry, not advance to done.

## Acceptance Criteria

- [ ] run_server_owned_completion must not run for mergemaster agents — mergemaster has its own completion path via start_merge_agent_work
- [ ] If the mergemaster process exits without producing a SquashMergeResult, the story stays in merge stage
- [ ] Rate-limited mergemaster exits are treated as transient failures, not gate-passing completions
- [ ] Story remains eligible for retry when mergemaster fails due to rate limiting
