fix(msteams): keep startAccount Promise pending while server runs#24391
Closed
justinhuangcode wants to merge 3 commits intoopenclaw:mainfrom
Closed
fix(msteams): keep startAccount Promise pending while server runs#24391justinhuangcode wants to merge 3 commits intoopenclaw:mainfrom
justinhuangcode wants to merge 3 commits intoopenclaw:mainfrom
Conversation
43bbc83 to
4cb3d50
Compare
1047b87 to
8e74691
Compare
monitorMSTeamsProvider() resolved immediately after starting the Express server, which the channel orchestrator interpreted as "account exited". This triggered an infinite restart loop with EADDRINUSE errors because the port was still bound from the previous instance. Wrap the server lifecycle in a long-lived Promise that: - stays pending while the HTTP server is running - rejects on server error (propagates to orchestrator) - resolves only on server close (graceful shutdown) - handles abort signal for clean teardown This matches the pattern used by the Feishu channel plugin. Fixes openclaw#24374 Co-Authored-By: Claude Opus 4.6 <[email protected]>
Verify that monitorMSTeamsProvider: - returns early when msteams is disabled or credentials are missing - stays pending while the HTTP server is running - resolves with app and shutdown when the server is closed via AbortSignal Regression test for openclaw#24374 (infinite restart loop). Co-Authored-By: Claude Opus 4.6 <[email protected]>
The monitor function reads core.channel.text.resolveTextChunkLimit after credentials are resolved. The stub was missing this property, causing a TypeError on Windows CI where module resolution order differs from Node on Linux. Co-Authored-By: Claude Opus 4.6 <[email protected]>
8e74691 to
8c2b1db
Compare
Contributor
Author
|
Closing in favour of the consolidated fix thread on #24522. The root cause is identical — Happy to help review or iterate on the remaining approaches if useful. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
monitorMSTeamsProvider()returned immediately after starting the Express server, causing the channel orchestrator to treat it as "account exited" and schedule a restart — which led to an infinite restart loop withEADDRINUSEerrorsThis matches the pattern used by the Feishu channel plugin (
extensions/feishu/src/monitor.ts).Root Cause
The channel orchestrator calls
startAccount()which returns a Promise frommonitorMSTeamsProvider(). The old code calledexpressApp.listen()and then immediately returned{ app, shutdown }, resolving the Promise. The orchestrator interprets a resolvedstartAccountPromise as "the account has exited" and schedules a restart. Since the port is still bound from the previous server instance, the restart fails withEADDRINUSE, creating an infinite loop.Test plan
Fixes #24374
🤖 Generated with Claude Code
Greptile Summary
Fixes the MS Teams channel infinite restart loop (#24374) by wrapping the Express server lifecycle in a long-lived Promise. The old code resolved the
startAccountPromise immediately after callingexpressApp.listen(), causing the channel orchestrator to interpret this as "account exited" and schedule a restart — while the port was still bound, leading toEADDRINUSEerrors in a loop.The new code:
{ once: true }on the abort listenerThis aligns with the pattern used by the Feishu channel plugin (
extensions/feishu/src/monitor.ts).Confidence Score: 4/5
Last reviewed commit: 43bbc83