From fc53251285d23bd8d7614817de6ce7254f300b57 Mon Sep 17 00:00:00 2001 From: William Turner Date: Sun, 23 Aug 2026 15:06:57 +0000 Subject: [PATCH] Replace AutojoinRoomsMixin with a lightweight invite handler Same root cause as the earlier whoami fix: the mixin's initial /joined_rooms scan 404s against Continuwuity even though the endpoint works fine when called directly. Only auto-join-on-invite was actually needed, so a plain room.invite listener replaces the whole mixin. --- agent/src/matrixBot.js | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/agent/src/matrixBot.js b/agent/src/matrixBot.js index 980bc8c..d474443 100644 --- a/agent/src/matrixBot.js +++ b/agent/src/matrixBot.js @@ -1,4 +1,4 @@ -import { MatrixClient, SimpleFsStorageProvider, AutojoinRoomsMixin } from "matrix-bot-sdk"; +import { MatrixClient, SimpleFsStorageProvider } from "matrix-bot-sdk"; import { runChatTask } from "./runner.js"; import { askOpenRouter, DEFAULT_MODEL } from "./openrouter.js"; @@ -45,7 +45,19 @@ export async function startMatrixBot() { const storage = new SimpleFsStorageProvider("/workspace/matrix-bot-storage.json"); const client = new MatrixClient(HOMESERVER_URL, ACCESS_TOKEN, storage); - AutojoinRoomsMixin.setupOnClient(client); + + // Not using AutojoinRoomsMixin: it calls /joined_rooms at startup to build its initial + // state, which — like the /whoami call removed earlier — 404s against Continuwuity for + // reasons unrelated to the endpoint itself (curling it directly works fine). This + // simpler handler does the one thing we actually need — auto-join on invite — without + // that startup scan. + client.on("room.invite", async (roomId) => { + try { + await client.joinRoom(roomId); + } catch (err) { + console.error("failed to join invited room", roomId, err.message); + } + }); client.on("room.message", async (roomId, event) => { // Invite-only control room enforces who can reach the bot at all; this just scopes