diff --git a/.story_kit/work/1_upcoming/258_bug_auto_assign_not_called_after_merge_failure.md b/.story_kit/work/1_upcoming/258_bug_auto_assign_not_called_after_merge_failure.md new file mode 100644 index 0000000..69f4bcc --- /dev/null +++ b/.story_kit/work/1_upcoming/258_bug_auto_assign_not_called_after_merge_failure.md @@ -0,0 +1,26 @@ +--- +name: "Auto-assign not called after merge failure" +--- + +# Bug 258: Auto-assign not called after merge failure + +## Description + +When the background merge pipeline fails (e.g. quality gate timeout), `auto_assign_available_work` is never called. The story stays in `4_merge/` with no agent assigned, requiring manual intervention. + +### Root cause + +In `pool.rs`, `start_merge_agent_work` spawns a tokio task that calls `run_merge_pipeline`. On failure, the task updates the job status to `Failed` but does NOT call `auto_assign_available_work`. The only call to `auto_assign` in the merge pipeline is inside `run_merge_pipeline` on the success path (line ~1251). + +The `spawn_pipeline_advance` completion handler does call `auto_assign` after the mergemaster agent exits, but only on the success path (post-merge tests pass → move to done → auto_assign). On failure, it returns early without triggering auto-assign. + +There is no periodic sweep — auto-assign is purely reactive (watcher events, agent completions, startup). + +### Impact + +After a merge failure, the story is permanently stuck in `4_merge/` with no agent. The only way to unstick it is to restart the server or manually trigger a watcher event. + +## Acceptance Criteria + +- [ ] After a merge pipeline failure, `auto_assign_available_work` is called so the mergemaster can retry +- [ ] Stories in `4_merge/` do not get permanently stuck after transient merge failures