Repository navigation
fix(msteams): reset isolated DM context after app removal - #168797
jimmypuckett wants to merge 1 commit into
Conversation
Route durable removal events through account-aware stored DM ownership and the existing session lifecycle API. Archive retired transcripts; preserve shared and model-locked sessions. Related: openclaw#99054 Follow-up to openclaw#100371 and openclaw#104690.
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: needs real behavior proof before merge. What this changesThis PR durably processes Teams app removals and archives isolated personal sessions through the existing session deletion API. Example: Uninstall the office bot after storing OLD_OFFICE_HISTORY in agent:office:msteams:office:direct:aad-dm-owner.
Review scores
ProductKind: Bug fix · Worth it: Needs a maintainer decision · Fix scope: Partial Merge readiness⛔ Blocked before merge - 6 items remain This PR addresses an unresolved Teams lifecycle bug and merits continued review; the existing routing finding and preference-policy disagreement remain unresolved. Priority: P2 Decision needed
Before merge
Findings
Tests
Agent review detailsHow this fits togetherAuthenticated Teams activities enter account-scoped durable ingress; the lifecycle handler resolves the stored DM owner and requests persistent session cleanup from the canonical session owner. flowchart TD
A[Teams removal activity] --> B[Authenticated SDK route]
B --> C[Durable ingress queue]
C --> D[Teams lifecycle handler]
D --> E[Stored conversation and account route]
E --> F[Canonical session lifecycle]
F --> G[Archived transcript and retired entry]
Technical reviewBest possible solution: Reset isolated Teams context through the canonical lifecycle owner, preserve the agreed preferences and readable archives, and keep unrelated accounts from blocking cleanup. Do we have a high-confidence way to reproduce the issue? Current main has no removal cleanup path, and the linked report’s authenticated capture establishes that true Teams app uninstall emits removal activities; no target code was executed during this review. Is this the best way to solve the issue? Reusing durable ingress and the canonical lifecycle owner is sound, but deletion changes preference retention and the sharing check must tolerate unrelated unbound accounts. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 3f8eb34c538e. Merge-risk optionsMaintainer options:
Provenance checked
TestingProof path: in-process harness. SecurityNeeds attention: Persistent cleanup still needs account-authority verification at the final effect. EvidenceSecurity concerns:
What I checked:
Likely related people:
PR surfaceSource +126, Tests +547, Docs +12. Total +685 across 10 files. Added test files: 2. View PR surface stats
Review metrics
Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. LabelsLabel changes: No label changes. Label justifications:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior. WorkflowClawSweeper edits this one comment on every review. Comment HistoryReviewed October 10, 2026, 10:09 PM ET / October 11, 2026, 02:09 UTC (Revision 3). |
|
Proof continuity for reviewed head I retrieved the evidence from the closed proposals and have linked the specific proof packets below. This separates historical Teams observations from validation of this smaller implementation. Historical live Teams proof: #100371 uninstall/reinstall capture records a synthetic marker before app-management uninstall, Historical owner/authority proof: #104690 exact-head packet identifies Current implementation evidence: The real-storage removal regression exercises actual activity-handler dispatch, account-aware routing and SQLite session/conversation storage. It asserts removal of the owning active entry and old active transcript, creation of an archived artifact, preservation of sibling/default context, and harmless duplicate removal after a fresh session is allocated. Additional cases cover another bot's recipient, shared/locked sessions, and deletion failure retaining the reference for retry. The durable restart/redelivery test verifies persisted removal replay completes without an explicit adoption callback and deduplicates redelivery. Previously collected proof for this exact source tree: 71 focused tests passed; all 28 affected-file cases passed serially in 46.78 seconds; the packaged build and production/test type checks passed. Reproduction command: node scripts/run-vitest.mjs extensions/msteams/src/monitor-handler/lifecycle-handler.test.ts extensions/msteams/src/msteams-ingress.test.ts extensions/msteams/src/monitor.removal.test.ts --maxWorkers=1Still outstanding: Fresh authenticated uninstall/reinstall proof on this head, readable archived-history verification, delayed retired/reassigned-account rejection, the unrelated unbound-sibling routing finding, and latest-stable upgrade/preferences proof remain open. The prior maintainer direction explicitly asked to preserve preferences; this smaller deletion approach currently clears them, as documented. That difference still needs resolution with the owner. The earlier packets do not clear these blockers, and this comment does not claim new live proof or a repaired patch. |
Related: #99054. Follows the closed Teams lifecycle proposals #100371 and #104690.
This is the smaller, account-aware follow-up to those attempts. It uses the existing session lifecycle API and replaces the previous proposal for a new public reset capability. The prior PRs remain available for their discussions and historical proof; their published branches are unchanged.
What Problem This Solves
Fixes retained pre-removal context when a Microsoft Teams bot/app is uninstalled from an isolated personal chat and later reinstalled.
User Impact
The removed installation’s isolated DM starts a fresh session after reinstall. Historical transcript content is archived through the existing owner. Shared main/per-peer sessions, sessions shared by bot accounts, and model-locked sessions remain intact and are logged. Retiring an entry also clears its session preferences. Ordinary upgrades, install-add events, other members leaving, and Teams local Remove chat history keep their existing behavior. There is no new configuration or public SDK API.
Why This Change Was Made
Removal events enter Teams durable ingress. Cleanup routes the stored DM owner with the bot’s account, then uses the existing session lifecycle API to archive and delete the active entry. Failure retains the conversation reference for retry; failed durable admission rejects the webhook request. The implementation stays within the Teams plugin.
Evidence
76a282c7a1c6ca958517ce15f13e17371c14be11.node scripts/run-vitest.mjs extensions/msteams/src/monitor-handler/lifecycle-handler.test.ts extensions/msteams/src/msteams-ingress.test.ts extensions/msteams/src/monitor.removal.test.ts --maxWorkers=1.76a282c7a1c6ca958517ce15f13e17371c14be11. Upstream advanced afterward without changing any authored path; the published patch tree matches the reviewed and tested candidate exactly. Full monorepopnpm check/pnpm testand fresh live Teams proof were not run. Broad plugin lint and the changed-file gate were run and retain the inherited failures described above.Current review gaps at
5ebed9858af6203c31400509362fce56524fabcb: fresh authenticated Teams uninstall/reinstall and readable archived-history proof; delayed retired/reassigned-account rejection; the unrelated unbound-sibling routing finding; and latest-stable upgrade/preferences proof. The prior maintainer preference-preservation direction still needs resolution because this implementation deletes the active entry and its preferences. Historical proof does not clear these current-head blockers.