Skip to content

fix(msteams): replace deprecated HttpPlugin with httpServerAdapter#60939

Merged
BradGroux merged 3 commits intoopenclaw:mainfrom
coolramukaka-sys:claude/fix-msteams-httpserviceadapter
Apr 4, 2026
Merged

fix(msteams): replace deprecated HttpPlugin with httpServerAdapter#60939
BradGroux merged 3 commits intoopenclaw:mainfrom
coolramukaka-sys:claude/fix-msteams-httpserviceadapter

Conversation

@coolramukaka-sys
Copy link
Copy Markdown
Contributor

@coolramukaka-sys coolramukaka-sys commented Apr 4, 2026

Summary

  • Migrate from the deprecated plugins: [noOpHttpPlugin] pattern to the SDK's public httpServerAdapter option in createMSTeamsApp()
  • Eliminates the [DEPRECATED] HttpPlugin in plugins array warning that fires every ~60s in the gateway error log
  • Removes ~40 lines of fragile code that used reflect-metadata hacks against internal SDK decorator paths

What changed

extensions/msteams/src/sdk.ts

  • Replaced the createNoOpHttpPlugin() function (~40 lines of reflect-metadata decorator hacks) with a 3-line createNoOpHttpServerAdapter() that implements IHttpServerAdapter
  • createMSTeamsApp() now passes httpServerAdapter instead of plugins: [noOpHttp]
  • Added type-only import for IHttpServerAdapter (dist subpath required — tsgo can't resolve the public barrel re-export chain)
  • Fixed stale JSDoc referencing removed HttpPlugin

extensions/msteams/src/sdk.test.ts

  • Updated test comment to reflect the new approach

Before / After

Before (main, unpatched) — HttpPlugin warning fires every ~60s (full log):

Apr 04 17:39:47 [WARN] @teams/app [DEPRECATED] HttpPlugin in plugins array will be deprecated...
Apr 04 17:40:47 [WARN] @teams/app [DEPRECATED] HttpPlugin in plugins array will be deprecated...
Apr 04 17:41:47 [WARN] @teams/app [DEPRECATED] HttpPlugin in plugins array will be deprecated...

After (this PR) — zero warnings over 2+ minute observation (full log):

Apr 04 17:42:49 [gateway] ready (6 plugins, 1.9s)
Apr 04 17:42:53 [msteams] starting provider (port 3979)
Apr 04 17:42:55 [msteams] users resolved: 11f44b5b...
(no HttpPlugin warnings)

Teams UI — bot receives messages, streams responses, shows AI label and feedback buttons:

Streaming and feedback working

Testing

  • All 7 existing msteams SDK tests pass
  • Deployed to Azure VM (riley-inbestments.westus2.cloudapp.azure.com) — before/after log comparison
  • msteams channel starts, users resolve, messages flow end-to-end
  • Verified in Teams via Playwright automation
  • Zero HttpPlugin deprecation warnings after sustained activity
  • Local gateway verified on macOS

Smoke test results (test plan)

Test Result Notes
A1 Basic reply PASS Bot received and responded in 1:1 chat
A4 Streaming PASS Typing indicator + progress bar visible
A6 Feedback PASS Like/Dislike buttons render on bot messages
E4 HTTPS PASS curl returns 401 (rejects unauthenticated)

All evidence: SidU/ocmaintenance/teams/testing/screenshots/2026-04-04/

Known issues (pre-existing, not caused by this PR)

Fixes: #60732
See also: #55161

🤖 Generated with Claude Code

@openclaw-barnacle openclaw-barnacle Bot added channel: msteams Channel integration: msteams size: S labels Apr 4, 2026
@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented Apr 4, 2026

Greptile Summary

This PR migrates the MS Teams channel plugin's HTTP server stub from a reflect-metadata / decorator-metadata hack (~40 lines, reaching into private SDK dist paths) to the public httpServerAdapter option on App(...). The change eliminates a recurring [DEPRECATED] HttpPlugin in plugins array warning and removes fragile code that imported internal decorator paths from @microsoft/teams.apps.

Key changes:

  • createNoOpHttpPlugin() (async, reflect-metadata-dependent, ~40 lines) replaced by createNoOpHttpServerAdapter() (3 lines, returns { registerRoute() {} }).
  • createMSTeamsApp now passes httpServerAdapter: createNoOpHttpServerAdapter() instead of plugins: [noOpHttp].
  • Import added for IHttpServerAdapter — but from @microsoft/teams.apps/dist/http/index.js (a private dist path) rather than the public root export @microsoft/teams.apps, which reintroduces the same dist-fragility concern the PR is otherwise removing.
  • One stale JSDoc comment in createMSTeamsAdapter still refers to "the App's HttpPlugin" even though HttpPlugin is no longer used.

Confidence Score: 4/5

Safe to merge; the core logic change is correct and well-motivated, with two small follow-up items that can be fixed in a subsequent commit.

The IHttpServerAdapter implementation satisfies the interface contract (only registerRoute is required; start, stop, serveStatic are optional), tests pass, and the deprecated warning path is correctly removed. The private-dist-path import is a style/fragility concern rather than a runtime bug since it is type-only. The stale JSDoc comment is cosmetic.

extensions/msteams/src/sdk.ts — private dist path on line 1 and stale JSDoc on line 348.

Comments Outside Diff (1)

  1. extensions/msteams/src/sdk.ts, line 348 (link)

    P2 Stale reference to HttpPlugin in JSDoc

    This JSDoc line still reads "For incoming requests: the App's HttpPlugin handles JWT validation.", but HttpPlugin is no longer in the picture — the PR replaced it with the httpServerAdapter path. The comment should be updated to reflect the new mechanism.

    Prompt To Fix With AI
    This is a comment left during a code review.
    Path: extensions/msteams/src/sdk.ts
    Line: 348
    
    Comment:
    **Stale reference to HttpPlugin in JSDoc**
    
    This JSDoc line still reads *"For incoming requests: the App's HttpPlugin handles JWT validation."*, but `HttpPlugin` is no longer in the picture — the PR replaced it with the `httpServerAdapter` path. The comment should be updated to reflect the new mechanism.
    
    
    
    How can I resolve this? If you propose a fix, please make it concise.
Prompt To Fix All With AI
This is a comment left during a code review.
Path: extensions/msteams/src/sdk.ts
Line: 1

Comment:
**Private dist path reintroduced for type import**

The import reaches into `@microsoft/teams.apps/dist/http/index.js` — a private distribution path identical in fragility to the `dist/types/plugin/decorators/*.js` paths the PR is removing. The old code even called this out explicitly: *"FRAGILE: these are internal SDK paths (not public API). If `@microsoft/teams.apps` changes its dist layout, these imports will break."*

`IHttpServerAdapter` is re-exported from the package's public root, so the public subpath should be used instead:

```suggestion
import type { IHttpServerAdapter } from "@microsoft/teams.apps";
```

This keeps the type-safety benefit while importing through the documented public surface and avoids a breaking point on any future SDK dist-layout change.

How can I resolve this? If you propose a fix, please make it concise.

---

This is a comment left during a code review.
Path: extensions/msteams/src/sdk.ts
Line: 348

Comment:
**Stale reference to HttpPlugin in JSDoc**

This JSDoc line still reads *"For incoming requests: the App's HttpPlugin handles JWT validation."*, but `HttpPlugin` is no longer in the picture — the PR replaced it with the `httpServerAdapter` path. The comment should be updated to reflect the new mechanism.

```suggestion
 * For incoming requests: JWT validation is handled by the Teams SDK App's
 * built-in auth middleware (not the now-bypassed HttpPlugin).
```

How can I resolve this? If you propose a fix, please make it concise.

Reviews (1): Last reviewed commit: "fix(msteams): replace deprecated HttpPlu..." | Re-trigger Greptile

@@ -1,3 +1,4 @@
import type { IHttpServerAdapter } from "@microsoft/teams.apps/dist/http/index.js";
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Private dist path reintroduced for type import

The import reaches into @microsoft/teams.apps/dist/http/index.js — a private distribution path identical in fragility to the dist/types/plugin/decorators/*.js paths the PR is removing. The old code even called this out explicitly: "FRAGILE: these are internal SDK paths (not public API). If @microsoft/teams.apps changes its dist layout, these imports will break."

IHttpServerAdapter is re-exported from the package's public root, so the public subpath should be used instead:

Suggested change
import type { IHttpServerAdapter } from "@microsoft/teams.apps/dist/http/index.js";
import type { IHttpServerAdapter } from "@microsoft/teams.apps";

This keeps the type-safety benefit while importing through the documented public surface and avoids a breaking point on any future SDK dist-layout change.

Prompt To Fix With AI
This is a comment left during a code review.
Path: extensions/msteams/src/sdk.ts
Line: 1

Comment:
**Private dist path reintroduced for type import**

The import reaches into `@microsoft/teams.apps/dist/http/index.js` — a private distribution path identical in fragility to the `dist/types/plugin/decorators/*.js` paths the PR is removing. The old code even called this out explicitly: *"FRAGILE: these are internal SDK paths (not public API). If `@microsoft/teams.apps` changes its dist layout, these imports will break."*

`IHttpServerAdapter` is re-exported from the package's public root, so the public subpath should be used instead:

```suggestion
import type { IHttpServerAdapter } from "@microsoft/teams.apps";
```

This keeps the type-safety benefit while importing through the documented public surface and avoids a breaking point on any future SDK dist-layout change.

How can I resolve this? If you propose a fix, please make it concise.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Addressed in 190faa0.

Investigated using the public root import (@microsoft/teams.apps) as suggested — unfortunately tsgo (the stricter type-checker used in the pre-commit hook) can't resolve IHttpServerAdapter through the barrel re-export chain (export * from './http'). The import compiles fine with standard tsc/vitest but fails tsgo with TS2305: Module has no exported member.

Kept the dist subpath but added a comment explaining why it's necessary, so future editors don't silently "fix" it back to the public root and break the build.

Also fixed the stale JSDoc at line 348 that still referenced "the App's HttpPlugin" — updated to "the App's HTTP server".

@coolramukaka-sys
Copy link
Copy Markdown
Contributor Author

Upstream SDK improvement filed: microsoft/teams.ts#505

This requests the ability to opt out of HTTP server creation entirely in the App constructor (http: false or httpServerAdapter: null), plus properly exporting IHttpServerAdapter from the public barrel.

Until that ships, this PR's no-op httpServerAdapter workaround is the cleanest available option — it uses the SDK's public API (not the deprecated plugins array) and eliminates the recurring deprecation warnings.

@BradGroux
Copy link
Copy Markdown
Member

Findings

No blocking issues found.

I reviewed the PR diff, checked the surrounding msteams integration paths, and verified the upstream @microsoft/teams.apps@2.0.6 behavior. The switch from the decorator-based fake HttpPlugin to httpServerAdapter looks correct for how OpenClaw actually uses App: token acquisition and proactive messaging, while inbound webhook handling stays in OpenClaw's own Express server.

I also ran the focused Teams SDK test file on the PR branch: extensions/msteams/src/sdk.test.ts, and all 7 tests passed.

Residual risk is low, but there is one non-blocking note: the type-only import from index.js is still coupled to an internal package path. Since it is erased at runtime and the package does not define an exports map, I would not block the PR on it, but it is the main thing I'd keep an eye on in future SDK upgrades.

RamuKaka and others added 3 commits April 4, 2026 17:19
Migrate from the deprecated `plugins: [noOpHttpPlugin]` pattern to the
SDK's public `httpServerAdapter` option. This eliminates the
"[DEPRECATED] HttpPlugin in plugins array" warning that fires every
~60 seconds in the gateway error log.

The old NoOpHttpPlugin was a ~40-line class that used fragile
reflect-metadata hacks against internal SDK decorator paths. The
replacement is a simple 3-line IHttpServerAdapter stub with an empty
registerRoute() — the only method the interface requires.

Fixes: openclaw#60732
See also: openclaw#55161

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Update stale JSDoc that still referenced HttpPlugin (line 348)
- Add comment explaining why IHttpServerAdapter uses dist subpath
  (tsgo cannot resolve the re-export chain from the public barrel)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@BradGroux BradGroux force-pushed the claude/fix-msteams-httpserviceadapter branch from 190faa0 to 7fe7f3c Compare April 4, 2026 22:21
@BradGroux BradGroux merged commit 70015be into openclaw:main Apr 4, 2026
3 checks passed
@BradGroux
Copy link
Copy Markdown
Member

Merged via squash.

Thanks @coolramukaka-sys.

lovewanwan pushed a commit to lovewanwan/openclaw that referenced this pull request Apr 28, 2026
…penclaw#60939)

Merged via squash.

Prepared head SHA: 7fe7f3c
Co-authored-by: coolramukaka-sys <271658891+coolramukaka-sys@users.noreply.github.com>
Co-authored-by: BradGroux <3053586+BradGroux@users.noreply.github.com>
Reviewed-by: @BradGroux
ogt-redknie pushed a commit to ogt-redknie/OPENX that referenced this pull request May 2, 2026
…penclaw#60939)

Merged via squash.

Prepared head SHA: 7fe7f3c
Co-authored-by: coolramukaka-sys <271658891+coolramukaka-sys@users.noreply.github.com>
Co-authored-by: BradGroux <3053586+BradGroux@users.noreply.github.com>
Reviewed-by: @BradGroux
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request May 9, 2026
…penclaw#60939)

Merged via squash.

Prepared head SHA: 7fe7f3c
Co-authored-by: coolramukaka-sys <271658891+coolramukaka-sys@users.noreply.github.com>
Co-authored-by: BradGroux <3053586+BradGroux@users.noreply.github.com>
Reviewed-by: @BradGroux
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

channel: msteams Channel integration: msteams size: S

Projects

None yet

Development

Successfully merging this pull request may close these issues.

MS Teams plugin: migrate from deprecated HttpPlugin to httpServerAdapter

2 participants