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 21, 23:30 UTC
fix(web): hide empty replies when renders show the result (#34182)
Yash Singh committed
Nov 10, 2026 at 23:17 UTC
05adc163fc5ed373be840b4e7455692ee5865945
3 files changed
+82
-1
apps/web/src/components/chat/MessagesTimeline.logic.test.ts
+68
@@ -55,6 +55,74 @@ describe("resolveAssistantMessageCopyState", () => {
55
});
56
57
describe("deriveMessagesTimelineRows", () => {
58
+ it.each([
59
+ ["html-render", "reply-run", true],
60
+ ["mcp-app", "reply-run", true],
61
+ ["html-render", "other-run", false],
62
+ ["html-render", null, false],
63
+ [null, null, false],
64
+ ] as const)("suppresses the empty fallback for %s in %s: %s", (kind, renderRun, expected) => {
65
+ const at = "2026-11-06T00:00:00Z";
66
+ const runId = RunId.make("reply-run");
67
+ const renderBase = {
68
+ id: "render",
69
+ createdAt: at,
70
+ runId: renderRun ? RunId.make(renderRun) : null,
71
+ };
72
+ const embedded: TimelineEntry[] =
73
+ kind === "html-render"
74
+ ? [
75
+ {
76
+ ...renderBase,
77
+ kind,
78
+ htmlRender: { attachmentId: "preview", title: "Preview", height: 420 },
79
+ },
80
+ ]
81
+ : kind === "mcp-app"
82
+ ? [
83
+ {
84
+ ...renderBase,
85
+ kind,
86
+ sourceThreadId: ThreadId.make("thread"),
87
+ itemId: TurnItemId.make("app"),
88
+ revision: "1",
89
+ mcpApp: {
90
+ attachmentId: "app",
91
+ server: "weather",
92
+ tool: "weather",
93
+ resourceUri: "ui://weather",
94
+ },
95
+ },
96
+ ]
97
+ : [];
98
+ const rows = deriveMessagesTimelineRows({
99
+ timelineEntries: [
100
+ ...embedded,
101
+ {
102
+ kind: "message",
103
+ id: "reply",
104
+ createdAt: at,
105
+ message: {
106
+ id: MessageId.make("reply"),
107
+ role: "assistant",
108
+ runId,
109
+ text: "",
110
+ streaming: false,
111
+ createdAt: at,
112
+ updatedAt: at,
113
+ },
114
+ },
115
+ ],
116
+ latestRun: null,
117
+ isWorking: false,
118
+ activeTurnStartedAt: null,
119
+ turnDiffSummaries: [],
120
+ supportsConversationRollback: false,
121
+ });
122
+ const reply = rows.find((row) => row.kind === "message" && row.id === "reply");
123
+ expect(reply).toMatchObject({ suppressEmptyResponse: expected });
124
+ });
125
+
126
it.each(["alone", "before tool", "before commentary and tool"])(
127
"keeps an unfinished task update static %s",
128
(placement) => {
apps/web/src/components/chat/MessagesTimeline.logic.ts
+12
@@ -594,6 +594,7 @@ type MessagesTimelineRowContent =
594
message: ChatMessage;
595
projectedItem?: OrchestrationV2ProjectedTurnItem;
596
showAssistantMeta: boolean;
597
+ suppressEmptyResponse?: boolean;
598
showAssistantCopyButton: boolean;
599
assistantCopyStreaming: boolean;
600
assistantTurnDiffSummary?: TurnDiffSummary | undefined;
@@ -1520,6 +1521,12 @@ export function deriveMessagesTimelineRows(input: {
1521
revealedMessageId?: MessageId | null;
1522
}): MessagesTimelineRow[] {
1523
const timelineEntries = timelineRowEntries(input);
1524
+ const embeddedResultRunIds = new Set<RunId>();
1525
+ for (const entry of timelineEntries) {
1526
+ if ((entry.kind === "html-render" || entry.kind === "mcp-app") && entry.runId !== null) {
1527
+ embeddedResultRunIds.add(entry.runId);
1528
+ }
1529
+ }
1530
const isPendingApproval = (entry: WorkLogEntry) => {
1531
const item = entry.projectedItem?.item;
1532
return (
@@ -2164,6 +2171,10 @@ export function deriveMessagesTimelineRows(input: {
2171
? {}
2172
: { projectedItem: timelineEntry.projectedItem }),
2173
showAssistantMeta,
2174
+ suppressEmptyResponse:
2175
+ timelineEntry.message.role === "assistant" &&
2176
+ timelineEntry.message.runId != null &&
2177
+ embeddedResultRunIds.has(timelineEntry.message.runId),
2178
showAssistantCopyButton: showAssistantMeta,
2179
assistantCopyStreaming: timelineEntry.message.streaming || assistantResponseStillInProgress,
2180
assistantTurnDiffSummary:
@@ -2633,6 +2644,7 @@ function isRowUnchanged(a: MessagesTimelineRow, b: MessagesTimelineRow): boolean
2644
a.message === bm.message &&
2645
a.projectedItem === bm.projectedItem &&
2646
a.showAssistantMeta === bm.showAssistantMeta &&
2647
+ a.suppressEmptyResponse === bm.suppressEmptyResponse &&
2648
a.showAssistantCopyButton === bm.showAssistantCopyButton &&
2649
a.assistantCopyStreaming === bm.assistantCopyStreaming &&
2650
a.assistantTurnDiffSummary === bm.assistantTurnDiffSummary &&
apps/web/src/components/chat/TimelineAssistantRows.tsx
+2
-1
@@ -32,7 +32,8 @@ export function AssistantTimelineRow({ row }: { row: Extract<TimelineRow, { kind
32
row.projectedItem?.item.id,
33
);
34
const text = liveText ?? row.message.text;
35
- const messageText = text || (row.message.streaming ? "" : "(empty response)");
35
+ const messageText =
36
+ text || (row.message.streaming || row.suppressEmptyResponse ? "" : "(empty response)");
37
38
return (
39
<>