diff --git a/server/src/agents/pool/pipeline/merge/runner.rs b/server/src/agents/pool/pipeline/merge/runner.rs index 616067d5..f04026a2 100644 --- a/server/src/agents/pool/pipeline/merge/runner.rs +++ b/server/src/agents/pool/pipeline/merge/runner.rs @@ -138,6 +138,19 @@ impl AgentPool { return; } + // Story 1060: if the story was deleted while the merge was running, + // discard the result silently — no MergeFailure notification, no + // state-machine transition. Writing failure for a tombstoned story + // would emit a spurious "merge failed" notification to chat. + if crate::crdt_state::is_tombstoned(&sid) { + slog!( + "[merge] Merge for '{}' completed but story is tombstoned; skipping result write", + sid + ); + crate::crdt_state::delete_merge_job(&sid); + return; + } + let success = matches!( &report, Ok(r) if matches!(r.result, crate::agents::merge::MergeResult::Success { .. })