@devries-cameron20 / t3code-1 / commits / 17c48f7fc1
Fork 0

The best way to control Claude Code, Codex and more from any computer or phone

fix(web): fold interim turn responses (#8828)

maria committed Aug 30, 2026 at 20:32 UTC 17c48f7fc1af66110706b013bf41901ebcd8aedb
2 files changed +8 -17
apps/web/src/components/chat/MessagesTimeline.logic.test.ts
+4 -9
@@ -469,7 +469,7 @@ describe("deriveMessagesTimelineRows", () => {
469 expect(assistantRow?.assistantTurnDiffSummary).toBe(assistantTurnDiffSummary);
470 });
471
472 - it("keeps the first and terminal assistant messages visible around settled work", () => {
472 + it("folds the first assistant message and settled work before the terminal response", () => {
473 const timelineEntries = [
474 {
475 id: "user-entry",
@@ -545,7 +545,6 @@ describe("deriveMessagesTimelineRows", () => {
545 expect(foldRow?.label).toBe("Worked for 22s");
546 expect(collapsedRows.map((row) => row.id)).toEqual([
547 "user-entry",
548 - "assistant-first-entry",
548 "turn-fold:turn-1",
549 "assistant-final-entry",
550 ]);
@@ -561,8 +560,8 @@ describe("deriveMessagesTimelineRows", () => {
560
561 expect(expandedRows.map((row) => row.id)).toEqual([
562 "user-entry",
564 - "assistant-first-entry",
563 "turn-fold:turn-1",
564 + "assistant-first-entry",
565 "work-toggle:work-entry-1",
566 "assistant-final-entry",
567 ]);
@@ -571,7 +570,7 @@ describe("deriveMessagesTimelineRows", () => {
570 ).toBeDefined();
571 });
572
574 - it("folds assistant messages between the first and terminal messages", () => {
573 + it("folds all assistant messages before the terminal message", () => {
574 const timelineEntries = [
575 {
576 id: "assistant-first-entry",
@@ -625,11 +624,7 @@ describe("deriveMessagesTimelineRows", () => {
624 revertTurnCountByUserMessageId: new Map(),
625 });
626
628 - expect(rows.map((row) => row.id)).toEqual([
629 - "assistant-first-entry",
630 - "turn-fold:turn-1",
631 - "assistant-final-entry",
632 - ]);
627 + expect(rows.map((row) => row.id)).toEqual(["turn-fold:turn-1", "assistant-final-entry"]);
628 });
629
630 it("derives a sane duration for a steer-superseded turn with one instant commentary message", () => {
apps/web/src/components/chat/MessagesTimeline.logic.ts
+4 -8
@@ -523,10 +523,9 @@ function timelineEntryTurnId(entry: TimelineEntry): TurnId | null {
523 }
524
525 /**
526 - * Settled turns keep their first and terminal assistant messages visible.
527 - * Everything between them folds behind a "Worked for ..." row anchored at
528 - * the first hidden entry. Keeping both ends prevents a short follow-up from
529 - * hiding a substantive opening response while still bounding noisy turns.
526 + * Settled turns keep only their terminal assistant message visible.
527 + * Everything before it folds behind a "Worked for ..." row anchored at the
528 + * first hidden entry, so the duration leads directly into the final response.
529 */
530 function deriveTurnFolds(input: {
531 timelineEntries: ReadonlyArray<TimelineEntry>;
@@ -596,12 +595,9 @@ function deriveTurnFolds(input: {
595 if (group.hasStreamingMessage) {
596 continue;
597 }
599 - const firstAssistantEntry = group.entries.find(
600 - (entry): entry is Extract<TimelineEntry, { kind: "message" }> => entry.kind === "message",
601 - );
598 const hiddenEntryIds = new Set<string>();
599 for (const entry of group.entries) {
604 - if (entry.id === firstAssistantEntry?.id || entry.id === group.terminalEntry?.id) {
600 + if (entry.id === group.terminalEntry?.id) {
601 continue;
602 }
603 // Agent-spawn CTA rows never fold: workflows outlive their launching