Initializing agents were mapped to the "running" bucket in both server and client, causing the SyncedLoader spinner to appear in tabs and sidebar workspace rows when opening an agent for the first time.
49 lines
1.2 KiB
TypeScript
49 lines
1.2 KiB
TypeScript
import { describe, expect, it } from "vitest";
|
|
import { deriveSidebarStateBucket } from "./sidebar-agent-state";
|
|
|
|
describe("deriveSidebarStateBucket", () => {
|
|
it("prioritizes pending permissions as needs_input", () => {
|
|
expect(
|
|
deriveSidebarStateBucket({
|
|
status: "idle",
|
|
pendingPermissionCount: 1,
|
|
requiresAttention: false,
|
|
attentionReason: null,
|
|
}),
|
|
).toBe("needs_input");
|
|
});
|
|
|
|
it("keeps legacy permission attention in needs_input", () => {
|
|
expect(
|
|
deriveSidebarStateBucket({
|
|
status: "idle",
|
|
pendingPermissionCount: 0,
|
|
requiresAttention: true,
|
|
attentionReason: "permission",
|
|
}),
|
|
).toBe("needs_input");
|
|
});
|
|
|
|
it("treats unread finished agents as attention", () => {
|
|
expect(
|
|
deriveSidebarStateBucket({
|
|
status: "idle",
|
|
pendingPermissionCount: 0,
|
|
requiresAttention: true,
|
|
attentionReason: "finished",
|
|
}),
|
|
).toBe("attention");
|
|
});
|
|
|
|
it("treats initializing agents as done", () => {
|
|
expect(
|
|
deriveSidebarStateBucket({
|
|
status: "initializing",
|
|
pendingPermissionCount: 0,
|
|
requiresAttention: false,
|
|
attentionReason: null,
|
|
}),
|
|
).toBe("done");
|
|
});
|
|
});
|