matrix-org / matrix-appservice-irc

Node.js IRC bridge for Matrix
Apache License 2.0
462 stars 151 forks source link

allowUnconnectedMatrixUsers does not prevent idle kicks on matrix.org #1589

Open progval opened 2 years ago

progval commented 2 years ago

Describe the bug A Matrix user was just kicked from a plumbed room I am in, despite allowUnconnectedMatrixUsers being true

To Reproduce Unclear, but here is the state event:

{
  "content": {
    "allowUnconnectedMatrixUsers": true
  },
  "origin_server_ts": 1659628246327,
  "sender": "@olasd:matrix.org",
  "state_key": "",
  "type": "org.matrix.appservice-irc.config",
  "unsigned": {},
  "event_id": "$44xiTG4wYseFyu14p1Dsmal6oWsNFXAUu_VtQM1-rbY",
  "room_id": "!lAZsOCrTyhrhnitJGE:matrix.org"
}

and the kick event:

{
  "content": {
    "membership": "leave",
    "reason": "You have been kicked for being idle",
    "avatar_url": "<redacted>",
    "displayname": "<redacted>"
  },
  "origin_server_ts": 1659690040855,
  "sender": "@appservice:libera.chat",
  "state_key": "<redacted>",
  "type": "m.room.member",
  "unsigned": {
    "replaces_state": "$n_D7q3gz4uRM74CDBpZnvbK8MN6wbnIN4VYEOY1NnkE",
    "prev_content": {
      "avatar_url": "<redacted>",
      "displayname": "<redacted>",
      "membership": "join"
    },
    "prev_sender": "<redacted>"
  },
  "event_id": "$xTrY1m3fABf6FbIUMwXb5voFGMY7PmVaZI01MzO4Reo",
  "room_id": "!lAZsOCrTyhrhnitJGE:matrix.org"
}
progval commented 2 years ago

morguldir just pointed out this isn't actually a bug, and allowUnconnectedMatrixUsers isn't meant to prevent kicks, only disable the privacy filter.

But that seems weird, as the privacy filter is only meant as a last resort when kicks are not issued when they should. It also means there is no way to prevent the appservice from kicking Matrix users at all, besides dropping its PL (which sometimes requires tombstoning and recreating rooms)

jaller94 commented 2 years ago

I'm not really sure what to do with this ticket. The idle kick got configured globally on the matrix.org LiberaChat bridge because we've been given a limited amount of connections by the LiberaChat team. It's our decision to kick idle users, so that the connection slots may be used by others.

This decision comes from the following:

  1. LibraChat requires that an IRC user must be able to see every bridged user in the IRC room. This is to know who is participating in a chat at a given time.
  2. LiberaChat has given us permission to a certain 5 digit amount of connections. (not being secretive, I don't know the exact amount of the top of my head)
  3. At some point the amount of open TCP connections becomes unstable. We could work around this, if we had a lot more connections available.

The room setting allowUnconnectedMatrixUsers allows the bridge to continue bridging IRC -> Matrix, even while the bridge is connecting more Matrix users to an IRC channel. https://github.com/matrix-org/matrix-appservice-irc/blob/d871e997a09decd43e024c1954448d2b444c99a1/docs/room_configuration.md#allowunconnectedmatrixusers

progval commented 2 years ago
  1. LibraChat requires that an IRC user must be able to see every bridged user in the IRC room. This is to know who is participating in a chat at a given time.

Don't they allow channel owners to override this for their own channels?

  1. LiberaChat has given us permission to a certain 5 digit amount of connections. (not being secretive, I don't know the exact amount of the top of my head)

it's 20000

LuccoJ commented 1 year ago

@jaller94 the problem is that when users get kicked for being idle from IRC, they get kicked on the Matrix side too. I've had many complains about that being absurd for places that are largely Matrix room. But the good news is that the allowUnconnectedMatrixUsers has the logical meaning "okay, I know that normally Liberal doesn't want IRC-to-Matrix bridging unless all Matrix users are also connected as IRC users, but I want that overridden for this room, because I've informed the IRC side that the channel is publicly logged in real time as require by the IRC administration, so I'm opting out of the privacy behavior".

How does that affect the idle kicks? Well, right nke it doesn't, but the contention is that with that enabled, you could still kick users from the IRC side, to comply with your user limit, while keeping them connected on the Matrix side. Then, as soon as they happen to speak again, they can instantly rejoin IRC.

Note that in my experience, many times users on the Matrix side don't even realize that they have been kicked from a room for this reason, and the ensuing debate is more painful than having some Matrix users not show up on the IRC side.