Skip to content

Commit 4e3d709

Browse files
mattjcornerclaude
andcommitted
msteams: allow replyStyle config override for direct messages
DM conversations were hardcoded to replyStyle "thread", which reuses the original webhook TurnContext. Bot Framework revokes this proxy after the HTTP handler returns (~15-30s). When agent processing takes longer (LLM inference, tool calls), the final reply hits the revoked proxy and fails silently — the user sees "Let me try..." but never gets the actual response. The "top-level" replyStyle uses adapter.continueConversation() which creates a fresh TurnContext per send with no expiry. This change lets DMs respect the same config cascade (channel → team → global) as group conversations, defaulting to "thread" for backwards compat. Operators hitting proxy-revoked errors in DMs can now set replyStyle: "top-level" in their msteams channel config. Co-Authored-By: Claude Opus 4.6 <[email protected]>
1 parent 9f154ef commit 4e3d709

File tree

2 files changed

+16
-3
lines changed

2 files changed

+16
-3
lines changed

extensions/msteams/src/policy.test.ts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,14 +76,22 @@ describe("msteams policy", () => {
7676
});
7777

7878
describe("resolveMSTeamsReplyPolicy", () => {
79-
it("forces thread replies for direct messages", () => {
79+
it("defaults to thread replies for direct messages", () => {
8080
const policy = resolveMSTeamsReplyPolicy({
8181
isDirectMessage: true,
82-
globalConfig: { replyStyle: "top-level", requireMention: false },
82+
globalConfig: {},
8383
});
8484
expect(policy).toEqual({ requireMention: false, replyStyle: "thread" });
8585
});
8686

87+
it("respects globalConfig replyStyle override for direct messages", () => {
88+
const policy = resolveMSTeamsReplyPolicy({
89+
isDirectMessage: true,
90+
globalConfig: { replyStyle: "top-level", requireMention: false },
91+
});
92+
expect(policy).toEqual({ requireMention: false, replyStyle: "top-level" });
93+
});
94+
8795
it("defaults to requireMention=true and replyStyle=thread", () => {
8896
const policy = resolveMSTeamsReplyPolicy({
8997
isDirectMessage: false,

extensions/msteams/src/policy.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,12 @@ export function resolveMSTeamsReplyPolicy(params: {
221221
channelConfig?: MSTeamsChannelConfig;
222222
}): MSTeamsReplyPolicy {
223223
if (params.isDirectMessage) {
224-
return { requireMention: false, replyStyle: "thread" };
224+
const replyStyle: MSTeamsReplyStyle =
225+
params.channelConfig?.replyStyle ??
226+
params.teamConfig?.replyStyle ??
227+
params.globalConfig?.replyStyle ??
228+
"thread";
229+
return { requireMention: false, replyStyle };
225230
}
226231

227232
const requireMention =

0 commit comments

Comments
 (0)