From be0036922a505e4ed3b5c05603d0d9816c40198e Mon Sep 17 00:00:00 2001 From: dave Date: Sat, 28 Mar 2026 15:33:01 +0000 Subject: [PATCH] fix: unblock command also clears merge_failure field Previously unblock only checked for blocked=true. Stories stuck in merge with a merge_failure field were not considered "blocked" and unblock refused to act. Now it clears both blocked and merge_failure, and reports which fields were cleared. Co-Authored-By: Claude Opus 4.6 (1M context) --- server/src/chat/commands/unblock.rs | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/server/src/chat/commands/unblock.rs b/server/src/chat/commands/unblock.rs index e3aa338f..40fd3054 100644 --- a/server/src/chat/commands/unblock.rs +++ b/server/src/chat/commands/unblock.rs @@ -98,15 +98,27 @@ pub(crate) fn unblock_by_path(path: &Path, story_id: &str) -> String { let story_name = meta.name.as_deref().unwrap_or(story_id).to_string(); - if meta.blocked != Some(true) { + let has_blocked = meta.blocked == Some(true); + let has_merge_failure = meta.merge_failure.is_some(); + + if !has_blocked && !has_merge_failure { return format!( "**{story_name}** ({story_id}) is not blocked. Nothing to unblock." ); } - // Clear the blocked flag (reads + writes the file). - if let Err(e) = clear_front_matter_field(path, "blocked") { - return format!("Failed to clear blocked flag on **{story_id}**: {e}"); + // Clear the blocked flag if present. + if has_blocked { + if let Err(e) = clear_front_matter_field(path, "blocked") { + return format!("Failed to clear blocked flag on **{story_id}**: {e}"); + } + } + + // Clear merge_failure if present. + if has_merge_failure { + if let Err(e) = clear_front_matter_field(path, "merge_failure") { + return format!("Failed to clear merge_failure on **{story_id}**: {e}"); + } } // Reset retry_count to 0 (re-read the updated file, modify, write). @@ -119,7 +131,10 @@ pub(crate) fn unblock_by_path(path: &Path, story_id: &str) -> String { return format!("Failed to reset retry_count on **{story_id}**: {e}"); } - format!("Unblocked **{story_name}** ({story_id}). Retry count reset to 0.") + let mut cleared = Vec::new(); + if has_blocked { cleared.push("blocked"); } + if has_merge_failure { cleared.push("merge_failure"); } + format!("Unblocked **{story_name}** ({story_id}). Cleared: {}. Retry count reset to 0.", cleared.join(", ")) } // ---------------------------------------------------------------------------