Skip to content

Open-source Grok Bot alternative for named AI teammates. Local-first desktop, web, and mobile clients with per-bot tools, instructions, and memory. Independent fork of T3 Code.

fix(orchestration): do not revive idle tasks from status-free progress (#7172)

Maslin Edwin82b8a9380298
diff --git a/apps/server/src/orchestration/ThreadBackgroundLiveness.test.ts b/apps/server/src/orchestration/ThreadBackgroundLiveness.test.ts
index 0c4841e81..4a4b68ced 100644
--- a/apps/server/src/orchestration/ThreadBackgroundLiveness.test.ts
+++ b/apps/server/src/orchestration/ThreadBackgroundLiveness.test.ts
@@ -2,6 +2,32 @@ import { describe, expect, it } from "vite-plus/test";
import * as ThreadBackgroundLiveness from "./ThreadBackgroundLiveness.ts";
describe("ThreadBackgroundLiveness", () => {
+ it("does not let status-free progress restart an idle task", () => {
+ const liveness = ThreadBackgroundLiveness.make();
+ liveness.recordTaskLiveness({
+ threadId: "thread",
+ taskId: "task",
+ taskType: undefined,
+ status: undefined,
+ kind: "started",
+ });
+ liveness.recordTaskLiveness({
+ threadId: "thread",
+ taskId: "task",
+ taskType: undefined,
+ status: "idle",
+ kind: "updated",
+ });
+ liveness.recordTaskLiveness({
+ threadId: "thread",
+ taskId: "task",
+ taskType: undefined,
+ status: undefined,
+ kind: "progress",
+ });
+ expect(liveness.getThreadBackgroundLiveness("thread")).toBeNull();
+ });
+
it("agents present as working; monitors as monitoring; agents win", () => {
const liveness = ThreadBackgroundLiveness.make();
const threadId = "t-live-1";
diff --git a/apps/server/src/orchestration/ThreadBackgroundLiveness.ts b/apps/server/src/orchestration/ThreadBackgroundLiveness.ts
index 8563e7665..d4d6da06d 100644
--- a/apps/server/src/orchestration/ThreadBackgroundLiveness.ts
+++ b/apps/server/src/orchestration/ThreadBackgroundLiveness.ts
@@ -130,6 +130,19 @@ export function make(): ThreadBackgroundLivenessService["Service"] {
return;
}
+ // Status-free progress is a description tick, not a restart. A delayed
+ // progress event after idle must not put the task back in the live set
+ // (#7128).
+ if (input.kind === "progress" && input.status === undefined) {
+ const existing = stateByThreadId.get(input.threadId);
+ const stillLive =
+ existing !== undefined &&
+ (existing.agents.has(input.taskId) || existing.monitors.has(input.taskId));
+ if (!stillLive) {
+ return;
+ }
+ }
+
drop(input.threadId, input.taskId);
const state = stateFor(input.threadId);
const bucket =