fix(msteams): add @microsoft/agents-hosting to root dependencies#43761
fix(msteams): add @microsoft/agents-hosting to root dependencies#43761
Conversation
Bundled extensions ship inside the openclaw package (via the files array), but their node_modules are not included. In global/Homebrew installs, Node module resolution cannot find @microsoft/agents-hosting because it was only declared in the extension's package.json and explicitly allowlisted as an expected gap via rootDependencyMirrorAllowlist. This commit: - Adds @microsoft/agents-hosting ^1.3.1 to the root package.json dependencies so it is installed alongside openclaw in all install modes - Clears the now-stale rootDependencyMirrorAllowlist entry in the msteams extension manifest so the release-check gate will catch future drift - Updates pnpm-lock.yaml to include the new root dependency Fixes the runtime error: Cannot find module '@microsoft/agents-hosting' Supersedes #16606. Refs: #15622, #9357, #17089, #41431
There was a problem hiding this comment.
Pull request overview
Fixes runtime Cannot find module '@microsoft/agents-hosting' crash for global npm/Homebrew installs by hoisting the msteams extension's dependency to the root package.json.
Changes:
- Added
@microsoft/agents-hosting: ^1.3.1to rootpackage.jsondependencies - Cleared the
rootDependencyMirrorAllowlistin the msteams extension since the dependency is now mirrored - Updated
pnpm-lock.yamlaccordingly
Reviewed changes
Copilot reviewed 2 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
package.json |
Added @microsoft/agents-hosting to root dependencies |
extensions/msteams/package.json |
Emptied rootDependencyMirrorAllowlist since the gap is resolved |
pnpm-lock.yaml |
Lock file updated for new root dependency |
Files not reviewed (1)
- pnpm-lock.yaml: Language not supported
Greptile SummaryThis PR fixes a runtime crash (
Confidence Score: 5/5
Last reviewed commit: 9a5f4cc |
|
@onutc - Please review when you get a chance - see my message in Discord for more context, thanks! |
|
I don’t think this should merge in its current form. The core issue here appears to be architectural, not just a missing package or post-update reinstall step. The Teams extension does not appear to be sealed as its own deployable runtime unit. It still seems to rely on module resolution from the surrounding global/OpenClaw install tree, which makes it fragile across updates. That matters because a source-level If the extension’s required runtime dependencies are being resolved from shared or global install locations instead of from an extension-owned install/runtime artifact, then updates to OpenClaw can still break the extension even when the extension itself has not changed. At minimum, I think we need to answer these questions before merging:
I don’t think we should merge this until we have a clearer picture of the runtime dependency path. Right now, it risks papering over a packaging/deployment problem rather than actually proving the underlying model is sound. I’d rather pause here, verify how extension runtime dependencies are being resolved during and after updates, and then decide whether this PR is fixing the root cause or just the current symptom. Moving to Draft as I work through this. |
|
What I’m seeing is a broader pattern in OpenClaw where extensions/plugins with runtime dependencies can break across install/update paths when those dependencies are not reliably preserved, bundled, or resolved from a stable runtime boundary. Why I’m concerned
This does not appear to be Teams-only. I went looking for related OpenClaw issues/PRs and found a recurring pattern across multiple extensions/plugins. These are the related issues/PRs I found that most clearly point to the same extension/plugin dependency-loss pattern. This may not be exhaustive: Directly relevant issues
Same failure class showing up in memory-lancedb / bundled deps
Related PRs
My current takeaway
TL;DR - This doesn't look like an issue isolated to Microsoft Teams. |
|
Another way to view the findings, known affected extensions/plugins:
1. MSTeams - missing/wiped: @microsoft/agents-hosting 2. Matrix - missing/wiped: @vector-im/matrix-bot-sdk 3. Feishu - missing after install / npm pack flow 4. memory-lancedb - missing/wiped: @lancedb/lancedb and related native/runtime deps 5. ACPX plugin - subdependencies not installed on global npm install 6. google-antigravity-auth - plugin removed across updates |
|
@umangsehgal @SidU - Would love your input on this if you get the chance. |
|
Closing as resolved by #51808 (merged 2026-03-24), which migrated the Teams extension to the official Microsoft Agents SDK and eliminated the @microsoft/agents-hosting dependency entirely. Adding it to root deps is no longer necessary. |
Summary
Fixes the runtime crash
Cannot find module '@microsoft/agents-hosting'that occurs when the bundled msteams extension is loaded in global npm or Homebrew installs, as originally reported in #15622.Relationship to #12849
PR #12849 addressed the plugin installation side of #15622 by adding a bundled-source fallback when
npm packreturns a 404. That fix landed, but the runtime module resolution issue persisted: even after successful installation, the msteams extension crashes at load time because@microsoft/agents-hostingis not hoisted to the rootnode_modules. This PR closes the remaining gap by mirroring the dependency into the rootpackage.json.Root Cause
First reported in #15622: after updating OpenClaw, the Teams channel breaks with
Cannot find module '@microsoft/agents-hosting'.Bundled extensions ship inside the
openclawpackage via thefiles: ["extensions/"]entry inpackage.json, but their ownnode_modulesdirectories are not included in the published tarball. When OpenClaw is installed globally (npm, Homebrew, pnpm global), Node's module resolution starts from the mainopenclawpackage and cannot find@microsoft/agents-hostingbecause it was only declared in the extension'spackage.json.The repo's
rootDependencyMirrorAllowlistmechanism (enforced byscripts/release-check.ts) was explicitly marking this gap as "expected" — so the release-check gate passed, but the runtime still failed.What Changed
package.json"@microsoft/agents-hosting": "^1.3.1"to rootdependenciesextensions/msteams/package.jsonrootDependencyMirrorAllowlistentry (was["@microsoft/agents-hosting"], now[])pnpm-lock.yamlThe version range
^1.3.1matches the extension's own declaration inextensions/msteams/package.json.Validation
test/release-check.test.ts— all 8 tests passextensions/msteams/test suite — 224/225 pass; the 1 failure (probe.test.tscredential check) is pre-existing on main and unrelated to this changepnpm-lock.yamlupdated viapnpm install --lockfile-onlyon current mainWhy This Supersedes #16606
PR #16606 by @daocoding correctly identified the root cause and proposed the right fix direction. However, it:
package.json— missing thepnpm-lock.yamlupdate required for merge@microsoft/agents-hosting,@microsoft/agents-hosting-express,@microsoft/agents-hosting-extensions-teams) — but only@microsoft/agents-hostingis actually imported by the extension code (the other two were sub-packages from an older SDK split)^1.2.3— the extension now declares^1.3.1rootDependencyMirrorAllowlist— which would cause the release-check gate to flag stale entriesThis PR implements the minimal correct fix against current main.
Architectural Note
The
rootDependencyMirrorAllowlistmechanism is a pragmatic workaround for the fundamental issue: bundled extensions declare their own dependencies but those deps aren't available in the rootnode_modulesat runtime. A more robust solution would be to either:node_modulesin the published tarball, orThis is out of scope for this fix but noted for future consideration.
Scope & Caveats
This PR targets one specific failure mode: the recurring
Cannot find module '@microsoft/agents-hosting'crash that breaks the msteams extension after updates. The underlying issue — bundled extensions whose dependencies aren't hoisted to the rootnode_modules— is not unique to Teams; the same class of problem has surfaced for other extensions and install paths (see #41431, #9357, #17089). This fix addresses the Teams instance by mirroring the dependency into the root package, but it is not a general solution to the broader bundled-extension resolution pattern.What this does NOT cover:
[msteams] channels unresolvederrors) may have independent root causes and could require separate follow-up even after this module loads correctly.npm installor uses a stale cache, the same class of missing-module error could recur.References