fix(slack): expose sender bot status in context (#97822)

* fix(slack): expose sender bot status in context

* fix(slack): expose sender bot status in context

---------

Co-authored-by: Vincent Koc <vincentkoc@ieee.org>
This commit is contained in:
Masato Hoshino
2026-06-30 10:29:42 -07:00
committed by GitHub
co-authored by Vincent Koc
parent 37341a7032
commit 5c4e478df4
2 changed files with 21 additions and 0 deletions
@@ -1060,6 +1060,26 @@ Second paragraph should still reach the agent after Slack's preview cutoff.`;
expect(members).toHaveBeenCalledTimes(1);
});
it("forwards bot sender status to ctxPayload when allowBots admits the bot", async () => {
const { slackCtx } = createOwnerScopedBotRoomCtx({ members: ["UOWNER"] });
const prepared = await prepareMessageWith(
slackCtx,
createSlackAccount({ allowBots: true }),
createBotRoomMessage(),
);
assertPrepared(prepared);
expect(prepared.ctxPayload.SenderIsBot).toBe(true);
});
it("omits SenderIsBot for human messages", async () => {
const prepared = await prepareWithDefaultCtx(createSlackMessage({ text: "hello" }));
assertPrepared(prepared);
expect(prepared.ctxPayload.SenderIsBot).toBeUndefined();
});
it("allows bot-authored room messages when the bot is explicitly channel-allowlisted (#59284)", async () => {
const members = vi.fn();
const slackCtx = createInboundSlackCtx({
@@ -1271,6 +1271,7 @@ export async function prepareSlackMessage(params: {
id: senderId,
name: senderName,
displayLabel: senderName,
isBot: isBotMessage || undefined,
},
conversation: {
kind: chatType,