diff --git a/docs/dashboard-guide.md b/docs/dashboard-guide.md index 7096e024ef..543c7de316 100644 --- a/docs/dashboard-guide.md +++ b/docs/dashboard-guide.md @@ -728,7 +728,7 @@ Recommended workflow: ordinary chains stay as `Blocks N` so noise stays low, hig ### Logs → Agent Log view -The **Chat** tab sits between Definition and Logs and presents a live, chat-styled transcript of task agent output. Consecutive entries are grouped by role and labeled as Planner, Executor, Reviewer, or Merger; legacy log rows without an agent role use the neutral Agent fallback. The transcript follows new live output when you are already near the bottom, but it preserves your scroll position when you review older messages. For active assigned agent sessions in `in-progress` or `in-review` (reviewing/merging/fixing) tasks, the composer sends guidance to the running agent through the same steering path used by comments; when no active session is available, the composer is disabled with an explanatory hint. +The **Chat** tab sits between Definition and Logs and presents a live, chat-styled transcript of task agent output. Consecutive entries are grouped by role and labeled as Planner, Executor, Reviewer, or Merger; legacy log rows without an agent role use the neutral Agent fallback. The transcript follows new live output when you are already near the bottom, but it preserves your scroll position when you review older messages. For active, assigned, non-paused agent sessions in `in-progress` or `in-review` (reviewing/merging/fixing) tasks, the composer sends guidance to the running agent through the same steering path used by comments; when no active session is available, the composer is disabled with an explanatory hint. The **Logs** tab includes an **Agent Log** subview designed for debugging long-running and tool-heavy sessions: diff --git a/packages/dashboard/app/components/TaskChatTab.tsx b/packages/dashboard/app/components/TaskChatTab.tsx index a603cd3752..0800b9977a 100644 --- a/packages/dashboard/app/components/TaskChatTab.tsx +++ b/packages/dashboard/app/components/TaskChatTab.tsx @@ -28,7 +28,14 @@ interface AgentLogGroup { entries: AgentLogEntry[]; } -const ACTIVE_STATUSES = new Set(["planning", "researching", "executing", "finalizing", "merging", "merging-fix"]); +const STEERING_BLOCKED_STATUSES = new Set([ + "paused", + "awaiting-user-input", + "awaiting-cli-approval", + "awaiting-user-review", + "failed", + "needs-replan", +]); const REVIEW_STEERABLE_STATUSES = new Set(["reviewing", "merging", "merging-fix", "fixing"]); const BOTTOM_FOLLOW_THRESHOLD = 48; @@ -81,7 +88,8 @@ function groupEntriesByAgent(entries: AgentLogEntry[]): AgentLogGroup[] { function isActiveAgentSession(task: Task | TaskDetail): boolean { const hasAssignedAgent = Boolean(task.assignedAgentId || task.checkedOutBy); - const statusAllowsProgressSteering = !task.status || ACTIVE_STATUSES.has(task.status); + const statusBlocksProgressSteering = task.status ? STEERING_BLOCKED_STATUSES.has(task.status) : false; + const statusAllowsProgressSteering = !statusBlocksProgressSteering; const statusAllowsReviewSteering = !task.status || REVIEW_STEERABLE_STATUSES.has(task.status); const columnAllowsSteering = (task.column === "in-progress" && statusAllowsProgressSteering) || (task.column === "in-review" && statusAllowsReviewSteering); @@ -253,7 +261,7 @@ export function TaskChatTab({ task, projectId, active, addToast }: TaskChatTabPr
{!activeSession ? (
- No active assigned agent session is available. An active, assigned agent session is required to send guidance. + No active assigned agent session is available. An active, assigned, non-paused agent session is required to send guidance.
) : null}
@@ -261,7 +269,7 @@ export function TaskChatTab({ task, projectId, active, addToast }: TaskChatTabPr ref={textareaRef} className="input task-chat-input" value={draft} - placeholder={activeSession ? "Message the active agent session…" : "Active assigned agent session required"} + placeholder={activeSession ? "Message the active agent session…" : "Active non-paused agent session required"} onChange={(event) => setDraft(event.target.value)} onKeyDown={handleKeyDown} disabled={!activeSession || sending} diff --git a/packages/dashboard/app/components/__tests__/TaskChatTab.test.tsx b/packages/dashboard/app/components/__tests__/TaskChatTab.test.tsx index b9aed513ca..49a8de1031 100644 --- a/packages/dashboard/app/components/__tests__/TaskChatTab.test.tsx +++ b/packages/dashboard/app/components/__tests__/TaskChatTab.test.tsx @@ -29,7 +29,7 @@ function makeTask(overrides: Partial = {}): Task { steps: [], currentStep: 0, assignedAgentId: "agent-1", - status: "executing", + status: undefined, ...overrides, } as Task; } @@ -153,6 +153,61 @@ describe("TaskChatTab", () => { expect(input).toHaveValue(""); }); + it.each([ + ["queued", "Please continue after dispatch"], + [undefined, "Please continue with a cleared status"], + ])("enables in-progress steering for realistic %s status and posts guidance", async (status, message) => { + const user = userEvent.setup(); + mockedAddSteeringComment.mockResolvedValue(makeTask({ status })); + render(); + + expect(screen.queryByText(/No active assigned agent session/)).not.toBeInTheDocument(); + const input = screen.getByLabelText("Message active agent session"); + expect(input).not.toBeDisabled(); + await user.type(input, message); + const sendButton = screen.getByRole("button", { name: "Send" }); + expect(sendButton).not.toBeDisabled(); + await user.click(sendButton); + + await waitFor(() => { + expect(mockedAddSteeringComment).toHaveBeenCalledWith("FN-001", message, "project-1"); + }); + }); + + it.each([undefined, null, "queued", "planning", "merging", "merging-fix"])( + "enables in-progress steering for assigned agents with %s status", + (status) => { + render(); + + expect(screen.queryByText(/No active assigned agent session/)).not.toBeInTheDocument(); + expect(screen.getByLabelText("Message active agent session")).not.toBeDisabled(); + }, + ); + + it("enables in-progress steering with checkedOutBy when no assignedAgentId exists", async () => { + const user = userEvent.setup(); + mockedAddSteeringComment.mockResolvedValue(makeTask({ status: "queued" })); + render( + , + ); + + const input = screen.getByLabelText("Message active agent session"); + expect(input).not.toBeDisabled(); + await user.type(input, "Please keep going"); + const sendButton = screen.getByRole("button", { name: "Send" }); + expect(sendButton).not.toBeDisabled(); + await user.click(sendButton); + + await waitFor(() => { + expect(mockedAddSteeringComment).toHaveBeenCalledWith("FN-001", "Please keep going", "project-1"); + }); + }); + it.each(["reviewing", "merging", "merging-fix", "fixing"])( "enables in-review steering while %s with an assigned agent", async (status) => { @@ -198,21 +253,37 @@ describe("TaskChatTab", () => { }); it.each([ - ["todo task", makeTask({ column: "todo", assignedAgentId: undefined, status: undefined })], + ["todo task", makeTask({ column: "todo", assignedAgentId: "agent-1", status: undefined })], + ["triage task", makeTask({ column: "triage", assignedAgentId: "agent-1", status: undefined })], + ["done task", makeTask({ column: "done", assignedAgentId: "agent-1", status: undefined })], + ["archived task", makeTask({ column: "archived", assignedAgentId: "agent-1", status: undefined })], + ["in-progress task without an assigned or checked-out agent", makeTask({ column: "in-progress", status: "queued", assignedAgentId: undefined, checkedOutBy: undefined })], + ["paused in-progress task", makeTask({ column: "in-progress", status: "queued", paused: true })], + ["user-paused in-progress task", makeTask({ column: "in-progress", status: "queued", userPaused: true })], ["in-review task without an assigned or checked-out agent", makeTask({ column: "in-review", status: "reviewing", assignedAgentId: undefined, checkedOutBy: undefined })], ["paused in-review task", makeTask({ column: "in-review", status: "reviewing", paused: true })], ["user-paused in-review task", makeTask({ column: "in-review", status: "reviewing", userPaused: true })], - ["done task", makeTask({ column: "done", status: undefined })], ])("disables the composer and shows a hint for %s", (_label, task) => { render(); expect(screen.getByText(/No active assigned agent session/)).toBeTruthy(); - expect(screen.getByText(/active, assigned agent session is required/i)).toBeTruthy(); + expect(screen.getByText(/active, assigned, non-paused agent session is required/i)).toBeTruthy(); expect(screen.getByLabelText("Message active agent session")).toBeDisabled(); - expect(screen.getByPlaceholderText("Active assigned agent session required")).toBeTruthy(); + expect(screen.getByPlaceholderText("Active non-paused agent session required")).toBeTruthy(); expect(screen.getByRole("button", { name: "Send" })).toBeDisabled(); }); + it.each(["paused", "awaiting-user-input", "awaiting-cli-approval", "awaiting-user-review", "failed", "needs-replan"])( + "disables in-progress steering for non-steerable %s status", + (status) => { + render(); + + expect(screen.getByText(/No active assigned agent session/)).toBeTruthy(); + expect(screen.getByLabelText("Message active agent session")).toBeDisabled(); + expect(screen.getByRole("button", { name: "Send" })).toBeDisabled(); + }, + ); + it("surfaces send failures through addToast", async () => { const user = userEvent.setup(); const addToast = vi.fn();