fix(regression): preserve feishu pairing account context

This commit is contained in:
Tak Hoffman
2026-03-27 23:11:41 -05:00
parent efef319496
commit 2aa09230c2
2 changed files with 41 additions and 1 deletions

View File

@@ -144,6 +144,45 @@ describe("feishuPlugin.status.probeAccount", () => {
});
});
describe("feishuPlugin.pairing.notifyApproval", () => {
beforeEach(async () => {
vi.resetModules();
({ feishuPlugin } = await import("./channel.js"));
sendMessageFeishuMock.mockReset();
sendMessageFeishuMock.mockResolvedValue({ messageId: "pairing-msg", chatId: "ou_user" });
});
it("preserves accountId when sending pairing approvals", async () => {
const cfg = {
channels: {
feishu: {
accounts: {
work: {
appId: "cli_work",
appSecret: "secret_work",
enabled: true,
},
},
},
},
} as OpenClawConfig;
await feishuPlugin.pairing?.notifyApproval?.({
cfg,
id: "ou_user",
accountId: "work",
});
expect(sendMessageFeishuMock).toHaveBeenCalledWith(
expect.objectContaining({
cfg,
to: "ou_user",
accountId: "work",
}),
);
});
});
describe("feishuPlugin actions", () => {
const cfg = {
channels: {

View File

@@ -1161,12 +1161,13 @@ export const feishuPlugin: ChannelPlugin<ResolvedFeishuAccount, FeishuProbeResul
idLabel: "feishuUserId",
message: PAIRING_APPROVED_MESSAGE,
normalizeAllowEntry: createPairingPrefixStripper(/^(feishu|user|open_id):/i),
notify: async ({ cfg, id, message }) => {
notify: async ({ cfg, id, message, accountId }) => {
const { sendMessageFeishu } = await loadFeishuChannelRuntime();
await sendMessageFeishu({
cfg,
to: id,
text: message,
accountId,
});
},
},