| ... | ... | @@ -619,17 +619,15 @@ function deriveTurnFolds(input: { |
| 619 | 619 | if (entry.id === group.terminalEntry?.id) { |
| 620 | 620 | continue; |
| 621 | 621 | } |
| 622 | | if (index > terminalEntryIndex) { |
| 622 | const isCompaction = |
| 623 | entry.kind === "work" && entry.entry.sourceActivityKind === "context-compaction"; |
| 624 | if (!isCompaction && index > terminalEntryIndex) { |
| 623 | 625 | continue; |
| 624 | 626 | } |
| 625 | 627 | // Agent-spawn CTA rows never fold: workflows outlive their launching |
| 626 | 628 | // turn (dynamic spawns, background execution), and folding the CTA |
| 627 | 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) { |
| 633 | 631 | continue; |
| 634 | 632 | } |
| 635 | 633 | hiddenEntryIds.add(entry.id); |
| ... | ... | @@ -637,6 +635,16 @@ function deriveTurnFolds(input: { |
| 637 | 635 | if (hiddenEntryIds.size === 0) { |
| 638 | 636 | continue; |
| 639 | 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 | } |
| 640 | 648 | |
| 641 | 649 | const firstEntry = group.entries[0]; |
| 642 | 650 | const firstHiddenEntry = group.entries.find((entry) => hiddenEntryIds.has(entry.id)); |