-
-
Notifications
You must be signed in to change notification settings - Fork 80.7k
[Bug]: Teams app removal/re-add retains prior DM session history #99054
Copy link
Copy link
Labels
P1High-priority user-facing bug, regression, or broken workflow.High-priority user-facing bug, regression, or broken workflow.bugSomething isn't workingSomething isn't workingbug:behaviorIncorrect behavior without a crashIncorrect behavior without a crashclawsweeper:fix-shape-clearClawSweeper found a clear likely implementation shape for this issue.ClawSweeper found a clear likely implementation shape for this issue.clawsweeper:linked-pr-openClawSweeper found an open linked pull request for this issue.ClawSweeper found an open linked pull request for this issue.clawsweeper:needs-maintainer-reviewClawSweeper marked this issue as needing maintainer review before automation.ClawSweeper marked this issue as needing maintainer review before automation.clawsweeper:needs-product-decisionClawSweeper marked this issue as needing a product or behavior decision.ClawSweeper marked this issue as needing a product or behavior decision.clawsweeper:needs-security-reviewClawSweeper marked this issue as needing security-sensitive review.ClawSweeper marked this issue as needing security-sensitive review.clawsweeper:no-new-fix-prClawSweeper does not recommend queueing a new automated fix PR for this issue.ClawSweeper does not recommend queueing a new automated fix PR for this issue.clawsweeper:source-reproClawSweeper found a high-confidence source-level issue reproduction.ClawSweeper found a high-confidence source-level issue reproduction.impact:securitySecurity boundary, credential, authz, sandbox, or sensitive-data risk.Security boundary, credential, authz, sandbox, or sensitive-data risk.impact:session-stateSession, memory, transcript, context, or agent state can drift or corrupt.Session, memory, transcript, context, or agent state can drift or corrupt.issue-rating: 🦞 diamond lobsterVery strong issue quality with high-confidence source-level or clear reproduction.Very strong issue quality with high-confidence source-level or clear reproduction.
Description
Metadata
Metadata
Assignees
Labels
P1High-priority user-facing bug, regression, or broken workflow.High-priority user-facing bug, regression, or broken workflow.bugSomething isn't workingSomething isn't workingbug:behaviorIncorrect behavior without a crashIncorrect behavior without a crashclawsweeper:fix-shape-clearClawSweeper found a clear likely implementation shape for this issue.ClawSweeper found a clear likely implementation shape for this issue.clawsweeper:linked-pr-openClawSweeper found an open linked pull request for this issue.ClawSweeper found an open linked pull request for this issue.clawsweeper:needs-maintainer-reviewClawSweeper marked this issue as needing maintainer review before automation.ClawSweeper marked this issue as needing maintainer review before automation.clawsweeper:needs-product-decisionClawSweeper marked this issue as needing a product or behavior decision.ClawSweeper marked this issue as needing a product or behavior decision.clawsweeper:needs-security-reviewClawSweeper marked this issue as needing security-sensitive review.ClawSweeper marked this issue as needing security-sensitive review.clawsweeper:no-new-fix-prClawSweeper does not recommend queueing a new automated fix PR for this issue.ClawSweeper does not recommend queueing a new automated fix PR for this issue.clawsweeper:source-reproClawSweeper found a high-confidence source-level issue reproduction.ClawSweeper found a high-confidence source-level issue reproduction.impact:securitySecurity boundary, credential, authz, sandbox, or sensitive-data risk.Security boundary, credential, authz, sandbox, or sensitive-data risk.impact:session-stateSession, memory, transcript, context, or agent state can drift or corrupt.Session, memory, transcript, context, or agent state can drift or corrupt.issue-rating: 🦞 diamond lobsterVery strong issue quality with high-confidence source-level or clear reproduction.Very strong issue quality with high-confidence source-level or clear reproduction.
Type
Fields
Priority
None yet
Bug type
Behavior bug (incorrect output/state without crash)
Beta release blocker
No
Summary
After a user removed and re-added a Microsoft Teams bot/app in a personal chat, OpenClaw resumed the same server-side DM session and the bot could answer from pre-removal conversation history.
Steps to reproduce
Observed case, redacted:
Expected behavior
After a Teams bot/app is removed from a personal chat and later re-added, OpenClaw should not silently continue the prior active DM session in a way that lets the bot reason over pre-removal chat history without an explicit retention decision.
At minimum, OpenClaw should handle or explicitly ignore the relevant Teams lifecycle signal. Microsoft documents
installationUpdateremove/add events as the place where bots can meet privacy/data-retention requirements and clean up user or thread data when uninstalled.There is existing OpenClaw precedent for treating channel lifecycle or explicit channel reset boundaries as session boundaries without deleting transcripts:
updatedAtto0inextensions/discord/src/monitor/thread-session-close.ts; the comment says the next inbound message starts a fresh conversation without deleting on-disk transcript history./newand non-soft/resetas session boundary commands inextensions/telegram/src/message-cache.ts, andextensions/telegram/src/message-cache.test.tsverifies that context before the current reset boundary is excluded.Actual behavior
The re-added bot continued using the same OpenClaw session key and session id.
Evidence from the observed test, redacted:
<same-session-id>.<same-session-id>.This is actionable at the source level: current Teams handling does not dispatch
installationUpdate, andconversationUpdatehandling only coversmembersAdded. A PR can use sanitized lifecycle fixtures for the dispatch/handling gap, then use one live Teams proof run to confirm which lifecycle signal the Teams removal UI emits.OpenClaw version
Observed with
@openclaw/[email protected]in a Microsoft Teams test deployment.Operating system
macOS for the observed test. The current upstream source-level lifecycle dispatch gap is OS-independent.
Install method
npm
Model
Not applicable. The issue is the Teams channel/session lifecycle boundary before model choice matters.
Provider / routing chain
Microsoft Teams personal chat -> Bot Framework webhook -> OpenClaw
msteamschannel -> OpenClaw direct-message session.Additional provider/model setup details
No provider-specific behavior is known to be involved. The retained session entry can be observed at the session store/transcript layer.
Logs
Screenshots, recordings, and evidence
installationUpdateis emitted on install/uninstall, usesaction: addoraction: remove, and can be used for privacy/data-retention cleanup.BotNotInConversationRoster: bot is not in the conversation; wait forinstallationUpdatebefore sending again.ConversationBlockedByUser: delete the cached conversation and stop attempting posts until the user explicitly interacts again.Impact and severity
Affected: Microsoft Teams personal-chat users of OpenClaw bots.
Severity: Medium/high privacy and session-state issue. The bot can continue with prior server-side session history after a user removes and re-adds the Teams app/bot.
Frequency: Observed in one Teams personal app removal/re-add flow. Broader frequency has not been measured.
Consequence: A user may reasonably believe removing a Teams bot/app ended or reset that bot relationship, while OpenClaw can continue using the prior server-side conversation session after re-add.
Additional information
This issue is intentionally narrow:
Likely safe implementation direction, if maintainers agree with the expected behavior:
installationUpdateevents in the Teams ActivityHandler shim.installationUpdate.action === "remove"andaction === "add".conversationUpdate.membersRemovedwhere the removed member is the bot, if Teams emits that shape for any remove path.BotNotInConversationRosterandConversationBlockedByUser, clear/tombstone cached conversation references and avoid proactive sends until a fresh install event or user interaction.Suggested proof for a PR:
installationUpdateadd/remove.conversationUpdate.membersRemoved.mainignoresinstallationUpdate.membersAddedwelcome behavior still works.installationUpdate,conversationUpdate.membersRemoved, neither, or both.