Skip to content

fix(msteams): add proactive fallback for revoked turn context#27224

Merged
steipete merged 2 commits intoopenclaw:mainfrom
openperf:fix/msteams-revoked-proxy-fallback
Mar 2, 2026
Merged

fix(msteams): add proactive fallback for revoked turn context#27224
steipete merged 2 commits intoopenclaw:mainfrom
openperf:fix/msteams-revoked-proxy-fallback

Conversation

@openperf
Copy link
Contributor

Fixes #27189

Summary

When an inbound MS Teams message is debounced (default for this channel), the Bot Framework turn context is revoked before the debouncer flushes and the reply is dispatched. Any subsequent attempt to use the revoked context proxy—to send a typing indicator or a threaded reply—throws a TypeError, causing the reply to fail silently. From the user's perspective, the bot reads messages but never responds.

This commit fixes the issue by adding a fallback to proactive messaging when the turn context is revoked. This ensures that replies are delivered reliably even when the inbound message was debounced.

Changes

File What changed
extensions/msteams/src/errors.ts Added isRevokedProxyError() utility to reliably detect revoked proxy errors.
extensions/msteams/src/reply-dispatcher.ts sendTypingIndicator now catches revoked proxy errors and falls back to sending the typing indicator via adapter.continueConversation.
extensions/msteams/src/messenger.ts sendMSTeamsMessages now catches revoked proxy errors when replyStyle is thread and falls back to proactive messaging.
extensions/msteams/src/errors.test.ts Added tests for isRevokedProxyError.
extensions/msteams/src/messenger.test.ts Added test case to verify the proactive fallback for revoked thread context.

How to test

  1. Configure the MS Teams channel with default settings (which include inbound debouncing).
  2. Send a message to the bot in a 1:1 chat.
  3. The bot should now reply successfully.
  4. The logs should no longer show final reply failed: Cannot perform 'set' on a proxy that has been revoked.

@greptile-apps
Copy link
Contributor

greptile-apps bot commented Feb 26, 2026

Greptile Summary

This PR fixes a critical bug where MS Teams bots fail to respond when inbound messages are debounced. The Bot Framework revokes the turn context proxy before the debouncer flushes, causing TypeError on any subsequent context access.

The fix adds:

  • isRevokedProxyError() utility for robust error detection
  • Proactive messaging fallback in sendMSTeamsMessages() when thread context is revoked
  • Proactive messaging fallback in sendTypingIndicator() to maintain typing indicators
  • Comprehensive test coverage for the error detection and message fallback

The implementation correctly:

  • Uses case-insensitive regex to catch all proxy operation types ('set', 'get', 'apply', etc.)
  • Only catches the specific revoked proxy error (other errors are re-thrown)
  • Falls back gracefully while preserving message delivery
  • Maintains consistent behavior by setting activityId: undefined for proactive messages

Confidence Score: 5/5

  • This PR is safe to merge with no risk - it fixes a user-facing bug without introducing breaking changes
  • Score reflects clean implementation of a targeted bugfix. The error detection is robust (case-insensitive regex catches all proxy operations), the fallback mechanism is sound (properly re-throws non-target errors), and test coverage validates the critical message delivery path. Code follows repository conventions, uses proper TypeScript typing, and includes helpful inline comments.
  • No files require special attention - all implementations are clean and well-tested

Last reviewed commit: a25908f

root and others added 2 commits March 2, 2026 20:46
Fixes openclaw#27189

When an inbound message is debounced, the Bot Framework turn context is
revoked before the debouncer flushes and the reply is dispatched. Any
attempt to use the revoked context proxy throws a TypeError, causing the
reply to fail silently.

This commit fixes the issue by adding a fallback to proactive messaging
when the turn context is revoked:

- `isRevokedProxyError()`: New error utility to reliably detect when a
  proxy has been revoked.

- `reply-dispatcher.ts`: `sendTypingIndicator` now catches revoked proxy
  errors and falls back to sending the typing indicator via
  `adapter.continueConversation`.

- `messenger.ts`: `sendMSTeamsMessages` now catches revoked proxy errors
  when `replyStyle` is `thread` and falls back to proactive messaging.

This ensures that replies are delivered reliably even when the inbound
message was debounced, resolving the core issue where the bot appeared
to ignore messages.
@steipete steipete force-pushed the fix/msteams-revoked-proxy-fallback branch from a25908f to d7d9a30 Compare March 2, 2026 20:49
@steipete steipete merged commit 089a878 into openclaw:main Mar 2, 2026
@steipete
Copy link
Contributor

steipete commented Mar 2, 2026

Landed via temp rebase onto main.

  • Gate: pnpm vitest run extensions/msteams/src/errors.test.ts extensions/msteams/src/messenger.test.ts --maxWorkers=1; pnpm check && pnpm build
  • Land commit: d7d9a30
  • Merge commit: 089a878

Thanks @openperf!

mrosmarin added a commit to mrosmarin/openclaw that referenced this pull request Mar 2, 2026
* main: (154 commits)
  fix: harden exec allowlist regex literal handling (openclaw#32162) (thanks @stakeswky)
  fix(exec): escape regex literals in allowlist path matching
  fix: OpenAI OAuth TLS preflight gating (openclaw#32051) (thanks @alexfilatov)
  Auth: gate OpenAI OAuth TLS preflight in doctor
  Fix TLS cert preflight classification false positive
  Add OpenAI OAuth TLS preflight and doctor prerequisite check
  fix(gateway): hot-reload channelHealthCheckMinutes without full restart
  refactor: harden plugin install flow and main DM route pinning
  fix: propagate whatsapp inbound fromMe context (openclaw#32167) (thanks @scoootscooob)
  fix(whatsapp): propagate fromMe through inbound message pipeline
  refactor: harden msteams lifecycle and attachment flows
  fix(config): move sensitive-schema hint warnings to debug
  test(perf): reduce heavy fixture and guardrail overhead
  perf(core): speed up routing, pairing, slack, and security scans
  refactor: unify queueing and normalize telegram slack flows
  fix: harden bundled plugin install fallback semantics (openclaw#32096) (thanks @scoootscooob)
  fix(plugins): prefer bundled plugin ids over bare npm specs
  fix: distinguish warning message for non-OpenClaw vs missing npm package
  fix(plugins): fall back to bundled plugin when npm spec resolves to non-OpenClaw package (openclaw#32019)
  fix: harden msteams revoked-context fallback delivery (openclaw#27224) (thanks @openperf)
  ...
dawi369 pushed a commit to dawi369/davis that referenced this pull request Mar 3, 2026
OWALabuy pushed a commit to kcinzgg/openclaw that referenced this pull request Mar 4, 2026
zooqueen pushed a commit to hanzoai/bot that referenced this pull request Mar 6, 2026
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: M

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: MS Teams replies fail with 'Cannot perform set on a proxy that has been revoked

2 participants