fix: scope history injection to pending-only

This commit is contained in:
Peter Steinberger
2026-01-16 23:52:14 +00:00
parent 56ed5cc2d9
commit e31251293b
21 changed files with 278 additions and 175 deletions

View File

@@ -264,7 +264,7 @@ describe("monitorSlackProvider tool results", () => {
expect(sendMock.mock.calls[1][1]).toBe("final reply");
});
it("wraps room history in Body and preserves RawBody", async () => {
it("preserves RawBody without injecting processed room history", async () => {
config = {
messages: { ackReactionScope: "group-mentions" },
channels: {
@@ -320,9 +320,9 @@ describe("monitorSlackProvider tool results", () => {
await run;
expect(replyMock).toHaveBeenCalledTimes(2);
expect(capturedCtx.Body).toContain(HISTORY_CONTEXT_MARKER);
expect(capturedCtx.Body).toContain(CURRENT_MESSAGE_MARKER);
expect(capturedCtx.Body).toContain("first");
expect(capturedCtx.Body).not.toContain(HISTORY_CONTEXT_MARKER);
expect(capturedCtx.Body).not.toContain(CURRENT_MESSAGE_MARKER);
expect(capturedCtx.Body).not.toContain("first");
expect(capturedCtx.RawBody).toBe("second");
expect(capturedCtx.CommandBody).toBe("second");
});
@@ -334,7 +334,7 @@ describe("monitorSlackProvider tool results", () => {
slack: {
historyLimit: 5,
dm: { enabled: true, policy: "open", allowFrom: ["*"] },
channels: { C1: { allow: true, requireMention: false } },
channels: { C1: { allow: true, requireMention: true } },
},
},
};
@@ -372,7 +372,7 @@ describe("monitorSlackProvider tool results", () => {
event: {
type: "message",
user: "U1",
text: "thread-a-two",
text: "<@bot-user> thread-a-two",
ts: "201",
thread_ts: "100",
channel: "C1",
@@ -384,7 +384,7 @@ describe("monitorSlackProvider tool results", () => {
event: {
type: "message",
user: "U2",
text: "thread-b-one",
text: "<@bot-user> thread-b-one",
ts: "301",
thread_ts: "300",
channel: "C1",
@@ -396,10 +396,10 @@ describe("monitorSlackProvider tool results", () => {
controller.abort();
await run;
expect(replyMock).toHaveBeenCalledTimes(3);
expect(capturedCtx[1]?.Body).toContain("thread-a-one");
expect(capturedCtx[2]?.Body).not.toContain("thread-a-one");
expect(capturedCtx[2]?.Body).not.toContain("thread-a-two");
expect(replyMock).toHaveBeenCalledTimes(2);
expect(capturedCtx[0]?.Body).toContain("thread-a-one");
expect(capturedCtx[1]?.Body).not.toContain("thread-a-one");
expect(capturedCtx[1]?.Body).not.toContain("thread-a-two");
});
it("updates assistant thread status when replies start", async () => {