| ... | @@ -619,17 +619,15 @@ function deriveTurnFolds(input: { | ... | @@ -619,17 +619,15 @@ function deriveTurnFolds(input: { |
| 619 | if (entry.id === group.terminalEntry?.id) { | 619 | if (entry.id === group.terminalEntry?.id) { |
| 620 | continue; | 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 | continue; | 625 | continue; |
| 624 | } | 626 | } |
| 625 | // Agent-spawn CTA rows never fold: workflows outlive their launching | 627 | // Agent-spawn CTA rows never fold: workflows outlive their launching |
| 626 | // turn (dynamic spawns, background execution), and folding the CTA | 628 | // turn (dynamic spawns, background execution), and folding the CTA |
| 627 | // when the turn settles makes a still-running fleet invisible. | 629 | // when the turn settles makes a still-running fleet invisible. |
| 628 | if ( | 630 | if (entry.kind === "work" && entry.entry.agentSpawn !== undefined) { |
| 629 | entry.kind === "work" && | | |
| 630 | (entry.entry.agentSpawn !== undefined || | | |
| 631 | entry.entry.sourceActivityKind === "context-compaction") | | |
| 632 | ) { | | |
| 633 | continue; | 631 | continue; |
| 634 | } | 632 | } |
| 635 | hiddenEntryIds.add(entry.id); | 633 | hiddenEntryIds.add(entry.id); |
| ... | @@ -637,6 +635,16 @@ function deriveTurnFolds(input: { | ... | @@ -637,6 +635,16 @@ function deriveTurnFolds(input: { |
| 637 | if (hiddenEntryIds.size === 0) { | 635 | if (hiddenEntryIds.size === 0) { |
| 638 | continue; | 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 | const firstEntry = group.entries[0]; | 649 | const firstEntry = group.entries[0]; |
| 642 | const firstHiddenEntry = group.entries.find((entry) => hiddenEntryIds.has(entry.id)); | 650 | const firstHiddenEntry = group.entries.find((entry) => hiddenEntryIds.has(entry.id)); |