huskies: merge 913

This commit is contained in:
dave
2026-05-12 15:25:12 +00:00
parent 90b31fc84f
commit a34c9796b5
5 changed files with 140 additions and 28 deletions
+20 -11
View File
@@ -179,19 +179,28 @@ pub(super) fn tool_report_merge_failure(args: &Value, ctx: &AppContext) -> Resul
slog!("[mergemaster] Merge failure reported for '{story_id}': {reason}");
ctx.services.agents.set_merge_failure_reported(story_id);
// Broadcast the failure so the Matrix notification listener can post an
// error message to configured rooms without coupling this tool to the bot.
let _ = ctx
.watcher_tx
.send(crate::io::watcher::WatcherEvent::MergeFailure {
story_id: story_id.to_string(),
reason: reason.to_string(),
});
// Route the failure through the typed state machine (Merge → MergeFailure).
// This persists the reason in front matter and updates the CRDT stage.
if let Err(e) = crate::agents::lifecycle::transition_to_merge_failure(story_id, reason) {
slog_warn!("[mergemaster] Failed to transition '{story_id}' to MergeFailure: {e}");
// Only broadcast the notification when the stage actually changed; if the
// story was already in MergeFailure (self-loop), suppress the duplicate.
let should_notify =
match crate::agents::lifecycle::transition_to_merge_failure(story_id, reason) {
Ok(fired) => !matches!(
fired.before,
crate::pipeline_state::Stage::MergeFailure { .. }
),
Err(e) => {
slog_warn!("[mergemaster] Failed to transition '{story_id}' to MergeFailure: {e}");
true
}
};
if should_notify {
let _ = ctx
.watcher_tx
.send(crate::io::watcher::WatcherEvent::MergeFailure {
story_id: story_id.to_string(),
reason: reason.to_string(),
});
}
Ok(format!(