Skip to content

Commit 859b010

Browse files
fix(app): stop using orphaned assistant messages for working state
After a server restart or interrupted stream, assistant messages can be left without time.completed. The animation and session list icon were checking for these incomplete messages to determine if a session was still working, causing them to show a permanent spinner even when the session was idle. Now all three working-state checks rely solely on session_status from the backend, which is always correct after a fresh start. Fixes anomalyco#17680, anomalyco#18828, anomalyco#21840, anomalyco#21939
1 parent dfaae14 commit 859b010

3 files changed

Lines changed: 3 additions & 16 deletions

File tree

‎packages/app/src/pages/layout/sidebar-items.tsx‎

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -151,18 +151,8 @@ export const SessionItem = (props: SessionItemProps): JSX.Element => {
151151
})
152152
const isWorking = createMemo(() => {
153153
if (hasPermissions()) return false
154-
const pending = (sessionStore.message[props.session.id] ?? []).findLast(
155-
(message) =>
156-
message.role === "assistant" &&
157-
typeof (message as { time?: { completed?: unknown } }).time?.completed !== "number",
158-
)
159154
const status = sessionStore.session_status[props.session.id]
160-
return (
161-
pending !== undefined ||
162-
status?.type === "busy" ||
163-
status?.type === "retry" ||
164-
(status !== undefined && status.type !== "idle")
165-
)
155+
return status?.type === "busy" || status?.type === "retry" || (status !== undefined && status.type !== "idle")
166156
})
167157

168158
const tint = createMemo(() => messageAgentColor(sessionStore.message[props.session.id], sessionStore.agent))

‎packages/app/src/pages/session.tsx‎

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1497,10 +1497,7 @@ export default function Page() {
14971497
})
14981498

14991499
const busy = (sessionID: string) => {
1500-
if ((sync.data.session_status[sessionID] ?? { type: "idle" as const }).type !== "idle") return true
1501-
return (sync.data.message[sessionID] ?? []).some(
1502-
(item) => item.role === "assistant" && typeof item.time.completed !== "number",
1503-
)
1500+
return (sync.data.session_status[sessionID] ?? { type: "idle" as const }).type !== "idle"
15041501
}
15051502

15061503
const queuedFollowups = createMemo(() => {

‎packages/app/src/pages/session/message-timeline.tsx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,7 @@ export function MessageTimeline(props: {
259259
if (!id) return idle
260260
return sync.data.session_status[id] ?? idle
261261
})
262-
const working = createMemo(() => !!pending() || sessionStatus().type !== "idle")
262+
const working = createMemo(() => sessionStatus().type !== "idle")
263263
const tint = createMemo(() => messageAgentColor(sessionMessages(), sync.data.agent))
264264

265265
const [timeoutDone, setTimeoutDone] = createSignal(true)

0 commit comments

Comments
 (0)