story-kit: merge 262_story_bot_error_notifications_for_story_failures

This commit is contained in:
Dave
2026-03-17 15:26:15 +00:00
parent bf5d9ff6b1
commit 96779c9caf
4 changed files with 98 additions and 0 deletions

View File

@@ -1788,6 +1788,13 @@ fn tool_report_merge_failure(args: &Value, ctx: &AppContext) -> Result<String, S
slog!("[mergemaster] Merge failure reported for '{story_id}': {reason}");
ctx.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(),
});
// Persist the failure reason to the story file's front matter so it
// survives server restarts and is visible in the web UI.
if let Ok(project_root) = ctx.state.get_project_root() {

View File

@@ -150,6 +150,9 @@ impl From<WatcherEvent> for Option<WsResponse> {
}),
WatcherEvent::ConfigChanged => Some(WsResponse::AgentConfigChanged),
WatcherEvent::AgentStateChanged => Some(WsResponse::AgentStateChanged),
// MergeFailure is handled by the Matrix notification listener only;
// no WebSocket message is needed for the frontend.
WatcherEvent::MergeFailure { .. } => None,
}
}
}