@devries-cameron20 / t3code Mirror · read-only / commits / 5f878d2a85
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, 11:30 UTC

fix(web,mobile): fold context compaction under settled turn folds (#9623)

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

maria committed Sep 4, 2026 at 04:12 UTC 5f878d2a85807618a4c8571cdef5daa3124672d6
2 files changed +24 -9
apps/mobile/src/lib/threadActivity.ts
+10 -3
@@ -1375,9 +1375,6 @@ function deriveThreadFeedTurnFolds(
1375 pendingUserBoundary = entry.message.createdAt;
1376 continue;
1377 }
1378 - if (entry.type === "activity-group" && isContextCompactionActivityGroup(entry)) {
1379 - continue;
1380 - }
1378 const turnId =
1379 entry.type === "message" && entry.message.role === "assistant"
1380 ? entry.message.turnId
@@ -1423,6 +1420,16 @@ function deriveThreadFeedTurnFolds(
1420 if (hiddenEntryIds.size === 0) {
1421 continue;
1422 }
1423 + // A lone compaction row stays visible on its own; it only folds away as
1424 + // part of a turn that already folds other work.
1425 + const hidesNonCompactionWork = entries.some(
1426 + (entry) =>
1427 + hiddenEntryIds.has(entry.id) &&
1428 + !(entry.type === "activity-group" && isContextCompactionActivityGroup(entry)),
1429 + );
1430 + if (!hidesNonCompactionWork) {
1431 + continue;
1432 + }
1433
1434 const firstEntry = entries[0];
1435 const firstHiddenEntry = entries.find((entry) => hiddenEntryIds.has(entry.id));
apps/web/src/components/chat/MessagesTimeline.logic.ts
+14 -6
@@ -619,17 +619,15 @@ function deriveTurnFolds(input: {
619 if (entry.id === group.terminalEntry?.id) {
620 continue;
621 }
622 - if (index > terminalEntryIndex) {
622 + const isCompaction =
623 + entry.kind === "work" && entry.entry.sourceActivityKind === "context-compaction";
624 + if (!isCompaction && index > terminalEntryIndex) {
625 continue;
626 }
627 // Agent-spawn CTA rows never fold: workflows outlive their launching
628 // turn (dynamic spawns, background execution), and folding the CTA
629 // when the turn settles makes a still-running fleet invisible.
628 - if (
629 - entry.kind === "work" &&
630 - (entry.entry.agentSpawn !== undefined ||
631 - entry.entry.sourceActivityKind === "context-compaction")
632 - ) {
630 + if (entry.kind === "work" && entry.entry.agentSpawn !== undefined) {
631 continue;
632 }
633 hiddenEntryIds.add(entry.id);
@@ -637,6 +635,16 @@ function deriveTurnFolds(input: {
635 if (hiddenEntryIds.size === 0) {
636 continue;
637 }
638 + // A lone compaction row stays visible on its own; it only folds away as
639 + // part of a turn that already folds other work.
640 + const hidesNonCompactionWork = group.entries.some(
641 + (entry) =>
642 + hiddenEntryIds.has(entry.id) &&
643 + !(entry.kind === "work" && entry.entry.sourceActivityKind === "context-compaction"),
644 + );
645 + if (!hidesNonCompactionWork) {
646 + continue;
647 + }
648
649 const firstEntry = group.entries[0];
650 const firstHiddenEntry = group.entries.find((entry) => hiddenEntryIds.has(entry.id));