fix(tui): keep retry attempt before message (#30275)
This commit is contained in:
@@ -2228,7 +2228,7 @@ function Task(props: ToolProps<typeof TaskTool>) {
|
|||||||
|
|
||||||
const retrying = retry()
|
const retrying = retry()
|
||||||
if (isRunning() && retrying) {
|
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) {
|
} else if (isRunning() && tools().length > 0) {
|
||||||
if (current()) {
|
if (current()) {
|
||||||
const state = current()!.state
|
const state = current()!.state
|
||||||
@@ -2274,6 +2274,10 @@ export function formatSubagentTitle(agent: string, description: string, backgrou
|
|||||||
return `${agent} Task${background ? " (background)" : ""} — ${description}`
|
return `${agent} Task${background ? " (background)" : ""} — ${description}`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function formatSubagentRetry(attempt: number, message: string) {
|
||||||
|
return `Retrying (attempt ${attempt}) · ${message}`
|
||||||
|
}
|
||||||
|
|
||||||
export function formatCompletedSubagentDetail(toolcalls: number, duration: string) {
|
export function formatCompletedSubagentDetail(toolcalls: number, duration: string) {
|
||||||
if (toolcalls === 0) return duration
|
if (toolcalls === 0) return duration
|
||||||
return `${formatSubagentToolcalls(toolcalls)} · ${duration}`
|
return `${formatSubagentToolcalls(toolcalls)} · ${duration}`
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ import { For } from "solid-js"
|
|||||||
import { testRender, type JSX } from "@opentui/solid"
|
import { testRender, type JSX } from "@opentui/solid"
|
||||||
import {
|
import {
|
||||||
formatCompletedSubagentDetail,
|
formatCompletedSubagentDetail,
|
||||||
|
formatSubagentRetry,
|
||||||
formatSubagentTitle,
|
formatSubagentTitle,
|
||||||
formatSubagentToolcalls,
|
formatSubagentToolcalls,
|
||||||
InlineToolRow,
|
InlineToolRow,
|
||||||
@@ -155,6 +156,12 @@ describe("TUI inline tool wrapping", () => {
|
|||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
test("keeps retry status ahead of wrapping messages", () => {
|
||||||
|
expect(formatSubagentRetry(2, "Rate limited by provider")).toBe(
|
||||||
|
"Retrying (attempt 2) · Rate limited by provider",
|
||||||
|
)
|
||||||
|
})
|
||||||
|
|
||||||
test("snapshots consecutive grep, glob, and read rows at a narrow width", async () => {
|
test("snapshots consecutive grep, glob, and read rows at a narrow width", async () => {
|
||||||
expect(await renderFrame(() => <Fixture />, { width: 72, height: 12 })).toMatchSnapshot()
|
expect(await renderFrame(() => <Fixture />, { width: 72, height: 12 })).toMatchSnapshot()
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user