mirror of
https://github.com/openclaw/openclaw.git
synced 2026-03-19 14:00:51 +00:00
fix: preserve feishu message_id in agent-visible body (#27253) (thanks @xss925175263)
This commit is contained in:
@@ -382,4 +382,39 @@ describe("handleFeishuMessage command authorization", () => {
|
||||
"clip.mp4",
|
||||
);
|
||||
});
|
||||
|
||||
it("includes message_id in BodyForAgent on its own line", async () => {
|
||||
mockShouldComputeCommandAuthorized.mockReturnValue(false);
|
||||
|
||||
const cfg: ClawdbotConfig = {
|
||||
channels: {
|
||||
feishu: {
|
||||
dmPolicy: "open",
|
||||
},
|
||||
},
|
||||
} as ClawdbotConfig;
|
||||
|
||||
const event: FeishuMessageEvent = {
|
||||
sender: {
|
||||
sender_id: {
|
||||
open_id: "ou-msgid",
|
||||
},
|
||||
},
|
||||
message: {
|
||||
message_id: "msg-message-id-line",
|
||||
chat_id: "oc-dm",
|
||||
chat_type: "p2p",
|
||||
message_type: "text",
|
||||
content: JSON.stringify({ text: "hello" }),
|
||||
},
|
||||
};
|
||||
|
||||
await dispatchMessage({ cfg, event });
|
||||
|
||||
expect(mockFinalizeInboundContext).toHaveBeenCalledWith(
|
||||
expect.objectContaining({
|
||||
BodyForAgent: "[message_id: msg-message-id-line]\nou-msgid: hello",
|
||||
}),
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -841,8 +841,8 @@ export async function handleFeishuMessage(params: {
|
||||
messageBody += `\n\n[System: Your reply will automatically @mention: ${targetNames}. Do not write @xxx yourself.]`;
|
||||
}
|
||||
|
||||
// Include message_id in body so the agent can use it (e.g. for Feishu API media download or reply).
|
||||
messageBody = `[message_id: ${ctx.messageId}] ${messageBody}`;
|
||||
// Keep message_id on its own line so shared message-id hint stripping can parse it reliably.
|
||||
messageBody = `[message_id: ${ctx.messageId}]\n${messageBody}`;
|
||||
|
||||
const envelopeFrom = isGroup ? `${ctx.chatId}:${ctx.senderOpenId}` : ctx.senderOpenId;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user