diff --git a/apps/web/src/components/chat/BackgroundWorkDetails.tsx b/apps/web/src/components/chat/BackgroundWorkDetails.tsx index 86df01be78f5..27f8d39755be 100644 --- a/apps/web/src/components/chat/BackgroundWorkDetails.tsx +++ b/apps/web/src/components/chat/BackgroundWorkDetails.tsx @@ -4,6 +4,7 @@ import type { ThreadId, } from "@t3tools/contracts"; import type { ThreadStructure } from "@t3tools/client-runtime/state/shell"; +import { isPullRequestWatchTask } from "@t3tools/shared/orchestrationV2PendingBackgroundWork"; import { useState } from "react"; import { InlineButton } from "../ui/button"; @@ -59,7 +60,7 @@ export function BackgroundWorkDetails(props: {

{title}

- {task.awaited ? "Waiting" : "Running"} + {task.awaited || isPullRequestWatchTask(task) ? "Waiting" : "Running"}
{command ? ( diff --git a/packages/client-runtime/src/state/threadExecution.test.ts b/packages/client-runtime/src/state/threadExecution.test.ts index ea6de929b4cb..fe137e1ba602 100644 --- a/packages/client-runtime/src/state/threadExecution.test.ts +++ b/packages/client-runtime/src/state/threadExecution.test.ts @@ -756,4 +756,15 @@ describe("presentPendingBackgroundWork", () => { ]); expect(presentation?.items[0]?.label).toBe("mv a.ts b.ts\ncat > b.ts <<'EOF'\nexport {};\nEOF"); }); + + it("says a pull request watch is waiting after it stops holding the thread", () => { + const presentation = presentPendingBackgroundWork([ + { + taskId: "pull-request-watch:github.com/acme/app#1", + kind: "monitor", + description: "Watching pull request #1", + }, + ]); + expect(presentation?.title).toBe("Waiting ยท Watching pull request #1"); + }); }); diff --git a/packages/client-runtime/src/state/threadExecution.ts b/packages/client-runtime/src/state/threadExecution.ts index 622db98a2903..c6ae36519c75 100644 --- a/packages/client-runtime/src/state/threadExecution.ts +++ b/packages/client-runtime/src/state/threadExecution.ts @@ -26,6 +26,7 @@ import { } from "@t3tools/contracts"; import { backgroundWorkHoldsCompletion, + isPullRequestWatchTask, derivePendingBackgroundWork, } from "@t3tools/shared/orchestrationV2PendingBackgroundWork"; import { @@ -596,7 +597,8 @@ export function presentPendingBackgroundWork( tasks: ReadonlyArray, ): PendingBackgroundWorkPresentation | null { if (tasks.length === 0) return null; - const waiting = backgroundWorkHoldsCompletion(tasks); + // A watch waits on its host even once it stops holding the thread; nothing of it runs. + const waiting = backgroundWorkHoldsCompletion(tasks) || tasks.every(isPullRequestWatchTask); const items = tasks .map((task): PendingBackgroundWorkItem => { const description = task.description?.trim();