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