7777 };
7878
7979 const isCodex = (login) => codexLogins.has(login || '');
80+ const eventPullNumber = Number(
81+ context.payload.pull_request?.number || context.payload.issue?.number || 0,
82+ );
83+ const triggeringReviewId =
84+ context.eventName === 'pull_request_review' &&
85+ isCodex(context.payload.review?.user?.login)
86+ ? Number(context.payload.review.id)
87+ : null;
88+ const triggeringIssueCommentId =
89+ context.eventName === 'issue_comment' &&
90+ isCodex(context.payload.comment?.user?.login)
91+ ? Number(context.payload.comment.id)
92+ : null;
8093
8194 function normalizeState(value) {
8295 if (!value || typeof value !== 'object') return { ...emptyState };
@@ -267,7 +280,12 @@ jobs:
267280 if (!isCodex(review.user?.login)) continue;
268281 if (review.commit_id !== pull.head.sha) continue;
269282 const submittedAt = asDate(review.submitted_at);
270- if (!submittedAt || submittedAt < startedAt) continue;
283+ const isTriggeringReview =
284+ eventPullNumber === pull.number &&
285+ triggeringReviewId === Number(review.id);
286+ if (!submittedAt || (!isTriggeringReview && submittedAt < startedAt)) {
287+ continue;
288+ }
271289 const findingCount = commentsByReview.get(Number(review.id)) || 0;
272290 if (findingCount > 0) {
273291 terminal.push({
@@ -313,7 +331,12 @@ jobs:
313331 }
314332 if (reviewedSha !== pull.head.sha) continue;
315333 const createdAt = asDate(comment.created_at);
316- if (!createdAt || createdAt < startedAt) continue;
334+ const isTriggeringComment =
335+ eventPullNumber === pull.number &&
336+ triggeringIssueCommentId === Number(comment.id);
337+ if (!createdAt || (!isTriggeringComment && createdAt < startedAt)) {
338+ continue;
339+ }
317340 terminal.push({ at: createdAt, kind: 'approve', findingCount: 0 });
318341 }
319342
@@ -327,7 +350,10 @@ jobs:
327350 if (!isCodex(comment.user?.login)) return false;
328351 if (!String(comment.body || '').includes(quotaText)) return false;
329352 const createdAt = asDate(comment.created_at);
330- return createdAt && createdAt >= floor;
353+ const isTriggeringComment =
354+ eventPullNumber === pull.number &&
355+ triggeringIssueCommentId === Number(comment.id);
356+ return createdAt && (isTriggeringComment || createdAt >= floor);
331357 })
332358 .map((comment) => ({
333359 at: asDate(comment.created_at),
0 commit comments