fix(tui): show terminal tool failure labels (#31934)

This commit is contained in:
Aiden Cline 2026-06-11 12:19:31 -05:00 committed by GitHub
commit a150424c16
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 53 additions and 4 deletions

View file

@ -155,6 +155,34 @@ function StickyScrollFixture(props: { separated: boolean; scroll: (scroll: Scrol
)
}
function FailedPendingToolFixture() {
return (
<InlineToolRow
icon="%"
complete={false}
pending="Preparing patch..."
failed={true}
failure="Patch failed"
>
Patch
</InlineToolRow>
)
}
function FailedCompleteToolFixture() {
return (
<InlineToolRow
icon="→"
complete={true}
pending="Reading file..."
failed={true}
failure="Read failed"
>
Read src/index.ts
</InlineToolRow>
)
}
async function renderFrame(component: () => JSX.Element, options: { width: number; height: number }) {
testSetup = await testRender(component, options)
await testSetup.renderOnce()
@ -173,6 +201,18 @@ describe("TUI inline tool wrapping", () => {
expect(toolDisplay("plugin_tool")).toBe("generic")
})
test("replaces pending copy when a tool fails before completion", async () => {
const frame = await renderFrame(() => <FailedPendingToolFixture />, { width: 72, height: 3 })
expect(frame).toContain("Patch failed")
expect(frame).not.toContain("Preparing patch")
})
test("preserves useful completed copy when a tool fails", async () => {
const frame = await renderFrame(() => <FailedCompleteToolFixture />, { width: 72, height: 3 })
expect(frame).toContain("Read src/index.ts")
expect(frame).not.toContain("Read failed")
})
test("filters malformed nested tool wire data", () => {
expect(
parseApplyPatchFiles([