Limit session reset to assignment wakes only
This commit is contained in:
@@ -93,22 +93,22 @@ describe("shouldResetTaskSessionForWake", () => {
|
|||||||
expect(shouldResetTaskSessionForWake({ wakeReason: "issue_assigned" })).toBe(true);
|
expect(shouldResetTaskSessionForWake({ wakeReason: "issue_assigned" })).toBe(true);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("resets session context on mention wake comment", () => {
|
it("does not reset session context on mention wake comment", () => {
|
||||||
expect(
|
expect(
|
||||||
shouldResetTaskSessionForWake({
|
shouldResetTaskSessionForWake({
|
||||||
wakeReason: "issue_comment_mentioned",
|
wakeReason: "issue_comment_mentioned",
|
||||||
wakeCommentId: "comment-1",
|
wakeCommentId: "comment-1",
|
||||||
}),
|
}),
|
||||||
).toBe(true);
|
).toBe(false);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("resets session context when commentId is present", () => {
|
it("does not reset session context when commentId is present", () => {
|
||||||
expect(
|
expect(
|
||||||
shouldResetTaskSessionForWake({
|
shouldResetTaskSessionForWake({
|
||||||
wakeReason: "issue_commented",
|
wakeReason: "issue_commented",
|
||||||
commentId: "comment-2",
|
commentId: "comment-2",
|
||||||
}),
|
}),
|
||||||
).toBe(true);
|
).toBe(false);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("does not reset for comment wakes", () => {
|
it("does not reset for comment wakes", () => {
|
||||||
|
|||||||
@@ -199,11 +199,7 @@ export function shouldResetTaskSessionForWake(
|
|||||||
contextSnapshot: Record<string, unknown> | null | undefined,
|
contextSnapshot: Record<string, unknown> | null | undefined,
|
||||||
) {
|
) {
|
||||||
const wakeReason = readNonEmptyString(contextSnapshot?.wakeReason);
|
const wakeReason = readNonEmptyString(contextSnapshot?.wakeReason);
|
||||||
if (wakeReason === "issue_assigned") return true;
|
return wakeReason === "issue_assigned";
|
||||||
const wakeCommentId =
|
|
||||||
readNonEmptyString(contextSnapshot?.wakeCommentId) ??
|
|
||||||
readNonEmptyString(contextSnapshot?.commentId);
|
|
||||||
return wakeCommentId != null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function deriveCommentId(
|
function deriveCommentId(
|
||||||
|
|||||||
Reference in New Issue
Block a user