Skip to content

[Bug]: msteams: stale conversation cache breaks replies after restart #2339

@strategy9

Description

@strategy9

Bug Report: msteams plugin - stale conversation cache breaks replies after restart

Version: Clawdbot v2026.1.24-3
OS: macOS (M4 Mac Mini)
Plugin: msteams (bundled)

Problem:
After gateway restart, bot replies fail with:

TypeError: activity.applyConversationReference is not a function

Root Cause Identified:
The file ~/.clawdbot/msteams-conversations.json persists conversation references across restarts. On reload, these are deserialized as plain objects, not Activity class instances — so they lack the applyConversationReference method.

Timeline from logs:

  • 16:29:43 UTC — SIGTERM, gateway shutdown
  • 16:30:27 UTC — Gateway restarted, msteams provider started
  • 16:42:09 UTC — First applyConversationReference error (~12 min later)

Bot worked perfectly for 48 hours before this restart.

Workaround:

  1. Delete ~/.clawdbot/msteams-conversations.json
  2. Restart gateway
  3. Send fresh message to re-establish conversation reference

This works — replies function normally after cache is cleared.

Suggested Fix:
When loading conversation references from cache, rehydrate them as proper Activity/ConversationReference instances (or use the Bot Framework's built-in serialization). Plain JSON.parse() loses the prototype chain.

Relevant code path:
Wherever msteams-conversations.json is loaded — likely needs something like:

const ref = JSON.parse(cached);
const activity = Activity.fromObject(ref);  // or similar rehydration

Happy to test a fix if you push a branch. 🦞

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions