From 8884f99c9293fa5e3273bdab0a0bd7c2c5d4123c Mon Sep 17 00:00:00 2001 From: efe-arv Date: Mon, 2 Mar 2026 01:35:39 +0300 Subject: [PATCH] =?UTF-8?q?fix:=20address=20review=20feedback=20=E2=80=94?= =?UTF-8?q?=20handle=20start=20failure,=20remove=20placeholder=20URL?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Don't mark client as started if client.start() errors during init - Remove placeholder issue URL from comment --- extensions/matrix/src/matrix/client/shared.ts | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/extensions/matrix/src/matrix/client/shared.ts b/extensions/matrix/src/matrix/client/shared.ts index 45e07ad4ed9..2f711889296 100644 --- a/extensions/matrix/src/matrix/client/shared.ts +++ b/extensions/matrix/src/matrix/client/shared.ts @@ -85,15 +85,18 @@ async function ensureSharedClientStarted(params: { } // bot-sdk start() returns a promise that never resolves (infinite sync loop). - // Fire-and-forget: the sync loop runs, events fire on the client, - // but we must not await or the entire provider startup hangs. - // See: https://github.com/openclaw/openclaw/issues/NEW + // Fire-and-forget: the sync loop runs and events fire on the client, + // but we must not await or the entire provider startup hangs forever. + let startFailed = false; client.start().catch((err: unknown) => { + startFailed = true; LogService.error("MatrixClientLite", "client.start() error:", err); }); - // Give the sync loop a moment to initialize + // Give the sync loop a moment to initialize before marking ready await new Promise(resolve => setTimeout(resolve, 2000)); - params.state.started = true; + if (!startFailed) { + params.state.started = true; + } })(); sharedClientStartPromises.set(key, startPromise); try {