From 8a2966fdbedef2122bc53ca95d5e408f68655381 Mon Sep 17 00:00:00 2001 From: Brendan Allan <14191578+Brendonovich@users.noreply.github.com> Date: Sat, 22 Aug 2026 19:49:22 +0800 Subject: [PATCH] fix(app): avoid duplicate retry errors (#44124) --- .../session-ui/src/timeline/projection.ts | 3 +- .../src/timeline/rows-current.test.ts | 29 +++++++++++++++++++ 2 files changed, 30 insertions(+), 2 deletions(-) diff --git a/packages/session-ui/src/timeline/projection.ts b/packages/session-ui/src/timeline/projection.ts index cfa2ed83c50..0ea4dc83466 100644 --- a/packages/session-ui/src/timeline/projection.ts +++ b/packages/session-ui/src/timeline/projection.ts @@ -291,8 +291,7 @@ export namespace Timeline { } if (isActive && retry) rows.push(new TimelineRow.Retry({ userMessageID: turnID })) - - if (error && !interrupted) { + else if (error && !interrupted) { rows.push(new TimelineRow.Error({ userMessageID: turnID, text: unwrapErrorMessage(error.message) })) } diff --git a/packages/session-ui/src/timeline/rows-current.test.ts b/packages/session-ui/src/timeline/rows-current.test.ts index 0dccd416cdd..2428b00aa0c 100644 --- a/packages/session-ui/src/timeline/rows-current.test.ts +++ b/packages/session-ui/src/timeline/rows-current.test.ts @@ -217,6 +217,35 @@ describe("current session timeline rows", () => { expect(result.rows.map((row) => row._tag)).toEqual(["UserMessage", "Retry"]) }) + test("does not render the retry error twice", () => { + const source = [ + { id: "msg_user", type: "user", text: "retry", time: { created: 1 } }, + { + id: "msg_assistant", + type: "assistant", + agent: "build", + model: { id: "model", providerID: "provider" }, + content: [], + error: { type: "ProviderError", message: "The provider response ended unexpectedly." }, + retry: { + attempt: 2, + at: 10, + error: { type: "ProviderError", message: "The provider response ended unexpectedly." }, + }, + time: { created: 2 }, + }, + ] satisfies SessionMessageInfo[] + + const result = Timeline.constructSessionMessageRows(source, true, { + type: "retry", + attempt: 2, + next: 10, + message: "The provider response ended unexpectedly.", + }) + + expect(result.rows.map((row) => row._tag)).toEqual(["UserMessage", "Retry"]) + }) + test("removes a failed assistant error when the turn continues streaming", () => { const source = [ { id: "msg_user", type: "user", text: "recover", time: { created: 1 } },