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 23, 03:00 UTC
fix(web): keep answered questions visible after a turn settles (#21086)
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Ivan Malison committed
Oct 18, 2026 at 12:50 UTC
80df91b52b82270a995b9f4951c3aafe7caeddd5
2 files changed
+123
-1
apps/web/src/components/chat/MessagesTimeline.logic.test.ts
+117
@@ -2368,6 +2368,123 @@ describe("deriveMessagesTimelineRows", () => {
2368
]);
2369
});
2370
2371
+ it("keeps answered questions in their own row outside tool groups and turn folds", () => {
2372
+ const threadId = ThreadId.make("answered-question-thread");
2373
+ const runId = RunId.make("answered-question-run");
2374
+ const requestId = RuntimeRequestId.make("scope-question");
2375
+ const at = (second: number) =>
2376
+ DateTime.makeUnsafe(new Date(Date.UTC(2026, 9, 17, 12, 0, second)).toISOString());
2377
+ const base = (id: string, ordinal: number, second: number) => ({
2378
+ id: TurnItemId.make(id),
2379
+ threadId,
2380
+ runId,
2381
+ nodeId: null,
2382
+ providerThreadId: null,
2383
+ providerTurnId: null,
2384
+ nativeItemRef: null,
2385
+ parentItemId: null,
2386
+ ordinal,
2387
+ status: "completed" as const,
2388
+ title: null,
2389
+ startedAt: at(second),
2390
+ completedAt: at(second),
2391
+ updatedAt: at(second),
2392
+ });
2393
+ const command = (id: string, ordinal: number, second: number) => ({
2394
+ ...base(id, ordinal, second),
2395
+ type: "command_execution" as const,
2396
+ input: `cat ${id}`,
2397
+ });
2398
+ const items = (settled: boolean) =>
2399
+ [
2400
+ {
2401
+ ...base("prompt", 0, 0),
2402
+ type: "user_message" as const,
2403
+ messageId: MessageId.make("prompt"),
2404
+ text: "Pick a repository",
2405
+ attachments: [],
2406
+ inputIntent: "turn_start" as const,
2407
+ createdBy: "user" as const,
2408
+ creationSource: "web" as const,
2409
+ },
2410
+ command("before", 1, 1),
2411
+ {
2412
+ ...base("question", 2, 2),
2413
+ type: "user_input_request" as const,
2414
+ requestId,
2415
+ questions: [],
2416
+ questionAnswer: {
2417
+ requestId,
2418
+ questionTextById: { scope: "Which repository?" },
2419
+ answers: { scope: "The private one" },
2420
+ attachmentsByQuestionId: {},
2421
+ },
2422
+ },
2423
+ command("after", 3, 3),
2424
+ settled
2425
+ ? {
2426
+ ...base("answer", 4, 5),
2427
+ type: "assistant_message" as const,
2428
+ messageId: MessageId.make("answer"),
2429
+ text: "Done",
2430
+ streaming: false,
2431
+ }
2432
+ : { ...command("running", 4, 4), status: "running" as const, completedAt: null },
2433
+ ].map((item, position) => ({
2434
+ position,
2435
+ visibility: "local" as const,
2436
+ sourceThreadId: threadId,
2437
+ sourceItemId: item.id,
2438
+ item,
2439
+ }));
2440
+ const rows = (settled: boolean, expandedRunIds?: ReadonlySet<RunId>) =>
2441
+ deriveMessagesTimelineRows({
2442
+ timelineEntries: deriveTimelineEntriesFromVisibleTurnItems({
2443
+ visibleTurnItems: items(settled),
2444
+ optimisticMessages: [],
2445
+ }),
2446
+ latestRun: {
2447
+ runId,
2448
+ status: settled ? "completed" : "running",
2449
+ startedAt: DateTime.formatIso(at(0)),
2450
+ completedAt: settled ? DateTime.formatIso(at(5)) : null,
2451
+ },
2452
+ runningRunId: settled ? null : runId,
2453
+ isWorking: !settled,
2454
+ activeTurnStartedAt: settled ? null : DateTime.formatIso(at(0)),
2455
+ ...(expandedRunIds === undefined ? {} : { expandedRunIds }),
2456
+ turnDiffSummaries: [],
2457
+ supportsConversationRollback: false,
2458
+ });
2459
+ const shape = (timeline: ReadonlyArray<MessagesTimelineRow>) =>
2460
+ timeline.map((row) =>
2461
+ row.kind === "turn-fold"
2462
+ ? "fold"
2463
+ : row.kind === "message"
2464
+ ? `${row.message.role}:${row.message.id}`
2465
+ : row.kind === "work" || row.kind === "work-live"
2466
+ ? `${row.kind}:${row.groupedEntries.map((entry) => entry.id).join(" + ")}`
2467
+ : row.kind,
2468
+ );
2469
+
2470
+ expect(shape(rows(true))).toEqual(["user:prompt", "fold", "work:question", "assistant:answer"]);
2471
+ expect(shape(rows(true, new Set([runId])))).toEqual([
2472
+ "user:prompt",
2473
+ "fold",
2474
+ "work:before",
2475
+ "work:question",
2476
+ "work:after",
2477
+ "assistant:answer",
2478
+ ]);
2479
+ expect(shape(rows(false))).toEqual([
2480
+ "user:prompt",
2481
+ "working",
2482
+ "work:before",
2483
+ "work:question",
2484
+ "work-live:after + running",
2485
+ ]);
2486
+ });
2487
+
2488
it("keeps imported V1 turns folded once the thread's first V2 run starts", () => {
2489
const at = (second: number) => `2026-01-01T00:00:${String(second).padStart(2, "0")}Z`;
2490
const message = (
apps/web/src/components/chat/MessagesTimeline.logic.ts
+6
-1
@@ -1086,6 +1086,8 @@ function deriveTurnFolds(input: {
1086
continue;
1087
}
1088
if (entry.kind === "work" && entry.entry.itemType === "notification") continue;
1089
+ // User input stays visible after the surrounding work settles.
1090
+ if (entry.kind === "work" && entry.entry.questionAnswer !== undefined) continue;
1091
hiddenEntryIds.add(entry.id);
1092
}
1093
if (hiddenEntryIds.size === 0) {
@@ -1415,6 +1417,7 @@ export function deriveMessagesTimelineRows(input: {
1417
entry.entry.sourceActivityKind === "runtime.error" ||
1418
entry.entry.itemType === "system_notice" ||
1419
entry.entry.itemType === "notification" ||
1420
+ entry.entry.questionAnswer !== undefined ||
1421
!runIdIsActiveResponse(entry.entry.runId) ||
1422
entry.entry.sourceActivityKind === "context-compaction" ||
1423
collapsedEntryIds.has(entry.id) ||
@@ -1585,7 +1588,8 @@ export function deriveMessagesTimelineRows(input: {
1588
timelineEntry.entry.tone === "error" ||
1589
timelineEntry.entry.sourceActivityKind === "runtime.error" ||
1590
timelineEntry.entry.itemType === "system_notice" ||
1588
- timelineEntry.entry.itemType === "notification"
1591
+ timelineEntry.entry.itemType === "notification" ||
1592
+ timelineEntry.entry.questionAnswer !== undefined
1593
) {
1594
nextRows.push({
1595
kind: "work",
@@ -1608,6 +1612,7 @@ export function deriveMessagesTimelineRows(input: {
1612
nextEntry.entry.sourceActivityKind === "runtime.error" ||
1613
nextEntry.entry.itemType === "system_notice" ||
1614
nextEntry.entry.itemType === "notification" ||
1615
+ nextEntry.entry.questionAnswer !== undefined ||
1616
activeWorkEntryIds.has(nextEntry.id) ||
1617
collapsedEntryIds.has(nextEntry.id) ||
1618
collapsedSupersededEntryIds.has(nextEntry.id) ||