Skip to content
TypeScript

fix(web): keep task updates static in the timeline (#31888)

Yash Singhef81fd15cae6
diff --git a/apps/web/src/components/chat/MessagesTimeline.logic.test.ts b/apps/web/src/components/chat/MessagesTimeline.logic.test.ts
index 5331f2c2cfd..ba0f508ebee 100644
--- a/apps/web/src/components/chat/MessagesTimeline.logic.test.ts
+++ b/apps/web/src/components/chat/MessagesTimeline.logic.test.ts
@@ -55,6 +55,75 @@ describe("resolveAssistantMessageCopyState", () => {
});
describe("deriveMessagesTimelineRows", () => {
+ it.each(["alone", "before tool", "before commentary and tool"])(
+ "keeps an unfinished task update static %s",
+ (placement) => {
+ const runId = RunId.make("task-update-run");
+ const at = "2026-11-06T00:00:00Z";
+ const tasks: TimelineEntry = {
+ kind: "work",
+ id: "tasks",
+ createdAt: at,
+ entry: {
+ id: "tasks",
+ runId,
+ createdAt: at,
+ itemType: "todo_list",
+ tone: "info",
+ label: "Tasks 0/1 · Inspect the captures",
+ toolLifecycleStatus: "inProgress",
+ },
+ };
+ const commentary: TimelineEntry = {
+ kind: "message",
+ id: "commentary",
+ createdAt: at,
+ message: {
+ id: MessageId.make("commentary"),
+ role: "assistant",
+ text: "Checking the rendering.",
+ runId,
+ streaming: false,
+ createdAt: at,
+ updatedAt: at,
+ },
+ };
+ const tool: TimelineEntry = {
+ kind: "work",
+ id: "tool",
+ createdAt: at,
+ entry: {
+ id: "tool",
+ runId,
+ createdAt: at,
+ label: "Running sed",
+ command: "sed",
+ tone: "tool",
+ toolLifecycleStatus: "inProgress",
+ },
+ };
+ const rows = deriveMessagesTimelineRows({
+ timelineEntries: [
+ tasks,
+ ...(placement === "before commentary and tool" ? [commentary] : []),
+ ...(placement === "alone" ? [] : [tool]),
+ ],
+ runningRunId: runId,
+ isWorking: true,
+ activeTurnStartedAt: at,
+ turnDiffSummaries: [],
+ supportsConversationRollback: false,
+ });
+ expect(rows.find((row) => row.id === "tasks")).toMatchObject({
+ kind: "work",
+ groupedEntries: [tasks.entry],
+ });
+ expect(rows.filter((row) => row.kind === "work-live" && row.active)).toEqual(
+ placement === "alone" ? [] : [expect.objectContaining({ entry: tool.entry })],
+ );
+ },
+ );
+
it("stops stranded thinking after a steer and follows the next thought or tool", () => {
const runId = RunId.make("steered-run");
const at = "2026-10-01T06:19:10Z";
diff --git a/apps/web/src/components/chat/MessagesTimeline.logic.ts b/apps/web/src/components/chat/MessagesTimeline.logic.ts
index a74f24859cf..4536e9a2503 100644
--- a/apps/web/src/components/chat/MessagesTimeline.logic.ts
+++ b/apps/web/src/components/chat/MessagesTimeline.logic.ts
@@ -1627,6 +1627,7 @@ export function deriveMessagesTimelineRows(input: {
entry.entry.sourceActivityKind === "runtime.error" ||
entry.entry.itemType === "system_notice" ||
entry.entry.itemType === "notification" ||
+ entry.entry.itemType === "todo_list" ||
entry.entry.questionAnswer !== undefined ||
isPendingApproval(entry.entry) ||
!runIdIsActiveResponse(entry.entry.runId) ||
@@ -1925,6 +1926,7 @@ export function deriveMessagesTimelineRows(input: {
timelineEntry.entry.sourceActivityKind === "runtime.error" ||
timelineEntry.entry.itemType === "system_notice" ||
timelineEntry.entry.itemType === "notification" ||
+ timelineEntry.entry.itemType === "todo_list" ||
timelineEntry.entry.questionAnswer !== undefined
) {
nextRows.push({
@@ -1950,6 +1952,7 @@ export function deriveMessagesTimelineRows(input: {
nextEntry.entry.sourceActivityKind === "runtime.error" ||
nextEntry.entry.itemType === "system_notice" ||
nextEntry.entry.itemType === "notification" ||
+ nextEntry.entry.itemType === "todo_list" ||
nextEntry.entry.questionAnswer !== undefined ||
isPendingApproval(nextEntry.entry) ||
activeWorkEntryIds.has(nextEntry.id) ||