Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(server): a watched PR stops holding its thread once its checks finish #33214

Mergedjuliusmarmingemerged 12 commits intomain fromrefs/pull/33214/headmerged by juliusmarminge View on GitHub

Showing 15 changed files with 118 additions and 1 deletion (loading 13).

x
0 of 15 viewed, 15 left
56 additions and 1 deletionapps/server/src/orchestration-v2/Orchestrator.tsModified
View file
@@ -631,6 +631,7 @@
case "thread.pull-request-link.sync":
case "thread.pull-request.watch":
case "thread.pull-request-watch.sync":
+ case "thread.pull-request-watch.checks-reopen":
case "thread.pull-request.sync":
case "thread.title.regeneration.complete":
case "thread.project.adopt-folder":
@@ -782,6 +783,26 @@
return ended === undefined ? rest : { ...rest, endedWatch: ended };
​
+function syncedPullRequestWatch(
+ existing: ThreadPullRequestWatch | undefined,
+ command: {
+ readonly watch: ThreadPullRequestWatch | null;
+ readonly checksPendingBefore?: boolean | undefined;
+ },
+): ThreadPullRequestWatch | undefined {
+ if (command.watch === null) return undefined;
+ // A push cleared the answer while this read was in flight, so its answer is the old head's.
+ if (command.checksPendingBefore === undefined || existing?.checksPending !== undefined) {
+ return command.watch;
+ }
+ return withoutChecksAnswer(command.watch);
+}
+​
+const withoutChecksAnswer = ({
+ checksPending: _answer,