fix(app): avoid duplicate retry errors (#44124)

This commit is contained in:
Brendan Allan 2026-08-22 19:49:22 +08:00 committed by GitHub
parent 4aca1be945
commit 8a2966fdbe
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 30 additions and 2 deletions

View file

@ -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) }))
}

View file

@ -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 } },