huskies: merge 913
This commit is contained in:
@@ -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,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user