Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(server): held queues release agent and scheduled messages once the thread completes a run #27221

Mergedjuliusmarmingemerged 1 commit intomain fromrefs/pull/27221/headmerged by juliusmarminge View on GitHub

Showing 4 changed files with 89 additions and 13 deletions (loading 1).

x
0 of 4 viewed, 4 left
73 additions and 13 deletionsapps/server/src/orchestration-v2/Orchestrator.tsModified
View file
@@ -741,6 +741,20 @@
​
+/** Failed worktree setup keeps the queue held so queued messages cannot start in the project checkout. */
+function worktreeSetupPending(
+ projection: Pick<OrchestrationV2ThreadProjection, "thread" | "runs">,
+): boolean {
+ return (
+ projection.thread.worktreePath === null &&
+ projection.runs.some(
+ (run) =>
+ (run.status === "failed" || run.status === "interrupted") &&
+ run.workspacePreparation?.type === "worktree",
+ )
+ );
+}
+​
function nextQueuedRun(
projection: Pick<OrchestrationV2ThreadProjection, "runs" | "messages">,
): OrchestrationV2Run | undefined {
@@ -2195,6 +2209,52 @@
+ // A hold waits for a person to review what they queued. Nobody reviews messages from agents,
+ // the server or scheduled tasks, so a later completed run releases those unless it was stopped.
+ const releaseUnattendedHolds = Effect.fn("Orchestrator.releaseUnattendedHolds")(function* (
+ threadId: ThreadId,