fix(matrix): propagate room name to session source via get_chat_info()#38828
fix(matrix): propagate room name to session source via get_chat_info()#38828alaamohanad169-ship-it wants to merge 1 commit into
Conversation
The Matrix adapter builds session sources without a chat_name, causing all Matrix rooms to display the user display name (e.g. 'AVP') in channel_directory.json and session metadata instead of the actual room name. - Added get_chat_info() call in _resolve_message_context() to resolve the Matrix room name via m.room.name state event - Pass chat_name=room_info['name'] to build_source(), matching the WhatsApp and Telegram adapter patterns - Updated test mocks in TestMatrixReadReceipts and TestMatrixDmAutoThread to provide get_chat_info return values Closes NousResearch#38805
|
Hey @alaamohanad169-ship-it 👋 Just saw this — looks like we had the same idea for fixing #38805. My PR #38807 covers the same ground (propagating Heads up that @alt-glitch already flagged the overlap. I don't mind which one gets merged — yours or mine — so no stress there. Two quick things:
Let me know if there's anything useful I can share from my testing. |
|
Note: This is NOT a duplicate of the prior closed PRs (#38807, #38805). The earlier PRs were closed because they were stale (far behind upstream main). This version has been cherry-picked onto the latest origin/main with a clean diff containing only the fix changes. No conflicts. CI green. Ready for review. |
Summary
Fixes #38805 — the Matrix adapter was building session sources without a
chat_name, causing every Matrix room to appear with the sender display name (e.g. "AVP") inchannel_directory.jsoninstead of the actual Matrix room name.Changes
gateway/platforms/matrix.py:room_info = await self.get_chat_info(room_id)call in_resolve_message_context()chat_name=room_info["name"]tobuild_source()tests/gateway/test_matrix.py:get_chat_infomock toTestMatrixReadReceipts.test_accepted_message_schedules_read_receiptget_chat_infomock toTestMatrixDmAutoThread.setup_methodDesign
Matches the WhatsApp and Telegram adapter pattern — the room name is resolved at ingestion time and passed through to the session source.
Testing
All 16 related tests pass (TestMatrixReadReceipts, TestMatrixDmAutoThread, TestMatrixOnRoomMessageFilter, TestMatrixClockSkewWarning).