fix(feishu): avoid DM parent binding fallback

This commit is contained in:
Tak Hoffman
2026-03-15 00:09:37 -05:00
parent e9939be6ba
commit d5336973fe
2 changed files with 25 additions and 1 deletions

View File

@@ -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,
});
});
});

View File

@@ -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) ??