diff --git a/apps/web/src/components/chat/MessagesTimeline.logic.test.ts b/apps/web/src/components/chat/MessagesTimeline.logic.test.ts index 7d8eadeb0d6..bf8299e109d 100644 --- a/apps/web/src/components/chat/MessagesTimeline.logic.test.ts +++ b/apps/web/src/components/chat/MessagesTimeline.logic.test.ts @@ -679,7 +679,7 @@ describe("deriveMessagesTimelineRows", () => { expect(finalRow?.kind === "message" && finalRow.showAssistantMeta).toBe(true); }); - it("folds prior active-turn work while keeping the latest assistant message visible", () => { + it("does not fold the active in-progress turn", () => { const rows = deriveMessagesTimelineRows({ timelineEntries: [ { @@ -735,19 +735,13 @@ describe("deriveMessagesTimelineRows", () => { revertTurnCountByUserMessageId: new Map(), }); + expect(rows.some((row) => row.kind === "turn-fold")).toBe(false); expect(rows.map((row) => row.id)).toEqual([ - "turn-fold:turn-1", + "assistant-thought-entry", + "work-entry-1", "assistant-latest-entry", "working-indicator-row", ]); - expect(rows.find((row) => row.kind === "turn-fold")).toEqual( - expect.objectContaining({ - kind: "turn-fold", - turnId: "turn-1", - label: "Working", - expanded: false, - }), - ); }); it("only shows assistant metadata on the terminal assistant message", () => { diff --git a/apps/web/src/components/chat/MessagesTimeline.logic.ts b/apps/web/src/components/chat/MessagesTimeline.logic.ts index 698435782b3..1f34708b59b 100644 --- a/apps/web/src/components/chat/MessagesTimeline.logic.ts +++ b/apps/web/src/components/chat/MessagesTimeline.logic.ts @@ -236,6 +236,9 @@ function deriveTurnFolds(input: { const foldsByAnchorEntryId = new Map(); for (const [turnId, group] of groupsByTurnId) { + if (turnId === input.unsettledTurnId) { + continue; + } if (group.hasStreamingMessage) { continue; } @@ -257,8 +260,6 @@ function deriveTurnFolds(input: { const isLatestInterruptedTurn = input.latestTurn?.turnId === turnId && input.latestTurn.state === "interrupted"; - const isLatestRunningTurn = - input.latestTurn?.turnId === turnId && input.latestTurn.state === "running"; // A turn cut short by a steer leaves trailing work entries behind its // terminal message — take whichever ended last. const lastEntryEnd = @@ -276,15 +277,13 @@ function deriveTurnFolds(input: { lastEntryEnd, ); const duration = elapsedMs !== null ? formatDuration(elapsedMs) : null; - const label = isLatestRunningTurn - ? "Working" - : isLatestInterruptedTurn - ? duration - ? `You stopped after ${duration}` - : "You stopped this response" - : duration - ? `Worked for ${duration}` - : "Worked"; + const label = isLatestInterruptedTurn + ? duration + ? `You stopped after ${duration}` + : "You stopped this response" + : duration + ? `Worked for ${duration}` + : "Worked"; foldsByAnchorEntryId.set(firstEntry.id, { turnId,