GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — fix(server): PR watch wakes call an edited comment edited, not new · pingdotgg/t3code@9dcd148

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • apps/server/src/orchestration-v2
    • pullRequestWatch.test.ts
    • pullRequestWatch.ts
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎apps/server/src/orchestration-v2/pullRequestWatch.test.ts‎

Copy file name to clipboardExpand all lines: apps/server/src/orchestration-v2/pullRequestWatch.test.ts
+21-6Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -273,15 +273,30 @@ describe("evaluatePullRequestWatch", () => {
273273
assert.deepEqual(evaluatePullRequestWatch(watching, detail(), [old]).changes, []);
274274
const edited = { ...old, editedAt: "2026-10-02T12:06:00Z" };
275275
const report = evaluatePullRequestWatch(watching, detail(), [edited]);
276-
assert.deepEqual(report.changes, [{ kind: "remarks", remarks: [edited] }]);
276+
assert.deepEqual(report.changes, [{ kind: "edits", remarks: [edited] }]);
277277
assert.equal(report.next.remarksThrough, edited.editedAt);
278278
assert.deepEqual(report.next.remarkIds, [old.id]);
279279
assert.isTrue(report.exhausted);
280+
const { text, notification } = pullRequestWatchMessage({
281+
number: 1,
282+
url: "https://github.com/o/r/pull/1",
283+
baseBranch: "main",
284+
headSha: null,
285+
report,
286+
});
287+
assert.include(text, "- 1 edited comment:");
288+
assert.notInclude(text, "new comment");
289+
assert.equal(notification.summary, "#1: edited comments, stopped watching");
280290
assert.deepEqual(evaluatePullRequestWatch(report.next, detail(), [edited]).changes, []);
281291
const late = { ...edited, id: "late" };
282-
assert.deepEqual(evaluatePullRequestWatch(report.next, detail(), [edited, late]).changes, [
283-
{ kind: "remarks", remarks: [late] },
284-
]);
292+
const added = { ...remark("bot", "2026-10-02T12:07:00Z"), editedAt: "2026-10-02T12:08:00Z" };
293+
assert.deepEqual(
294+
evaluatePullRequestWatch(report.next, detail(), [edited, late, added]).changes,
295+
[
296+
{ kind: "remarks", remarks: [added] },
297+
{ kind: "edits", remarks: [late] },
298+
],
299+
);
285300
});
286301

287302
it("wakes once per edit of a remark seen at the watermark, never for the agent's own", () => {
@@ -295,12 +310,12 @@ describe("evaluatePullRequestWatch", () => {
295310
assert.deepEqual(evaluatePullRequestWatch(watching, detail(), [seen]).changes, []);
296311
const edited = { ...seen, editedAt: "2026-10-10T20:04:50.000Z" };
297312
const first = evaluatePullRequestWatch(watching, detail(), [edited]);
298-
assert.deepEqual(first.changes, [{ kind: "remarks", remarks: [edited] }]);
313+
assert.deepEqual(first.changes, [{ kind: "edits", remarks: [edited] }]);
299314
assert.strictEqual(first.next.remarksThrough, edited.editedAt);
300315
assert.deepEqual(evaluatePullRequestWatch(first.next, detail(), [edited]).changes, []);
301316
const again = { ...seen, editedAt: "2026-10-10T20:05:50.000Z" };
302317
const second = evaluatePullRequestWatch(first.next, detail(), [again]);
303-
assert.deepEqual(second.changes, [{ kind: "remarks", remarks: [again] }]);
318+
assert.deepEqual(second.changes, [{ kind: "edits", remarks: [again] }]);
304319
assert.deepEqual(evaluatePullRequestWatch(second.next, detail(), [again]).changes, []);
305320
const own = { ...edited, author: { login: "agent-user", name: null, avatarUrl: null } };
306321
assert.deepEqual(evaluatePullRequestWatch(watching, detail(), [own]).changes, []);
Collapse file

‎apps/server/src/orchestration-v2/pullRequestWatch.ts‎

Copy file name to clipboardExpand all lines: apps/server/src/orchestration-v2/pullRequestWatch.ts
+19-10Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ export type PullRequestWatchChange =
1818
| { readonly kind: "checks-failed"; readonly failed: ReadonlyArray<PullRequestCheck> }
1919
| { readonly kind: "checks-passed"; readonly count: number; readonly required: boolean }
2020
| { readonly kind: "remarks"; readonly remarks: ReadonlyArray<PullRequestComment> }
21+
| { readonly kind: "edits"; readonly remarks: ReadonlyArray<PullRequestComment> }
2122
| { readonly kind: "no-checks"; readonly minutes: number }
2223
| { readonly kind: "conflicting" };
2324

@@ -111,14 +112,18 @@ export function evaluatePullRequestWatch(
111112
const through = Date.parse(watch.remarksThrough);
112113
const activeAt = (remark: PullRequestComment) => remark.editedAt ?? remark.createdAt;
113114
// Hosts can stamp remarks to the second, so remarks at the boundary time are told apart by ID.
114-
const fresh = (remarks ?? []).filter((remark) => {
115-
const at = Date.parse(activeAt(remark));
116-
return (
117-
(at > through || (at === through && !watch.remarkIds.includes(remark.id))) &&
118-
remark.author?.login.toLowerCase() !== own
119-
);
120-
});
121-
if (fresh.length > 0) changes.push({ kind: "remarks", remarks: fresh });
115+
const past = (at: string, id: string) => {
116+
const time = Date.parse(at);
117+
return time < through || (time === through && watch.remarkIds.includes(id));
118+
};
119+
const fresh = (remarks ?? []).filter(
120+
(remark) => !past(activeAt(remark), remark.id) && remark.author?.login.toLowerCase() !== own,
121+
);
122+
// A remark that already existed at the watermark is news only as an edit, not a new comment.
123+
const edits = fresh.filter((remark) => past(remark.createdAt, remark.id));
124+
const added = fresh.filter((remark) => !edits.includes(remark));
125+
if (added.length > 0) changes.push({ kind: "remarks", remarks: added });
126+
if (edits.length > 0) changes.push({ kind: "edits", remarks: edits });
122127
const latest = Math.max(through, ...fresh.map((remark) => Date.parse(activeAt(remark))));
123128
const atLatest = fresh.filter((remark) => Date.parse(activeAt(remark)) === latest);
124129
const remarksThrough = latest === through ? watch.remarksThrough : activeAt(atLatest[0]!);
@@ -136,7 +141,9 @@ export function evaluatePullRequestWatch(
136141
const conflicting =
137142
detail.mergeability === "unknown" ? toldConflict : detail.mergeability === "conflicting";
138143

139-
const commentsOnly = changes.length > 0 && changes.every((change) => change.kind === "remarks");
144+
const commentsOnly =
145+
changes.length > 0 &&
146+
changes.every((change) => change.kind === "remarks" || change.kind === "edits");
140147
const progress = headMoved || (changes.length > 0 && !commentsOnly);
141148
const wakes = (progress ? 0 : watch.wakes) + (commentsOnly ? 1 : 0);
142149
return {
@@ -195,8 +202,9 @@ function changeLines(
195202
`- All ${change.count} ${change.required ? "required " : ""}${change.count === 1 ? "check" : "checks"} passed${context.commit}.`,
196203
];
197204
case "remarks":
205+
case "edits":
198206
return [
199-
`- ${change.remarks.length} new ${change.remarks.length === 1 ? "comment" : "comments"}:`,
207+
`- ${change.remarks.length} ${change.kind === "remarks" ? "new" : "edited"} ${change.remarks.length === 1 ? "comment" : "comments"}:`,
200208
...listed(change.remarks, (remark) => {
201209
const where = remark.path === null ? "" : ` on ${remark.path}`;
202210
const body = snippet(remark.body);
@@ -217,6 +225,7 @@ const SUMMARY: Record<PullRequestWatchChange["kind"], string> = {
217225
"checks-failed": "checks failed",
218226
"checks-passed": "checks passed",
219227
remarks: "new comments",
228+
edits: "edited comments",
220229
"no-checks": "no checks reported",
221230
conflicting: "merge conflict",
222231
};

0 commit comments

Comments
0 (0)
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.