From 047d9255ce34a042df97bfca7130d8ceddc3ebb6 Mon Sep 17 00:00:00 2001 From: Aiden Cline Date: Wed, 12 Aug 2026 15:00:41 +0000 Subject: [PATCH] fix(tui): hide background badge on interrupted shells --- packages/core/src/tool/plugin/shell.ts | 1 + packages/core/test/tool-shell.test.ts | 4 ++-- packages/tui/src/routes/session/index.tsx | 4 +++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/packages/core/src/tool/plugin/shell.ts b/packages/core/src/tool/plugin/shell.ts index 367e9eee51..d11c57bad0 100644 --- a/packages/core/src/tool/plugin/shell.ts +++ b/packages/core/src/tool/plugin/shell.ts @@ -286,6 +286,7 @@ export const Plugin = { output, content, metadata: { + status: output.status, truncated: output.truncated, ...("exit" in output && output.exit !== undefined ? { exit: output.exit } : {}), ...("shellID" in output && output.shellID !== undefined ? { shellID: output.shellID } : {}), diff --git a/packages/core/test/tool-shell.test.ts b/packages/core/test/tool-shell.test.ts index e3170a406f..d1a6270cb0 100644 --- a/packages/core/test/tool-shell.test.ts +++ b/packages/core/test/tool-shell.test.ts @@ -667,7 +667,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 @@ -752,7 +752,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 2b0af18e7f..857008ced6 100644 --- a/packages/tui/src/routes/session/index.tsx +++ b/packages/tui/src/routes/session/index.tsx @@ -2779,7 +2779,9 @@ 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( + () => props.part.state.status === "completed" && props.metadata.status === "running", + ) const backgroundRunning = createMemo(() => { const id = shellID() return Boolean(id && data.shell.get(id))