@devries-cameron20 / t3code Mirror · read-only / commits / cfc9bf3415
Fork 0

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

Mirrored from https://github.com/Camo67/t3code.git

Synced Nov 24, 10:15 UTC

fix(web): fold single trailing activity (#9739)

Co-authored-by: maria-rcks <254055478+maria-rcks@users.noreply.github.com>

maria committed Sep 4, 2026 at 14:26 UTC cfc9bf34156ddcc4a98b7f5c67193adb5aedce06
3 files changed +17 -8
apps/web/src/components/chat/MessagesTimeline.logic.test.ts
+9 -4
@@ -1170,11 +1170,10 @@ describe("deriveMessagesTimelineRows", () => {
1170 })),
1171 ];
1172
1173 - const rows = deriveMessagesTimelineRows({
1174 - timelineEntries,
1173 + const input = {
1174 latestTurn: {
1175 turnId,
1177 - state: "error",
1176 + state: "error" as const,
1177 startedAt: "2026-01-01T00:00:00Z",
1178 completedAt: "2026-01-01T00:00:10Z",
1179 },
@@ -1182,7 +1181,8 @@ describe("deriveMessagesTimelineRows", () => {
1181 activeTurnStartedAt: null,
1182 turnDiffSummaryByAssistantMessageId: new Map(),
1183 revertTurnCountByUserMessageId: new Map(),
1185 - });
1184 + };
1185 + const rows = deriveMessagesTimelineRows({ ...input, timelineEntries });
1186
1187 expect(rows.map((row) => row.id)).toEqual([
1188 "turn-fold:turn-1",
@@ -1205,6 +1205,11 @@ describe("deriveMessagesTimelineRows", () => {
1205 showAssistantMeta: false,
1206 showAssistantCopyButton: false,
1207 });
1208 + expect(
1209 + deriveMessagesTimelineRows({ ...input, timelineEntries: timelineEntries.slice(0, 3) }).map(
1210 + (row) => row.id,
1211 + ),
1212 + ).toEqual(["turn-fold:turn-1", "assistant-final-entry"]);
1213 });
1214
1215 it("folds all assistant messages before the terminal message", () => {
apps/web/src/components/chat/MessagesTimeline.logic.ts
+7 -3
@@ -542,8 +542,8 @@ function workEntryIsActiveTurnActivity(entry: WorkLogEntry): boolean {
542
543 /**
544 * Settled turns fold activity before their terminal assistant message behind
545 - * a "Worked for ..." row. Work that lands after that message stays visible so
546 - * failed or interrupted turns do not hide their trailing tool-call summary.
545 + * a "Worked for ..." row. A single ordinary activity after that message joins
546 + * the fold, while larger groups and failures stay visible as a trailing summary.
547 */
548 function deriveTurnFolds(input: {
549 timelineEntries: ReadonlyArray<TimelineEntry>;
@@ -623,7 +623,11 @@ function deriveTurnFolds(input: {
623 }
624 const isCompaction =
625 entry.kind === "work" && entry.entry.sourceActivityKind === "context-compaction";
626 - if (!isCompaction && index > terminalEntryIndex) {
626 + const isSingleTrailingActivity =
627 + group.entries.length === terminalEntryIndex + 2 &&
628 + entry.kind === "work" &&
629 + !workEntryDisplayIndicatesToolFailure(entry.entry);
630 + if (!isCompaction && index > terminalEntryIndex && !isSingleTrailingActivity) {
631 continue;
632 }
633 // Agent-spawn CTA rows never fold: workflows outlive their launching
apps/web/src/components/chat/MessagesTimeline.test.tsx
+1 -1
@@ -1135,7 +1135,7 @@ describe("MessagesTimeline", () => {
1135 label: "Ran command",
1136 tone: "tool",
1137 itemType: "command_execution",
1138 - toolLifecycleStatus: "completed",
1138 + toolLifecycleStatus: "failed",
1139 },
1140 },
1141 ]}