Handle plain Matrix replies to the bot - #62
Closed
strk-ai-agent wants to merge 1 commit into
Closed
Conversation
|
I've tested this to work fine (in #lounge:osgeo.org). |
When matrix.threadIsolation is off, plain m.in_reply_to replies in a room with an existing session now count as implicit follow-ups — but only when the reply target is a message the bot itself sent (tracked via a new botSentEventIds set on RoomSession). Third-party replies in busy rooms are ignored, and m.thread behaviour with isolation on is unchanged. Add extractReplyTargetId helper that surfaces m.thread roots unconditionally and falls back to m.in_reply_to only when isolation is off, with m.thread taking precedence when both are present. Assisted-By: minimax/MiniMax-M3 [via opencode 1.18.7]
Owner
|
Closing under the updated contribution policy. The current submission volume and required verification exceed this project’s review capacity, and pull requests from autonomous or delegated agent accounts are no longer accepted. Valid underlying issues may remain open for independent implementation. Please do not revise, reopen, or replace this pull request. |
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.
Summary
The Matrix connector now picks up plain
m.in_reply_toreplies as implicit follow-ups — but only when the reply targets a message the bot itself sent. Previously, replies in a room with an active session were ignored unless they usedm.threadrelations (which only work withthreadIsolation: true), contained the trigger, or mentioned the bot.Changes
extractReplyTargetId(event, threadIsolation)helper inconnectors/matrix-thread-helpers.ts:m.threadevent_id wins regardless of isolationm.in_reply_toevent_id only when isolation is offm.in_reply_tofor older clientsconnectors/matrix.ts:RoomSessiongainsbotSentEventIds: Set<string>to track messages the bot has sentrecordBotEventId()helper called by every send path:sendReply(both isolation branches),sendNoticeReply,createToolActivityMessage,sendImageFromBase64,sendImageFromFilehandleRoomMessage: with isolation off, the implicit-follow-up branch now requiressession.botSentEventIds.has(threadRootEventId)— third-party replies are droppedtests/unit/matrix-thread-context.test.ts: 7 new cases forextractReplyTargetIdtests/integration/matrix-event-mapping.test.ts: end-to-end contract for plain repliestests/unit/matrix-empty-response.test.ts: factory updated for new session fieldBehaviour matrix
threadIsolation: true+m.threadreply from anyone in the thread → continues the thread session (unchanged)threadIsolation: true+ plainm.in_reply_toreply → ignored (unchanged)threadIsolation: false+m.threadreply → continues the room session (new)threadIsolation: false+m.in_reply_toreply to a bot message → continues the room session (new)threadIsolation: false+m.in_reply_toreply to someone else → ignored (new)Testing
bun run typecheck,bun test, andbun run check:connectorsall pass (358 tests).