diff --git a/DESIGN.md b/DESIGN.md index aa2eba46b29..d092f51a3b7 100644 --- a/DESIGN.md +++ b/DESIGN.md @@ -153,6 +153,8 @@ such as `Waiting for maintenance`, agent setup, or another open task of the same routine, visible during admission. Admission normally starts a run within seconds, so this startup feedback lasts at most 30 seconds: a turn still queued after that with no named hold says `Waiting to start`, without spinner or shimmer. +A queued turn's hold is named once, in the turn header; the turn body adds no +second line for it. A run that waits for one of its agent's concurrency slots is a hold too: show `Waiting for · N slots max · P of Q in line · Configure` (the shared `AgentQueueWait` component) with no spinner or elapsed timer, link Configure to the diff --git a/ui/src/components/TaskChatThread.tsx b/ui/src/components/TaskChatThread.tsx index 4c5286945fe..0e3f04c5abb 100644 --- a/ui/src/components/TaskChatThread.tsx +++ b/ui/src/components/TaskChatThread.tsx @@ -3552,7 +3552,7 @@ export function TaskChatThread(props: TaskChatThreadProps) { items={tailItems} emptyMessage={ tailStatus === "queued" - ? "Waiting to start..." + ? undefined : (liveRun && liveRun.id === tailRunId ? liveRun.currentStatusMessage : null) || diff --git a/ui/src/components/task-chat/TaskChatRunnerTurn.test.tsx b/ui/src/components/task-chat/TaskChatRunnerTurn.test.tsx index 0864dfd42a7..a79889ab350 100644 --- a/ui/src/components/task-chat/TaskChatRunnerTurn.test.tsx +++ b/ui/src/components/task-chat/TaskChatRunnerTurn.test.tsx @@ -99,6 +99,7 @@ describe("TaskChatRunnerTurn", () => { ["agent_setup_failed", "Agent setup needs attention"], ["server_restarting", "Waiting for server restart"], ["previous_run_settling", "Waiting for previous run to stop"], + ["routine_execution_in_progress", "Waiting for PAP-5656 to finish"], ])("shows the server's %s wait while admission is held", (cause, label) => { render([], "queued", "run-1", undefined, false, false, { phase: "queued", label, cause, @@ -107,7 +108,8 @@ describe("TaskChatRunnerTurn", () => { permittedActions: ["inspect_run"], predecessorRunId: null, successorRunId: null, }); expect(container.querySelector('[data-testid="task-chat-turn-status-header"]')?.textContent).toContain(label); - expect(container.querySelector('[data-testid="task-chat-current-activity-label"]')?.textContent).toBe(label); + expect(container.textContent?.split(label)).toHaveLength(2); + expect(container.querySelector('[data-testid="task-chat-current-activity"]')).toBeNull(); expect(container.textContent).not.toContain("Thinking"); }); @@ -123,7 +125,8 @@ describe("TaskChatRunnerTurn", () => { expect(container.textContent).not.toContain("Waiting to start"); act(() => { vi.advanceTimersByTime(2_000); }); expect(container.querySelector('[data-testid="task-chat-turn-status-header"]')?.textContent).toContain("Waiting to start"); - expect(container.querySelector('[data-testid="task-chat-current-activity-label"]')?.textContent).toBe("Waiting to start"); + expect(container.textContent?.split("Waiting to start")).toHaveLength(2); + expect(container.querySelector('[data-testid="task-chat-current-activity"]')).toBeNull(); expect(container.textContent).not.toContain("Working"); } finally { vi.useRealTimers(); diff --git a/ui/src/components/task-chat/TaskChatRunnerTurn.tsx b/ui/src/components/task-chat/TaskChatRunnerTurn.tsx index 3b1b6780087..8fed3a440d0 100644 --- a/ui/src/components/task-chat/TaskChatRunnerTurn.tsx +++ b/ui/src/components/task-chat/TaskChatRunnerTurn.tsx @@ -338,8 +338,7 @@ export function TaskChatRunnerTurn({ /> ) : null} - {/* The header's waiting line already names the agent's queue; no second line. */} - {!final && currentActivityItems.length === 0 && !agentQueueWaitFor({ status, execution }) + {!final && currentActivityItems.length === 0 && !(status === "queued" && runId && (waitingLabel || agentQueueWaitFor({ status, execution }))) ? : null} ); diff --git a/ui/storybook/stories/runs-adapters/agent-queue-wait.stories.tsx b/ui/storybook/stories/runs-adapters/agent-queue-wait.stories.tsx index 1abe417eb4e..23ab7f056e5 100644 --- a/ui/storybook/stories/runs-adapters/agent-queue-wait.stories.tsx +++ b/ui/storybook/stories/runs-adapters/agent-queue-wait.stories.tsx @@ -4,7 +4,7 @@ import { expect, within } from "storybook/test"; import { AgentQueueWait } from "@/components/AgentQueueWait"; import { InboxIssueMetaLeading } from "@/components/IssueColumns"; import { TaskChatLiveRunPill } from "@/components/task-chat/TaskChatLiveRunPill"; -import { TaskChatRunnerHeader } from "@/components/task-chat/TaskChatRunnerTurn"; +import { TaskChatRunnerHeader, TaskChatRunnerTurn } from "@/components/task-chat/TaskChatRunnerTurn"; const codieQueue: ExecutionAgentQueue = { agentId: "8f14e45f-ceea-467a-9575-6f1d0b2c9a01", @@ -117,9 +117,11 @@ export const WaitingToStart: Story = { /** A routine task that waits for the routine's open execution. */ export const WaitingForRoutine: Story = { - render: () => , play: async ({ canvasElement }) => { - await expect(within(canvasElement).getByText(/Waiting for PAP-3093 to finish/)).toBeVisible(); + const holds = within(canvasElement).getAllByText(/Waiting for PAP-3093 to finish/); + await expect(holds).toHaveLength(1); + await expect(holds[0]).toBeVisible(); }, };