From 4a8e9a7d9716dbcf2d03556f4d3dc6933f150ebe Mon Sep 17 00:00:00 2001 From: Nick Bobrowski <39348559+nicko-ai@users.noreply.github.com> Date: Fri, 12 Jun 2026 01:00:17 +0100 Subject: [PATCH] fix(app): align child store working state - Restore upstream session_working behavior for sessions without loaded status - Remove tests that locked in the unfinished-assistant fallback --- .../context/global-sync/child-store.test.ts | 45 ------------------- .../src/context/global-sync/child-store.ts | 7 +-- 2 files changed, 2 insertions(+), 50 deletions(-) diff --git a/packages/app/src/context/global-sync/child-store.test.ts b/packages/app/src/context/global-sync/child-store.test.ts index c0bc0be96..b4d4bf00f 100644 --- a/packages/app/src/context/global-sync/child-store.test.ts +++ b/packages/app/src/context/global-sync/child-store.test.ts @@ -139,49 +139,4 @@ describe("createChildStoreManager", () => { dispose() }) }) - - test("treats unfinished assistant messages as working before status loads", () => { - queries = [{ isLoading: false }, { isLoading: false }, { isLoading: false }, { isLoading: false }] - - createRoot((dispose) => { - const owner = getOwner() - if (!owner) throw new Error("owner required") - - const store = manager(owner) - const [state, setState] = store.ensureChild("/repo") - setState("message", "ses_1", [ - { - role: "assistant", - time: {}, - } as unknown as State["message"][string][number], - ]) - - expect(state.session_working("ses_1")).toBe(true) - - dispose() - }) - }) - - test("does not use unfinished assistant messages after idle status loads", () => { - queries = [{ isLoading: false }, { isLoading: false }, { isLoading: false }, { isLoading: false }] - - createRoot((dispose) => { - const owner = getOwner() - if (!owner) throw new Error("owner required") - - const store = manager(owner) - const [state, setState] = store.ensureChild("/repo") - setState("session_status", "ses_1", { type: "idle" }) - setState("message", "ses_1", [ - { - role: "assistant", - time: {}, - } as unknown as State["message"][string][number], - ]) - - expect(state.session_working("ses_1")).toBe(false) - - dispose() - }) - }) }) diff --git a/packages/app/src/context/global-sync/child-store.ts b/packages/app/src/context/global-sync/child-store.ts index 6fc577634..14008cda1 100644 --- a/packages/app/src/context/global-sync/child-store.ts +++ b/packages/app/src/context/global-sync/child-store.ts @@ -210,11 +210,8 @@ export function createChildStoreManager(input: { sessionTotal: 0, session_status: {}, session_working(id: string) { - const status = this.session_status[id] - if (status) return status.type !== "idle" - return (this.message[id] ?? []).some( - (item) => item.role === "assistant" && typeof item.time.completed !== "number", - ) + const type = this.session_status[id]?.type + return (type ?? "idle") !== "idle" }, session_diff: {}, todo: {},