Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"Ghost rooms" returned by get_dm_rooms raising LocalProtocolError #13

Closed
fvjosef21 opened this issue Feb 10, 2024 · 3 comments · Fixed by #15
Closed

"Ghost rooms" returned by get_dm_rooms raising LocalProtocolError #13

fvjosef21 opened this issue Feb 10, 2024 · 3 comments · Fixed by #15
Assignees
Labels
bug Something isn't working enhancement New feature or request

Comments

@fvjosef21
Copy link
Contributor

Is your feature request related to a problem? Please describe.
get_dm_rooms returns a list of rooms. However, this list may be stale (since a user may have left the room, forget room, or ?).
This leads to the bug that trying to connect to the room will lead to a LocalProtocolError

Error: LocalProtocolError('No such room with id !NBwtLCgGNCdtVfASwf:[matrix.org](http://matrix.org/) found.')

At the moment, we picked the first room returned by get_dm_rooms in send_message. I suggested to use the last room, since it looked like the newest rooms were at the end of the list, but now I am not sure if that is actually true (it may depend on the specific matrix server).

Describe the solution you'd like
First of. I am a beginner in Matrix, so take the following with a grain of salt. I don't understand the difference between a DM room and a room that has two users with a visibility of "invite only".

MatrixRoom in matrix-nio has a dict for users and visibility. So I guess we can check if the correct two users are in that room and if the visbility and maybe history_visibility is set correctly. Then filter out the rooms that do not match these criteria.

Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.

No idea what else we can do.

Additional context
Changing the room to the last seems to work for me, but now I have a problem that every message from the bot creates a new room.

@fvjosef21 fvjosef21 added the enhancement New feature or request label Feb 10, 2024
@nexy7574 nexy7574 changed the title get_dm_rooms "Ghost rooms" returned by get_dm_rooms raising LocalProtocolError Feb 11, 2024
@nexy7574 nexy7574 self-assigned this Feb 11, 2024
@nexy7574
Copy link
Owner

Context that has been discussed in the matrix room:

  • get_dm_rooms was returning rooms that included rooms that no-longer existed, or were invalid for some other reason
  • By checking the returned room IDs against those in niobot.NioBot.rooms, it can be more accurately determined which rooms exist
  • send_message should first check against rooms to see if the room is valid, throwing an error preemptively if a room is invalid

@nexy7574 nexy7574 added the bug Something isn't working label Feb 11, 2024
@nexy7574
Copy link
Owner

watching matrix-org/matrix-js-sdk#2672, related

@nexy7574
Copy link
Owner

nexy7574 commented Mar 3, 2024

Issue directly relates to #15

@nexy7574 nexy7574 linked a pull request Mar 3, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants