Repository navigation
fix(teams): read the real message behind quotes and message links - #674
Merged
Merged
Conversation
Teams only sends a short preview when someone quotes a message or pastes a message link, so the agent saw "the delivery notice wasn…" and nothing more. Mentions now resolve quoted replies and Teams message links through Graph: the full text, its inline images (attached to the T3 turn), the names of its files, and up to eight earlier messages from that chat or channel thread. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Their weekly log thread already holds the earlier messages and images, so loading them again for a quote only duplicates the log. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When someone in Teams quotes a message or pastes a message link and mentions the bot, Teams only sends a cut-off preview ("…the delivery notice wasn…"). The bot passed that preview to T3 and never saw the real message.
Mentions now resolve those references through Microsoft Graph, using the app token the gateway already has:
What is detected (
teams/referencedMessages.ts):<blockquote itemtype="http://schema.skype.com/Reply" itemid=…>).teams.microsoft.com/teams.cloud.microsoft/l/message/…) in the text or any attachment. This includes link-preview cards.groupIdandparentMessageId.What goes into the T3 turn:
The cut-off preview: once the real message is resolved, the old "Quoted Teams attachment text" preview is dropped.
Wiring:
inboundImages.tsruns this insideloadTeamsTurnImages. Images share its dedupe and caps. The section goes into the turn note with its own 12k cap.Your own text is kept: the mention's text stays the request, with the referenced message added below it as quoted content.
Watched group chats load only the quoted message's text, with no earlier messages and no images, because their weekly log thread already has those (
referencedDetail: "text").Permissions: no new ones. Channels use
ChannelMessage.Read.Group. I checked live that the gateway's credentials can list, get, read replies, and read hosted contents in the Omega Scanner channel (all 200). Chats useChatMessage.Read.Chat, which is in the installed package.Tests:
referencedMessages.test.tscovers link and quote parsing, the chat message with images, files and context, the channel reply-to-root fallback, and an unreadable message. All 126 Teams tests pass, and typecheck is clean.🤖 Generated with Claude Code