diff --git a/packages/core/test/tool-shell.test.ts b/packages/core/test/tool-shell.test.ts
index 4ba88464d7..f96f55924a 100644
--- a/packages/core/test/tool-shell.test.ts
+++ b/packages/core/test/tool-shell.test.ts
@@ -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.",
diff --git a/packages/tui/src/routes/session/index.tsx b/packages/tui/src/routes/session/index.tsx
index 1be96e4cde..1290e52579 100644
--- a/packages/tui/src/routes/session/index.tsx
+++ b/packages/tui/src/routes/session/index.tsx
@@ -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) ? (
Background
) : undefined
}
@@ -3200,7 +3200,7 @@ function Subagent(props: ToolProps) {
)
}
-export function isBackgroundSubagent(
+export function isBackgroundTool(
metadata: Record,
status: SessionMessageAssistantTool["state"]["status"],
) {
diff --git a/packages/tui/test/cli/tui/inline-tool-wrap-snapshot.test.tsx b/packages/tui/test/cli/tui/inline-tool-wrap-snapshot.test.tsx
index e6958334c9..c1f9af8bb9 100644
--- a/packages/tui/test/cli/tui/inline-tool-wrap-snapshot.test.tsx
+++ b/packages/tui/test/cli/tui/inline-tool-wrap-snapshot.test.tsx
@@ -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 () => {