From 5519620588bdd942c83a020260f59b77ca2ba3ff Mon Sep 17 00:00:00 2001 From: Kit Langton Date: Mon, 1 Jun 2026 15:04:21 -0400 Subject: [PATCH] fix(tui): keep retry attempt before message --- packages/opencode/src/cli/cmd/tui/routes/session/index.tsx | 6 +++++- .../test/cli/tui/inline-tool-wrap-snapshot.test.tsx | 5 +++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/packages/opencode/src/cli/cmd/tui/routes/session/index.tsx b/packages/opencode/src/cli/cmd/tui/routes/session/index.tsx index e2260548b0..5b2ca04c63 100644 --- a/packages/opencode/src/cli/cmd/tui/routes/session/index.tsx +++ b/packages/opencode/src/cli/cmd/tui/routes/session/index.tsx @@ -2228,7 +2228,7 @@ function Task(props: ToolProps) { const retrying = retry() if (isRunning() && retrying) { - content.push(`↳ ${Locale.truncate(retrying.message, 80)} [retrying attempt #${retrying.attempt}]`) + content.push(`↳ ${formatSubagentRetry(retrying.attempt, Locale.truncate(retrying.message, 80))}`) } else if (isRunning() && tools().length > 0) { if (current()) { const state = current()!.state @@ -2274,6 +2274,10 @@ export function formatSubagentTitle(agent: string, description: string, backgrou return `${agent} Task${background ? " (background)" : ""} — ${description}` } +export function formatSubagentRetry(attempt: number, message: string) { + return `Retry #${attempt} · ${message}` +} + export function formatCompletedSubagentDetail(toolcalls: number, duration: string) { if (toolcalls === 0) return duration return `${formatSubagentToolcalls(toolcalls)} · ${duration}` diff --git a/packages/opencode/test/cli/tui/inline-tool-wrap-snapshot.test.tsx b/packages/opencode/test/cli/tui/inline-tool-wrap-snapshot.test.tsx index d06f4a47e2..5a60264cd5 100644 --- a/packages/opencode/test/cli/tui/inline-tool-wrap-snapshot.test.tsx +++ b/packages/opencode/test/cli/tui/inline-tool-wrap-snapshot.test.tsx @@ -3,6 +3,7 @@ import { For } from "solid-js" import { testRender, type JSX } from "@opentui/solid" import { formatCompletedSubagentDetail, + formatSubagentRetry, formatSubagentTitle, formatSubagentToolcalls, InlineToolRow, @@ -155,6 +156,10 @@ describe("TUI inline tool wrapping", () => { ) }) + test("keeps retry status ahead of wrapping messages", () => { + expect(formatSubagentRetry(2, "Rate limited by provider")).toBe("Retry #2 · Rate limited by provider") + }) + test("snapshots consecutive grep, glob, and read rows at a narrow width", async () => { expect(await renderFrame(() => , { width: 72, height: 12 })).toMatchSnapshot() })