Compare commits

...
Author SHA1 Message Date
Aiden Cline a7e7646282 fix(tui): hide background badge on interrupted shells 2026-08-16 22:17:13 +00:00
3 changed files with 12 additions and 11 deletions
+2 -2
View File
@@ -722,7 +722,7 @@ describe("ShellTool", () => {
)
const settled = yield* executeTool(registry, call({ command: idleCommand, timeout: 50, background: true }))
const shellID = typeof settled.metadata?.shellID === "string" ? settled.metadata.shellID : undefined
expect(settled.metadata).toMatchObject({ truncated: false })
expect(settled.metadata).toMatchObject({ status: "running", truncated: false })
expect(shellID).toStartWith("sh_")
const shell = yield* Shell.Service
@@ -807,7 +807,7 @@ describe("ShellTool", () => {
expect(yield* backgroundWhenReady()).toMatchObject([{ id: "call-background-signal", type: "shell" }])
const settled = yield* Fiber.join(waiting)
const shellID = typeof settled.metadata?.shellID === "string" ? settled.metadata.shellID : undefined
expect(settled.metadata).toMatchObject({ truncated: false })
expect(settled.metadata).toMatchObject({ status: "running", truncated: false })
expect(settled.content?.[0]).toEqual({
type: "text",
text: "The command was moved to the background.",
+3 -3
View File
@@ -2930,7 +2930,7 @@ function Shell(props: ToolProps) {
const permission = useToolPermission(() => props.part)
const color = createMemo(() => (permission() ? theme.text.feedback.warning.default : theme.text.default))
const shellID = createMemo(() => stringValue(props.metadata.shellID))
const background = createMemo(() => Boolean(shellID()) && props.part.state.status !== "running")
const background = createMemo(() => isBackgroundTool(props.metadata, props.part.state.status))
const backgroundRunning = createMemo(() => {
const id = shellID()
return Boolean(id && data.shell.get(id))
@@ -3190,7 +3190,7 @@ function Subagent(props: ToolProps) {
if (id) navigate({ type: "session", sessionID: id })
}}
status={
isBackgroundSubagent(props.metadata, props.part.state.status) ? (
isBackgroundTool(props.metadata, props.part.state.status) ? (
<StatusBadge>Background</StatusBadge>
) : undefined
}
@@ -3200,7 +3200,7 @@ function Subagent(props: ToolProps) {
)
}
export function isBackgroundSubagent(
export function isBackgroundTool(
metadata: Record<string, unknown>,
status: SessionMessageAssistantTool["state"]["status"],
) {
@@ -4,7 +4,7 @@ import { testRender, type JSX } from "@opentui/solid"
import {
InlineToolRow,
executeCallSummary,
isBackgroundSubagent,
isBackgroundTool,
parseApplyPatchFiles,
parseDiagnostics,
parseQuestionAnswers,
@@ -214,11 +214,12 @@ describe("TUI inline tool wrapping", () => {
).toEqual([{ message: "valid", range: { start: { line: 2, character: 3 } } }])
})
test("labels only detached or async subagents as background", () => {
expect(isBackgroundSubagent({ status: "running" }, "running")).toBeFalse()
expect(isBackgroundSubagent({ status: "running" }, "completed")).toBeTrue()
expect(isBackgroundSubagent({ status: "running" }, "error")).toBeFalse()
expect(isBackgroundSubagent({ status: "completed" }, "completed")).toBeFalse()
test("labels only detached or async tools as background", () => {
expect(isBackgroundTool({ status: "running" }, "running")).toBeFalse()
expect(isBackgroundTool({ status: "running" }, "completed")).toBeTrue()
expect(isBackgroundTool({ status: "running" }, "error")).toBeFalse()
expect(isBackgroundTool({ status: "completed" }, "completed")).toBeFalse()
expect(isBackgroundTool({}, "completed")).toBeFalse()
})
test("snapshots consecutive grep, glob, and read rows at a narrow width", async () => {