From d5336973fe8ea571c87773c023db9690c12400dc Mon Sep 17 00:00:00 2001 From: Tak Hoffman <781889+Takhoffman@users.noreply.github.com> Date: Sun, 15 Mar 2026 00:09:37 -0500 Subject: [PATCH] fix(feishu): avoid DM parent binding fallback --- .../reply/commands-acp/context.test.ts | 22 ++++++++++++++++++- src/auto-reply/reply/commands-acp/context.ts | 4 ++++ 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/src/auto-reply/reply/commands-acp/context.test.ts b/src/auto-reply/reply/commands-acp/context.test.ts index 602e18a38f2..35f9e0767d2 100644 --- a/src/auto-reply/reply/commands-acp/context.test.ts +++ b/src/auto-reply/reply/commands-acp/context.test.ts @@ -13,6 +13,7 @@ import { isAcpCommandDiscordChannel, resolveAcpCommandBindingContext, resolveAcpCommandConversationId, + resolveAcpCommandParentConversationId, } from "./context.js"; const baseCfg = { @@ -260,8 +261,27 @@ describe("commands-acp context", () => { accountId: "default", threadId: undefined, conversationId: "ou_sender_1", - parentConversationId: "ou_sender_1", + parentConversationId: undefined, }); expect(resolveAcpCommandConversationId(params)).toBe("ou_sender_1"); }); + + it("does not infer a Feishu DM parent conversation id during fallback binding lookup", () => { + const params = buildCommandTestParams("/acp status", baseCfg, { + Provider: "feishu", + Surface: "feishu", + OriginatingChannel: "feishu", + OriginatingTo: "user:ou_sender_1", + AccountId: "work", + }); + + expect(resolveAcpCommandParentConversationId(params)).toBeUndefined(); + expect(resolveAcpCommandBindingContext(params)).toEqual({ + channel: "feishu", + accountId: "work", + threadId: undefined, + conversationId: "ou_sender_1", + parentConversationId: undefined, + }); + }); }); diff --git a/src/auto-reply/reply/commands-acp/context.ts b/src/auto-reply/reply/commands-acp/context.ts index e5cea65539e..2153a7358a9 100644 --- a/src/auto-reply/reply/commands-acp/context.ts +++ b/src/auto-reply/reply/commands-acp/context.ts @@ -195,6 +195,10 @@ export function resolveAcpCommandParentConversationId( ); } if (channel === "feishu") { + const threadId = resolveAcpCommandThreadId(params); + if (!threadId) { + return undefined; + } return ( parseFeishuTargetId(params.ctx.OriginatingTo) ?? parseFeishuTargetId(params.command.to) ??