fix: concluded discussions suppress turns and send single auto-reply

Two bugs in concluded discussion channel handling:

1. before_model_resolve did not check rec.discussion.concluded, so it
   still initialized the speaker list and ran turn management. Fixed by
   returning NO_REPLY early for concluded discussions (same as report mode).

2. message_received fired for all agent VM contexts, causing multiple
   "This discussion is closed" auto-replies per incoming message. Fixed
   with process-level dedup keyed on channelId:messageId (same pattern
   as agent_end runId dedup). Also fixed message_id extraction to look
   in metadata.conversation_info.message_id first.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
h z
2026-04-09 09:02:10 +01:00
parent 27c968fa69
commit 9e61af4a16
2 changed files with 40 additions and 6 deletions

View File

@@ -60,6 +60,12 @@ export function registerBeforeModelResolveHook(deps: Deps): void {
// dead mode: suppress all responses
if (mode === "report" || mode === "dead" as string) return NO_REPLY;
// concluded discussion: suppress all agent responses (auto-reply handled by message_received)
if (mode === "discussion") {
const rec = channelStore.getRecord(channelId);
if (rec.discussion?.concluded) return NO_REPLY;
}
// disabled modes: let agents respond freely
if (mode === "none" || mode === "work") return;