huskies: merge 1178 bug MergeFailureFinal is a trap state: successful re-merge cannot mark the story done
This commit is contained in:
@@ -361,15 +361,23 @@ impl AgentPool {
|
||||
}
|
||||
|
||||
let story_archived = crate::agents::lifecycle::move_story_to_done(story_id).is_ok();
|
||||
if story_archived {
|
||||
self.remove_agents_for_story(story_id).await;
|
||||
}
|
||||
|
||||
let worktree_cleaned_up = if wt_path.exists() {
|
||||
let config = crate::config::ProjectConfig::load(project_root).unwrap_or_default();
|
||||
worktree::remove_worktree_by_story_id(project_root, story_id, &config)
|
||||
.await
|
||||
.is_ok()
|
||||
// Story 1178: only delete the feature branch once the state transition
|
||||
// to Done is confirmed. Deleting it unconditionally here meant a
|
||||
// successful squash merge whose CRDT transition failed (e.g. the story
|
||||
// was in a stage `move_story_to_done` didn't yet handle) would still
|
||||
// lose its feature branch, making the failure unrecoverable — the
|
||||
// story couldn't be retried because the branch it needed was gone.
|
||||
let worktree_cleaned_up = if story_archived {
|
||||
self.remove_agents_for_story(story_id).await;
|
||||
if wt_path.exists() {
|
||||
let config = crate::config::ProjectConfig::load(project_root).unwrap_or_default();
|
||||
worktree::remove_worktree_by_story_id(project_root, story_id, &config)
|
||||
.await
|
||||
.is_ok()
|
||||
} else {
|
||||
false
|
||||
}
|
||||
} else {
|
||||
false
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user