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
+23 -12
View File
@@ -126,19 +126,30 @@ impl AgentPool {
});
} else {
// Transition through the state machine (Merge → MergeFailure).
if let Err(e) =
crate::agents::lifecycle::transition_to_merge_failure(&sid, &reason)
{
crate::slog_error!(
"[merge] Failed to transition '{sid}' to MergeFailure: {e}"
);
// Only send 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(
&sid, &reason,
) {
Ok(fired) => !matches!(
fired.before,
crate::pipeline_state::Stage::MergeFailure { .. }
),
Err(e) => {
crate::slog_error!(
"[merge] Failed to transition '{sid}' to MergeFailure: {e}"
);
true
}
};
if should_notify {
let _ =
pool.watcher_tx
.send(crate::io::watcher::WatcherEvent::MergeFailure {
story_id: sid.clone(),
reason,
});
}
let _ = pool
.watcher_tx
.send(crate::io::watcher::WatcherEvent::MergeFailure {
story_id: sid.clone(),
reason,
});
}
}