fix(msteams): normalize inbound mentions and forwards#102379
fix(msteams): normalize inbound mentions and forwards#102379galiniliev wants to merge 9 commits into
Conversation
|
Codex review: needs real behavior proof before merge. Reviewed July 25, 2026, 8:09 PM ET / July 26, 2026, 00:09 UTC. ClawSweeper reviewWhat this changesThis PR adds Microsoft Teams inbound normalization for mentions, quoted replies, forwarded content, and debounced message batches before agent dispatch. Merge readiness⛔ Blocked until real behavior proof from a real setup is added - 6 items remain The repository inspection sandbox could not start, so I cannot responsibly make a code verdict from the supplied PR context alone. Priority: P2 Review scores
Verification
How this fits togetherThe Microsoft Teams plugin turns Bot Framework activities into agent turns. Incoming activity text, entities, and HTML attachments are normalized and filtered before dispatch to the agent and supplemental quote context. flowchart LR
A[Teams activity] --> B[Teams inbound handler]
B --> C[Text and quote normalization]
C --> D[Debounce and thread scoping]
D --> E[Authorization and quote visibility]
E --> F[Agent dispatch]
Decision needed
Why: The supplied proof confirms test fixtures and aggregate path activity but explicitly lacks a current-head live Teams capture; the correct merge gate depends on maintainer acceptance of that evidence threshold. Before merge
Findings
Agent review detailsSecurityNeeds attention: No concrete security defect is established, but the required supply-chain and security diff inspection could not be completed because repository reads were unavailable. PR surfaceSource +253, Tests +808. Total +1061 across 4 files. View PR surface stats
Review metricsNone. Merge-risk options
Maintainer options:
Technical reviewBest possible solution: Restore repository read access, then review the PR head against current main; before merge, add redacted current-head Teams tenant evidence that directly shows normalized mention, quote, and forwarded-message output. Do we have a high-confidence way to reproduce the issue? No: the supplied context provides fixture-shaped cases and aggregate telemetry, but I could not inspect or run a current-main path because the repository inspection sandbox failed before any source read. Is this the best way to solve the issue? Unclear: keeping normalization in the Teams plugin appears directionally appropriate from the supplied discussion, but I could not inspect current source, callers, or the Bot Framework dependency contract to judge the current patch as the best fix. AGENTS.md: unclear because the file could not be read completely. Codex review notes: model internal, reasoning high; reviewed against 93a0fdb9b800. LabelsLabel justifications:
EvidenceSecurity concerns:
What I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (11 earlier review cycles; latest 8 shown)
|
ba32bdd to
154ed0f
Compare
|
@clawsweeper recheck |
|
🦞👀 I queued a lightweight read-only assist pass. It will post a separate answer comment and will not edit the durable ClawSweeper review comment or trigger close, merge, repair, label, or branch changes. Request: recheck |
|
ClawSweeper assist: New exact-head behavior evidence is present, but confirming whether it resolves the prior concerns requires a full correctness review. Evidence:
Suggested next action: Comment Source: #102379 (comment) |
|
@clawsweeper review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
Codex maintainer review: changes needed before merge. The PR moves Microsoft Teams inbound mention, quoted-reply, and forward normalization into the Teams plugin, which is the right owner boundary for BUG-052 / #102376. The direct no-debounce behavior is covered by the new focused tests and Azure Crabbox proof, but the batched Teams path still drops the new quote facts. LOC: +565/-17 (4 files) Findings:
Best-fix verdict: acceptable boundary, too narrow implementation. Teams-owned normalization is the right layer; the missing piece is carrying the newly parsed metadata through the existing Teams debounce lifecycle. Alternatives considered: changing the shared debouncer is unnecessary because it already passes every buffered entry to Provenance: likely introduced by this PR's new Code read: Remaining uncertainty: I did not run a live Teams tenant replay. Existing Azure proof covers sanitized direct dispatch fixtures and type lanes, but not this nonzero-debounce scenario. |
154ed0f to
eedd5a3
Compare
|
@clawsweeper review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
eedd5a3 to
97da41c
Compare
97da41c to
516e68a
Compare
|
Maintainer review for current head This PR fixes Teams inbound text normalization for mention tags, Findings:
Best-fix verdict: acceptable layer, but too narrow until current-turn quotedReply authorization keeps the entity sender authoritative over unrelated thread-parent context. Alternatives considered: moving this to core supplemental filtering would be the wrong layer because core only receives Code read: Remaining uncertainty: I did not run a live Teams tenant replay. Current PR CI is still running; |
ddb88f1 to
88316f5
Compare
Closes #102376
What Problem This Solves
Fixes an issue where Microsoft Teams users would send mentions, quoted replies, or forwarded messages and the agent would receive incomplete or misleading text. Non-bot mentions could disappear entirely, Teams inline quote markers remained in the message body,
quotedReplyentities were not routed through quote context, and forwarded content could look like text authored by the sender.Why This Change Was Made
This adds a Teams-owned inbound normalizer before monitor dispatch. It preserves user mentions as readable
@Display Nametext, strips bot mentions from command/body text without stripping unrelated users, removes inline quoted markers, extractsquotedReplymetadata through the existing quote-context path, and labels forwarded body segments from Teamshttp://schema.skype.com/ForwardHTML blockquotes.Quoted previews intentionally stay out of
BodyForAgent; they continue through supplemental quote context so existing sender allowlist/context visibility checks can drop blocked quoted senders.User Impact
Teams channel agents now see more faithful message text for common Teams-native input shapes. Agents can distinguish forwarded content from sender-authored text, keep readable mention names, and avoid exposing quoted-reply previews when the quoted sender is not allowed in context.
Evidence
Current PR head after maintainer-review fixes:
Real behavior proof from production telemetry
Sanitized aggregate proof was derived from BUG-052 production telemetry collected on 2026-07-11. The raw telemetry artifact contains internal cluster/database names and account/chat/user dimensions; those identifiers were intentionally omitted here.
Raw telemetry evidence bundle retained in the BUG-052 local evidence folder, with public PR details redacted:
Telemetry caveat: production logs intentionally do not include message text,
entities[], mention tags,quotedReplypayloads, or forwarded blockquote HTML. Fresh negative telemetry proof found zero hits across 12,144,198 container-adapter rows in 24h forquotedReply,schema.skype.com,<at>,wasMentioned,monitor-handler,messageHandler,stripMSTeamsMentionTags, orForward. Production telemetry proves the affected Teams inbound path is live at production scale; exact mention-vs-quote-vs-forward content-shape counts remain covered by sanitized Teams-shaped fixtures.Current-head verification
Autoreview after the maintainer-review fixes:
$ /tmp/autoreview-openclaw-bug052 --mode local autoreview clean: no accepted/actionable findings reported overall: patch is correct (0.92)Autoreview note:
/tmp/autoreview-openclaw-bug052was a temporary copy of the repo autoreview helper with only the local Codex config isolation adjusted so the reviewer could use the local TOML auth/provider. The repository helper was not changed and no helper change was committed.Remote proof gap on the current head:
A prior Azure Crabbox run proved the original PR head
154ed0faf5473be7f46f62840726c7bab8a903ea, but that is superseded by the rebased head above. Current-head remote proof is blocked until the Crabbox binary is upgraded to>=0.22.0or an Azure/Blacksmith lane is supplied outside this wrapper.Real behavior proof summary
quotedReplymetadata from earlier entries, retainquotedReply.messageId, do not authorize an earlier quote using a later message's channel-thread parent, and do not debounce messages across separate Teams channel thread/root scopes.messageactivities over 7 days, 737 native inbound Teams turns over 14 days, 42 users, 95 chats, 42 agents, 3 production islands, and recent daily message counts above 200/day. Current-head terminal proof shows the patched normalizer/debounce behavior passes focused Teams regression coverage and extension TS lanes.quotedReplysupplemental context, blocked quoted sender filtering, forwarded-body labeling, debounced quote preservation, blocked debounced quote filtering with an allowed later thread parent, cross-thread quote isolation, and separate channel root-post debounce scopes.0.12.0binary. Production telemetry confirms the affected path is active, while exact content-shape behavior is proven with sanitized Teams-shaped payloads on the current code.