huskies: merge 982

This commit is contained in:
dave
2026-05-13 15:30:03 +00:00
parent e6d051d016
commit 91fbad568a
15 changed files with 357 additions and 117 deletions
+17 -13
View File
@@ -177,27 +177,31 @@ 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);
// The mergemaster provides a freeform reason string; use Other so the
// auto-assigner does not re-spawn another mergemaster after this one fails.
let kind = crate::pipeline_state::MergeFailureKind::Other(reason.to_string());
let display = kind.display_reason();
// Route the failure through the typed state machine (Merge → MergeFailure).
// This persists the reason in front matter and updates the CRDT stage.
// 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
}
};
let should_notify = match crate::agents::lifecycle::transition_to_merge_failure(story_id, kind)
{
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(),
reason: display,
});
}