Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(server): discard queued updates when pull request watches end #30894

ClosedOleKristianH(GitHub profile, opens in a new tab)wants to merge 1 commit intomain fromrefs/pull/30894/headopened View on GitHub

Showing 4 changed files with 224 additions and 1 deletion (loading 2).

x
0 of 4 viewed, 4 left
56 additions and 1 deletionapps/server/src/orchestration-v2/Orchestrator.tsModified
View file
@@ -2998,7 +2998,13 @@
threadId: command.threadId,
messageId: command.wake.messageId,
text: command.wake.text,
- notification: command.wake.notification,
+ notification: {
+ ...command.wake.notification,
+ source: {
+ kind: "monitor",
+ pullRequestWatch: { ...key, startedAt: command.startedAt },
+ },
+ },
attachments: [],
dispatchMode: { type: "queue_after_active" },
createdBy: "agent",
@@ -3996,6 +4002,55 @@
})();
+ if (command.type.startsWith("thread.pull-request")) {
Thread on line 4005

This gate only runs for thread.pull-request* commands, which matches the unwatch / merge-via-link.sync / unlink cases in the new tests. The next test in this file is "settling ends every pull request watch" — if settlement (or thread.stop) clears watches without going through a pull-request command, would queued message:pr-watch:* wakes still replay the way they do on main today?

If settlement already ends watches by dispatching thread.pull-request.watch with watching: false, this is fine and the docs are complete. If it mutates watch state some other way, the 115-notice case genesiscz described on a busy thread could still happen when the thread settles rather than when each PR is unwatched. Happy to treat that as follow-up either way; just wanted to check the boundary before this lands next to #21239.

+ const watches = threadPullRequestsOf(updatedThread).filter(
+ (link) =>
+ link.source !== "stack-dismissed" &&
+ link.watch !== undefined &&
+ link.snapshot?.state !== "merged" &&
+ link.snapshot?.state !== "closed",
+ );
+ const ended = threadPullRequestsOf(thread).some(