Skip to content

Commit 3e7acb8

Browse files
committed
fix(timeline): trust session_status only for working derivation
Stuck 'Thinking' shimmer on the timeline progress glide. Our commit 17 (128a2c9) added `!!pending() || sessionStatus().type !== "idle"` to the working memo, intending it as a self-heal. It's actually a permanent false positive: pending() reads the DB-persisted message list, and any assistant message that ever crashed mid-stream stays incomplete (time.completed = undefined) forever. The result is that sessions which previously crashed show 'working' forever even after session_status correctly reports idle. session_status reliably goes to idle on: - processor.ts halt path (status.set idle on assistant error) - run-state.ts cancel path (status.set idle when no runner exists) - runner.ts onIdle (fires on any fiber exit: success/failure/interrupt) Trust status only. The pending() memo is still used for activeMessageID derivation (commit 17's last-msg-only change is preserved there). Empirical: 12 incomplete assistant messages persist in opencode-aai.db, including one in the actively-debugged session created today. This commit eliminates the user-visible symptom for the timeline. Companion commits will apply the same trust-status-only pattern to session.tsx::busy(), sidebar-items.tsx::SessionItem.isWorking, and tighten session-turn.tsx::pending. Each is intentionally split so it can be reverted independently if upstream PR anomalyco#17593 lands. Refs upstream PR anomalyco#17593.
1 parent 7a2f630 commit 3e7acb8

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

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

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,15 @@ export function MessageTimeline(props: {
276276
if (!id) return idle
277277
return sync.data.session_status[id] ?? idle
278278
})
279-
const working = createMemo(() => !!pending() || sessionStatus().type !== "idle")
279+
// Trust session_status as the single source of truth for "is this session
280+
// currently working?". A previous attempt mixed in `!!pending()` here as a
281+
// self-heal, but `pending()` reads the DB-persisted message list — any
282+
// assistant message that crashed before reaching `time.completed = Date.now()`
283+
// remains permanently incomplete in DB, so message-derived "working" is true
284+
// forever for sessions that ever crashed mid-stream. session_status does
285+
// reliably go idle on error/cancel/finish via processor halt, run-state
286+
// cancel, and runner onIdle. Use status only.
287+
const working = createMemo(() => sessionStatus().type !== "idle")
280288
const tint = createMemo(() => messageAgentColor(sessionMessages(), sync.data.agent))
281289

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

0 commit comments

Comments
 (0)