fix: show sidebar spinner for created boot sessions (#1537)
This commit is contained in:
@@ -25,10 +25,11 @@ export function classifyTask(
|
||||
if (TASK_STATE_IN_PROGRESS.has(taskState)) return "in_progress";
|
||||
return "backlog";
|
||||
}
|
||||
// STARTING is a transient session state (e.g. during auto-resume after a
|
||||
// backend restart). Defer to the workflow task state so a task in REVIEW
|
||||
// does not flicker out of the review bucket while the agent reattaches.
|
||||
if (sessionState === "STARTING" && taskState) {
|
||||
// CREATED/STARTING are transient session states while the agent process is
|
||||
// booting or reattaching. Defer to the workflow task state so an
|
||||
// IN_PROGRESS task keeps showing activity, while a REVIEW task does not
|
||||
// flicker out of the review bucket during auto-resume.
|
||||
if ((sessionState === "CREATED" || sessionState === "STARTING") && taskState) {
|
||||
if (TASK_STATE_REVIEW.has(taskState)) return "review";
|
||||
if (TASK_STATE_IN_PROGRESS.has(taskState)) return "in_progress";
|
||||
return "backlog";
|
||||
|
||||
@@ -94,6 +94,29 @@ describe("TaskItem status icon", () => {
|
||||
expectPreparingSpinner();
|
||||
});
|
||||
|
||||
it("does not show a spinner for a created task waiting for manual start", () => {
|
||||
renderTaskItem({ state: "CREATED" });
|
||||
|
||||
expect(screen.queryByTestId(RUNNING_ICON_TEST_ID)).toBeNull();
|
||||
expect(screen.queryByTestId("task-state-backlog")).not.toBeNull();
|
||||
});
|
||||
|
||||
it("does not show a spinner for a created task with a prepared CREATED session", () => {
|
||||
renderTaskItem({ state: "CREATED", sessionState: "CREATED" });
|
||||
|
||||
expect(screen.queryByTestId(RUNNING_ICON_TEST_ID)).toBeNull();
|
||||
expect(screen.queryByTestId("task-state-backlog")).not.toBeNull();
|
||||
});
|
||||
|
||||
it("shows a running spinner while an in-progress session is created but not started", () => {
|
||||
renderTaskItem({ state: "IN_PROGRESS", sessionState: "CREATED" });
|
||||
|
||||
const icon = screen.getByTestId(RUNNING_ICON_TEST_ID);
|
||||
expect(icon.getAttribute("data-loading-phase")).toBe("running");
|
||||
expect(icon.classList.contains("text-yellow-500")).toBe(true);
|
||||
expect(icon.classList.contains(SPIN_CLASS)).toBe(true);
|
||||
});
|
||||
|
||||
it("does not show preparing spinner for a review task whose session transiently hits STARTING", () => {
|
||||
renderTaskItem({ state: "REVIEW", sessionState: "STARTING" });
|
||||
|
||||
|
||||
@@ -21,6 +21,14 @@ describe("classifyTask", () => {
|
||||
it("buckets STARTING with REVIEW task state as review", () => {
|
||||
expect(classifyTask("STARTING", "REVIEW")).toBe("review");
|
||||
});
|
||||
|
||||
it("uses task state while a CREATED session is booting", () => {
|
||||
expect(classifyTask("CREATED", "IN_PROGRESS")).toBe("in_progress");
|
||||
expect(classifyTask("CREATED", "SCHEDULING")).toBe("in_progress");
|
||||
expect(classifyTask("CREATED", "REVIEW")).toBe("review");
|
||||
expect(classifyTask("CREATED", "CREATED")).toBe("backlog");
|
||||
expect(classifyTask("CREATED", "TODO")).toBe("backlog");
|
||||
});
|
||||
});
|
||||
|
||||
describe("applySort state (regression: silent resume reorder)", () => {
|
||||
|
||||
Reference in New Issue
Block a user