Support pending status in sidebar v2
This commit is contained in:
2 files changed
+21
-3
No files matched your search
@@ -648,7 +648,11 @@ describe("resolveSidebarV2Status", () => {
|
||||
updatedAt: "2026-03-09T10:00:00.000Z",
|
||||
};
|
||||
|
||||
const idle = { hasPendingApprovals: false, hasPendingUserInput: false };
|
||||
const idle = {
|
||||
hasPendingApprovals: false,
|
||||
hasPendingTurnStart: false,
|
||||
hasPendingUserInput: false,
|
||||
};
|
||||
|
||||
it("prioritizes approval over a running session", () => {
|
||||
expect(resolveSidebarV2Status({ ...idle, hasPendingApprovals: true, session })).toBe(
|
||||
@@ -678,6 +682,16 @@ describe("resolveSidebarV2Status", () => {
|
||||
).toBe("working");
|
||||
});
|
||||
|
||||
it("reports working while a turn start is pending without a session", () => {
|
||||
expect(
|
||||
resolveSidebarV2Status({
|
||||
...idle,
|
||||
hasPendingTurnStart: true,
|
||||
session: null,
|
||||
}),
|
||||
).toBe("working");
|
||||
});
|
||||
|
||||
it("reports failed only while the session status is error", () => {
|
||||
expect(
|
||||
resolveSidebarV2Status({
|
||||
|
||||
@@ -429,7 +429,7 @@ export type SidebarV2Status = "approval" | "input" | "working" | "failed" | "rea
|
||||
|
||||
type SidebarV2StatusInput = Pick<
|
||||
SidebarThreadSummary,
|
||||
"hasPendingApprovals" | "hasPendingUserInput" | "session"
|
||||
"hasPendingApprovals" | "hasPendingTurnStart" | "hasPendingUserInput" | "session"
|
||||
>;
|
||||
|
||||
export function resolveSidebarV2Status(thread: SidebarV2StatusInput): SidebarV2Status {
|
||||
@@ -439,7 +439,11 @@ export function resolveSidebarV2Status(thread: SidebarV2StatusInput): SidebarV2S
|
||||
if (thread.hasPendingUserInput) {
|
||||
return "input";
|
||||
}
|
||||
if (thread.session?.status === "running" || thread.session?.status === "starting") {
|
||||
if (
|
||||
thread.session?.status === "running" ||
|
||||
thread.session?.status === "starting" ||
|
||||
thread.hasPendingTurnStart === true
|
||||
) {
|
||||
return "working";
|
||||
}
|
||||
if (thread.session?.status === "error") {
|
||||
|
||||
Reference in new issue
Block a user