Repository navigation
fix(msteams): broadcast entries split group chat sessions and ignore the documented key form - #190799
jerome-queck wants to merge 5 commits into
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
Codex review: needs maintainer review before merge. What this changesThis PR aligns Teams group-chat broadcast identity with ordinary routing and migrates legacy broadcast keys through Doctor. Example: Enable broadcast for Teams chat 19:[email protected] with agents main and helper.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review Keep open: this PR repairs a current Teams group-chat routing defect, addresses the earlier compatibility findings, and introduces no actionable defect found in this review. Priority: P2 Before mergeNone. FindingsNone. Agent review detailsHow this fits togetherThe Teams inbound handler supplies admitted conversation facts to core broadcast dispatch, which selects participants and constructs their session keys; Doctor normalizes existing configuration before runtime use. flowchart TD
A[Teams activity] --> B[Teams admission and routing]
B --> C[Inbound conversation facts]
C --> D[Core broadcast dispatch]
E[Doctor normalized config] --> D
D --> F[Participant sessions and replies]
Technical reviewBest possible solution: Use the existing Teams route-peer contract and plugin-owned Doctor migration to keep group-chat identity consistent without rewriting historical sessions. Do we have a high-confidence way to reproduce the issue? Current source exposes the complete identity mismatch, and the contributor supplies failing-base regression results and Gateway observations; this read-only review executed no target code. Is this the best way to solve the issue? The patch repairs the Teams producer through an existing SDK contract, retains other conversation identities, and places compatibility repair in the existing Doctor owner. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 28a93a00ac7a. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +75, Tests +174, Docs +3. Total +252 across 4 files. Added test files: 1. 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:
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 HistoryReview history (4 earlier review cycles)
Reviewed November 1, 2026, 11:47 PM ET / November 2, 2026, 04:47 UTC (Revision 5). |
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
Closes #190740
What Problem This Solves
Fixes: in Microsoft Teams group chats and channels, adding a documented
broadcast["msteams:<conversationId>"]entry does nothing, while the undocumentedmsteams:conversation:<id>key fans out into a different session (…:group:conversation:<id>), so adding/removing broadcast splits the routed agent's history.User Impact
User impact: Teams broadcast entries now use the documented
"<channel>:<peerId>"form with the bare conversation id, and the routed agent keeps the same session with or without broadcast.Existing prefixed keys / stored histories (no migration, nothing deleted): configs that used the undocumented
msteams:conversation:<id>key stop matching and fall back to the ordinary single-agent route; rename the key tomsteams:<id>. Transcripts already written underagent:<id>:msteams:group:conversation:<id>are left untouched on disk and are not merged or deleted; after this change new turns continue in the ordinaryagent:<id>:msteams:group:<id>session (the same one used before broadcast was added). Operators who want the in-between history can read or reuse those old sessions manually.Why This Change Was Made
Teams built its inbound context without
conversation.routePeer, so core group-thread dispatch fell back to the prefixedOriginatingTo(conversation:<id>) — or, for channels, the Graphteam/channelnative id. Teams now publishes the same peer it passes toresolveAgentRoute(bare conversation id; sender id for DMs), matching Slack and Discord. Plugin-local only; no core changes. Docs gain a Teams example of the key form.Evidence
New
extensions/msteams/src/monitor-handler/message-handler.broadcast.test.tsruns real Teams inbound preparation (createMSTeamsMessageHandler+ realbuildChannelInboundEventContext+ realresolveAgentRoute) into the real coredispatchInboundMessage(including group-thread fan-out); only the agent reply is stubbed.Red on
main(c268e6e), fix stashed:Green with fix: both pass; whole
extensions/msteams/src/monitor-handlersuite 9 files / 94 tests pass.Before/after session keys for chat
19:[email protected](same harness, probe not committed):Local
pnpm check:changed: format, typecheck extensions + extension tests, lint, plugin boundaries, mock-export ratchet, import cycles all ok. Live Gateway and upgrade runs: see Real behaviour proof below.Update (d7aa32f): Doctor migration for legacy keys
extensions/msteams/config-doctor-api.tsnow owns a legacy rule +normalizeCompatibilityConfigstep that movesbroadcast."msteams:conversation:<id>"→broadcast."msteams:<id>"onopenclaw doctor --fix. Existing canonical entries are never overwritten (a warning is emitted and both keys are left as-is).agent:<id>:msteams:group:<chat>sessions; plus a no-overwrite test.agent:main:msteams:group:<chat>before and after), so existing transcripts keep resolving; only the config key is rewritten.Update (follow-up): collisions + channel keys
msteams:conversation:<id>andmsteams:<id>exist, Doctor now keeps the canonical value and removes the superseded key (warning if values differed), so the legacy rule no longer matches and repair completes; the second run is a no-op (tested for identical and differing values).routePeeris now published only for group chats. Teams channels keep their existing broadcast identity (msteams:<teamAadGroupId>/<graphChannelId>via NativeChannelId) and DMs are unchanged, so no working channel/DM broadcast entry silently stops matching.Update: DM/channel scope
msteams:conversation:19:…@thread.v2). DM (a:…) and channel keys are left alone and still resolve through their existing lookup; a new inbound→dispatch regression proves a personal-conversationmsteams:conversation:<dm>entry still fans out to both agents.Real behaviour proof
Environment: Linux cloud VM; scratch Gateway with the Teams plugin and the plugin's loopback Bot Framework QA stand-in (no Teams tenant), QA mock model, agents
main+helper, group chat19:[email protected]. Tokens and activity ids redacted. Branch head93e544b.Before (main, no
conversation.routePeer)agent:main:msteams:group:19:[email protected]broadcast["msteams:<chat>"](documented)broadcast["msteams:conversation:<chat>"](legacy)agent:{main,helper}:msteams:group:conversation:19:[email protected]After (this branch)
agent:main:msteams:group:19:[email protected]broadcast["msteams:<chat>"]agent:helper:msteams:group:19:[email protected]Upgrade / data-model compatibility from
[email protected]+@openclaw/[email protected]broadcast["msteams:conversation:19:[email protected]"]stored history on the conversation-prefixed session keys.openclaw doctor --fixupgraded the agent databases (schema v25 → v39) and printed:Moved broadcast."msteams:conversation:19:[email protected]" → broadcast."msteams:19:[email protected]".openclaw doctor --fix: no further broadcast change (idempotent).chat.historyon both original keys still returns the stored turn (userPROOF-LEGACY reply exactly: PROOF-LEGACY, assistantPROOF-LEGACY). Existing transcripts load under their original keys; they are not silently merged into the bare-id session.