fix(matrix): implement thread_require_mention to prevent multi-agent reply loops (#27996)#28580
Merged
Conversation
…reply loops In multi-agent shared Matrix rooms, multiple bots all participating in the same thread could trigger infinite reply loops — each bot's reply re-engaged the others because they were all in the bot-thread set. Discord has a `thread_require_mention` opt-in for this; Matrix didn't. Add `_parse_thread_require_mention(config)` (mirrors Discord's pattern). In `_resolve_message_context`, when enabled and the message is in a bot-participated thread (not a free-response room), require @mention before processing. Salvage of @justemu's 2-commit stack (#27996). Fixes #27995.
Contributor
🔎 Lint report:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Salvage of #27996 by @justemu (squashed 2-commit stack).
What: Prevents reply loops in multi-agent shared Matrix rooms by adding an opt-in
thread_require_mentionfilter — when enabled, bots only respond to @mentioned messages even inside threads they've previously participated in.How: Mirrors Discord's adapter pattern. New
_parse_thread_require_mentionparser (YAML bool, string truthy, orMATRIX_THREAD_REQUIRE_MENTIONenv). In_resolve_message_context, the gate fires for bot-participated threads outside free-response rooms.Original PR: #27996
Fixes #27995.