Skip to content

Commit 07bedb9

Browse files
seunghwanlycodex
andcommitted
이슈 코멘트 자기 깨움 회귀 테스트 추가
Co-authored-by: OpenAI Codex <codex@openai.com>
1 parent 5855fad commit 07bedb9

1 file changed

Lines changed: 64 additions & 1 deletion

File tree

server/src/__tests__/issue-update-comment-wakeup-routes.test.ts

Lines changed: 64 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ function registerModuleMocks() {
104104
}));
105105
}
106106

107-
async function createApp() {
107+
async function createApp(actorOverrides: Record<string, unknown> = {}) {
108108
const [{ errorHandler }, { issueRoutes }] = await Promise.all([
109109
vi.importActual<typeof import("../middleware/index.js")>("../middleware/index.js"),
110110
vi.importActual<typeof import("../routes/issues.js")>("../routes/issues.js"),
@@ -118,6 +118,7 @@ async function createApp() {
118118
companyIds: ["company-1"],
119119
source: "local_implicit",
120120
isInstanceAdmin: false,
121+
...actorOverrides,
121122
};
122123
next();
123124
});
@@ -252,4 +253,66 @@ describe("issue update comment wakeups", () => {
252253
}),
253254
);
254255
});
256+
257+
it("does not self-wake on issue updates when a local implicit run comments on its own task", async () => {
258+
const runId = "run-self-comment";
259+
const existing = makeIssue({
260+
assigneeAgentId: ASSIGNEE_AGENT_ID,
261+
assigneeUserId: null,
262+
status: "in_progress",
263+
executionRunId: runId,
264+
});
265+
const updated = {
266+
...existing,
267+
status: "done",
268+
executionRunId: null,
269+
checkoutRunId: null,
270+
executionAgentNameKey: null,
271+
executionLockedAt: null,
272+
};
273+
mockIssueService.getById.mockResolvedValue(existing);
274+
mockIssueService.update.mockResolvedValue(updated);
275+
mockIssueService.addComment.mockResolvedValue({
276+
id: "comment-3",
277+
issueId: existing.id,
278+
companyId: existing.companyId,
279+
body: "wrapped",
280+
});
281+
282+
const res = await request(await createApp({ runId }))
283+
.patch(`/api/issues/${existing.id}`)
284+
.send({
285+
status: "done",
286+
comment: "wrapped",
287+
});
288+
289+
expect(res.status).toBe(200);
290+
expect(mockHeartbeatService.wakeup).not.toHaveBeenCalled();
291+
});
292+
293+
it("does not self-wake on direct comments when a local implicit run comments on its own task", async () => {
294+
const runId = "run-self-comment-direct";
295+
const existing = makeIssue({
296+
assigneeAgentId: ASSIGNEE_AGENT_ID,
297+
assigneeUserId: null,
298+
status: "in_progress",
299+
executionRunId: runId,
300+
});
301+
mockIssueService.getById.mockResolvedValue(existing);
302+
mockIssueService.addComment.mockResolvedValue({
303+
id: "comment-4",
304+
issueId: existing.id,
305+
companyId: existing.companyId,
306+
body: "still working",
307+
});
308+
309+
const res = await request(await createApp({ runId }))
310+
.post(`/api/issues/${existing.id}/comments`)
311+
.send({
312+
body: "still working",
313+
});
314+
315+
expect(res.status).toBe(201);
316+
expect(mockHeartbeatService.wakeup).not.toHaveBeenCalled();
317+
});
255318
});

0 commit comments

Comments
 (0)