fix(chat): preserve assistant responses when folding #8903
ClosednateEc(GitHub profile, opens in a new tab)wants to merge 3 commits into
main fromrefs/pull/8903/headopened View on GitHubgithub-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:unvouched
github-actions[bot](GitHub profile, opens in a new tab) added labelssize:S
- apps/mobile/src/lib/threadActivity.ts lines 1299 to 1299OutdatedResolvedby macroscopeapp[bot](GitHub profile, opens in a new tab)@@ -1298,12 +1294,6 @@12981294 continue;12991295 }130012961301- const firstAssistantMessageId = firstAssistantMessageIdByTurn.get(turnId);13021297 const terminalAssistantMessageId = terminalAssistantMessageIdByTurn.get(turnId);13031298 const hiddenEntryIds = new Set(1304- entries1305- .filter(1306- (entry) =>1307- entry.id !== firstAssistantMessageId && entry.id !== terminalAssistantMessageId,1308- )1309- .map((entry) => entry.id),1299+ entries.filter((entry) => entry.type === "activity-group").map((entry) => entry.id),
github-actions[bot](GitHub profile, opens in a new tab) removed labelsvouch:unvouched
github-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:trusted
- apps/mobile/src/lib/threadActivity.ts line 1647Resolvedby cursor[bot](GitHub profile, opens in a new tab)@@ -1298,12 +1294,12 @@12981294 continue;12991295 }130012961301- const firstAssistantMessageId = firstAssistantMessageIdByTurn.get(turnId);13021297 const terminalAssistantMessageId = terminalAssistantMessageIdByTurn.get(turnId);13031298 const hiddenEntryIds = new Set(13041299 entries13051300 .filter(13061301 (entry) =>1307- entry.id !== firstAssistantMessageId && entry.id !== terminalAssistantMessageId,1302+ entry.type === "activity-group" &&1303+ !entry.activities.some((activity) => activity.workEntry.agentSpawn === true),13081304 )13091305 .map((entry) => entry.id),
- apps/web/src/components/chat/MessagesTimeline.logic.ts line 620Resolvedby macroscopeapp[bot](GitHub profile, opens in a new tab)@@ -587,4 +588,4 @@587588 }588589 const hiddenEntryIds = new Set<string>();589590 for (const entry of group.entries) {590- if (entry.id === group.terminalEntry?.id) {591+ if (entry.kind !== "work") {
github-actions[bot](GitHub profile, opens in a new tab) removed labelssize:S
github-actions[bot](GitHub profile, opens in a new tab) added labelssize:M
- @@ -617,3 +617,8 @@617617 ? group.entries.findIndex((entry) => entry.id === group.terminalEntry?.id)618618 : group.entries.length;619619 for (const [index, entry] of group.entries.entries()) {620+ if (entry.kind !== "work") {621+ if (622+ entry.kind === "message" &&623+ entry.message.role === "assistant" &&624+ entry.message.text.trim().length === 0 &&
juliusmarminge closed this
Sign in to join this conversation.


📝 Walkthrough
Walkthrough#
The change updates web and mobile turn folding to preserve substantive assistant messages and agent-spawn activities. Empty assistant commentary remains foldable. Tests cover the updated row ordering and nested-agent behavior.
Changes#
Turn folding visibility
apps/web/src/components/chat/MessagesTimeline.logic.ts,apps/web/src/components/chat/MessagesTimeline.logic.test.tsapps/mobile/src/lib/threadActivity.ts,apps/mobile/src/lib/threadActivity.test.tsEstimated code review effort: 3 (Moderate) | ~20 minutes
Merge Risk: 🟡 Moderate · up to
190cdSettled web conversations can hide an assistant response that consists of an attachment with no text, preventing users from seeing response content until the fold is expanded. This should be corrected before merge.
Suggested reviewers:
t3dotgg,juliusmarminge🚥 Pre-merge checks | ✅ 4 | ❌ 1
❌ Failed checks (1 warning)#
✅ Passed checks (4 passed)
#8879by keeping assistant messages visible in web and mobile timelines while folding eligible work activity. The tests also cover blank commentary and agent-spawn visibility…✨ Finishing Touches
🧪 Generate unit tests (beta)
Comment `@coderabbitai help` to get the list of available commands.