MS Teams: add channel archive persistence and deleted-channel cleanup#43190
MS Teams: add channel archive persistence and deleted-channel cleanup#43190hddevteam wants to merge 8 commits intoopenclaw:mainfrom
Conversation
Greptile SummaryThis PR introduces a Key highlights:
Confidence Score: 3/5
|
There was a problem hiding this comment.
Pull request overview
Adds a new Microsoft Teams channel-archive extension and wires new lifecycle/metadata plumbing so plugins can persist Teams channel history (including attachments) and clean up archived state when a channel is deleted.
Changes:
- Introduces
extensions/msteams-channel-archivewith JSONL-backed archive storage, attachment copying, and archive query tools. - Adds a new plugin hook (
channel_deleted) and emits it from the Teams monitor onconversationUpdate/channelDeleted. - Enriches inbound message hook metadata with Teams-specific fields (reply/thread/media/provider metadata) to support archiving.
Reviewed changes
Copilot reviewed 24 out of 25 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| src/plugins/wired-hooks-message.test.ts | Adds hook-runner regression test coverage for the new channel_deleted hook runner method. |
| src/plugins/types.ts | Extends plugin hook names/types to include channel_deleted and defines its event type. |
| src/plugins/hooks.ts | Adds runChannelDeleted to the hook runner implementation/export surface. |
| src/hooks/message-hook-mappers.ts | Extends canonical inbound hook context and maps additional Teams/media/thread/provider fields into plugin event metadata. |
| src/hooks/message-hook-mappers.test.ts | Updates tests to assert the new mapped metadata fields. |
| src/auto-reply/templating.ts | Adds ProviderMetadata to message context typing for provider-specific untrusted metadata propagation. |
| pnpm-lock.yaml | Adds dependency lock entries for the new extension workspace. |
| extensions/msteams/src/monitor-handler/message-handler.ts | Enriches inbound message context with Teams provider metadata (team/channel IDs, replyToId, etc.). |
| extensions/msteams/src/monitor-handler/inbound-media.ts | Adjusts Graph fallback triggering logic for HTML attachments when no media downloaded. |
| extensions/msteams/src/monitor-handler.ts | Emits channel_deleted hook on Teams conversationUpdate/channelDeleted events via the global hook runner. |
| extensions/msteams/src/monitor-handler.file-consent.test.ts | Adds test coverage verifying channelDeleted events are forwarded to plugin hooks. |
| extensions/msteams/src/attachments/shared.ts | Extends auth-host allowlist for attachment downloads. |
| extensions/msteams/src/attachments/graph.ts | Adds /chats/ URL fallbacks and improves hosted-content download by fetching $value when contentBytes isn’t inlined. |
| extensions/msteams-channel-archive/src/types.ts | Defines archive store record types and search/prune result shapes. |
| extensions/msteams-channel-archive/src/tools.ts | Registers archive query tools with TypeBox schemas and JSON-formatted responses. |
| extensions/msteams-channel-archive/src/channel-cleanup.ts | Implements periodic Graph-based deleted-channel cleanup sweep and prune logic. |
| extensions/msteams-channel-archive/src/channel-cleanup.test.ts | Adds unit tests for cleanup sweep pruning/skip behavior. |
| extensions/msteams-channel-archive/src/archive-store.ts | Implements JSONL archive store, attachment copying, searching, listing, and pruning. |
| extensions/msteams-channel-archive/src/archive-store.test.ts | Adds store tests for dedupe, search/thread queries, and prune/orphan-attachment removal behavior. |
| extensions/msteams-channel-archive/package.json | Adds new extension package manifest and TypeBox dependency. |
| extensions/msteams-channel-archive/openclaw.plugin.json | Declares plugin metadata and config schema for the new extension. |
| extensions/msteams-channel-archive/index.ts | Wires the extension: registers tools/services, archives message_received, prunes on channel_deleted. |
| extensions/msteams-channel-archive/index.test.ts | Adds basic extension wiring test for channel_deleted pruning. |
| CHANGELOG.md | Adds changelog entries describing the Teams channel archive plugin and delete-event pruning. |
| .github/labeler.yml | Adds GitHub label automation for the new extension path. |
Files not reviewed (1)
- pnpm-lock.yaml: Language not supported
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 8155db0e99
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
|
Follow-up pushed in Addressed the substantive review items:
Validation rerun:
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: f9d9f50866
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
|
Addressed second round of review feedback in commit 872be20: Fixed (4 issues):
Outdated thread (P2 — compare archive channel ID when resolving Graph team) was already fixed in the previous commit ( |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 872be2053a
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: c074e4418a
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 36b16dc3d0
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: b7d8ec6912
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 0475260e00
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: b8d4caedfd
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
|
TL;DR for reviewers following the stack: The child PR is framing this as a default-policy fix, not a
Follow-up validation run:
|
1272481 to
173dbc5
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 173dbc5782
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
|
Codex review: needs changes before merge. Summary Reproducibility: not applicable. as a feature PR rather than a user bug report. The blocking findings are source-reproducible by comparing PR head Next step before merge Security Review findings
Review detailsBest possible solution: Land a reviewed version that declares the archive plugin's activation and tool ownership metadata, documents the new hook contract, keeps the Teams archive behavior plugin-owned, and passes the targeted plugin/Teams checks plus the changed gate. Do we have a high-confidence way to reproduce the issue? Not applicable as a feature PR rather than a user bug report. The blocking findings are source-reproducible by comparing PR head Is this the best way to solve the issue? No for the PR exactly as submitted. The implementation direction is plausible, but the manifest must declare startup activation and registered tool contracts, and the public hook docs should be aligned before normal maintainer approval. Full review comments:
Overall correctness: patch is incorrect Acceptance criteria:
What I checked:
Likely related people:
Remaining risk / open question:
Codex review notes: model gpt-5.5, reasoning high; reviewed against a7c5a0425988. |
dde9d2d to
c62d7c1
Compare
c62d7c1 to
d892540
Compare
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- archive-store: tolerate malformed JSONL lines (skip + warn instead of throw) - archive-store: bounded top-N accumulator in searchMessages/searchAttachments avoids O(n) memory with large archives; O(limit) memory instead - channel-cleanup: cache Graph team/channel resolution across archives in one sweep to avoid N× full-tenant Graph scan per archived channel - graph: check content-length header before materialising hosted-content arrayBuffer to prevent large allocations beyond maxBytes Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
d892540 to
d019bf0
Compare
Summary
extensions/msteams-channel-archiveplugin for persistent Teams channel archivingchannel_deletedplugin hook driven by TeamsconversationUpdate/channelDeletedWhat changed
msteams-channel-archiveextension with durable JSONL archive storage and attachment copyingchannel_deletedand emitted it from the Teams monitor onchannelDeletedValidation
pnpm vitest run src/plugins/wired-hooks-message.test.ts extensions/msteams/src/monitor-handler.file-consent.test.ts extensions/msteams-channel-archive/index.test.ts extensions/msteams-channel-archive/src/archive-store.test.ts extensions/msteams-channel-archive/src/channel-cleanup.test.ts src/hooks/message-hook-mappers.test.tschannelDeletedand pruned the new channel archive successfullyNotes
pnpm buildstill hits pre-existing baseline failures insrc/agents/**andsrc/commands/openai-codex-oauth.ts