-
-
Notifications
You must be signed in to change notification settings - Fork 69.5k
[Bug]: MSTeams adapter: startMonitor() returns immediately causing EADDRINUSE restart loop #24522
Description
Summary
The MSTeams adapter's startMonitor() function in extensions/msteams/src/monitor.ts returns { app, shutdown } immediately after expressApp.listen() binds to the port. The gateway runtime interprets this resolved promise as "channel exited" and triggers the auto-restart mechanism. The restart attempts to bind a new Express server to the same port while the first is still listening, causing EADDRINUSE errors and an exponential backoff loop (up to 10 attempts).
Steps to reproduce
Configure MSTeams channel in openclaw.json
Start gateway: systemctl --user start openclaw-gateway
Observe logs: "starting provider (port 3978)" followed immediately by "auto-restart attempt 1/10"
Expected behavior
MSTeams adapter starts once and stays running.
Actual behavior
Adapter starts successfully (port 3978 binds, webhook responds with 401), but the runtime sees the function resolve and triggers restart. Subsequent attempts fail with EADDRINUSE.
OpenClaw version
Version: 2026.2.22-2, Node 22.22.0
Operating system
Ubuntu 24.04
Install method
No response
Logs, screenshots, and evidence
Impact and severity
No response
Additional information
Workaround: Add a blocking await before the return in monitor.ts:
await new Promise((resolve) => { httpServer.on("close", () => resolve());});return { app: expressApp, shutdown };
Also: @microsoft/agents-hosting (peer dependency of @openclaw/msteams) is not installed automatically by npm install -g openclaw. Users must manually run npm install @microsoft/agents-hosting inside the OpenClaw package directory.