Skip to content

Commit bedf95b

Browse files
SunkenInTimeclaude
andcommitted
fix(web): background command line leads with its name and quiets Stop
Claude labels a background command with a prose description, and the line set any command label in monospace next to a sans "Running", with a white Stop as the loudest thing on it. The line now leads with the name, says "running in background", uses monospace only for a label that is the command itself, and mutes Stop after the elapsed time. The shared title reads the same way, so the mobile status pill follows. Co-Authored-By: Claude Opus 5.5 <[email protected]>
1 parent 9826dbb commit bedf95b

2 files changed

Lines changed: 56 additions & 34 deletions

File tree

‎apps/web/src/components/chat/ThreadActivityBanners.tsx‎

Lines changed: 42 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ import {
2121
} from "lucide-react";
2222
import { Fragment } from "react";
2323
import { tickTextContent } from "~/lib/tickTextContent";
24-
import { cn } from "~/lib/utils";
2524
import { Button, InlineButton } from "../ui/button";
2625
import { Tooltip, TooltipPopup, TooltipTrigger } from "../ui/tooltip";
2726
import type { ComposerBannerStackItem } from "./ComposerBannerStack";
@@ -126,6 +125,8 @@ export function backgroundWorkNowItem(input: {
126125
const subagent = item?.type === "subagent" ? item : undefined;
127126
return {
128127
task,
128+
// Claude labels a command with a prose description; only the command itself is code.
129+
isRawCommand: item?.type === "command_execution" && item.input.trim() === task.label,
129130
activity: subagent?.progress?.replace(/\s+/gu, " ").trim() || null,
130131
startedAtMs: item?.startedAt ? DateTime.toEpochMillis(item.startedAt) : null,
131132
updatedAtMs: subagent ? DateTime.toEpochMillis(subagent.updatedAt) : 0,
@@ -136,46 +137,61 @@ export function backgroundWorkNowItem(input: {
136137
const newest = rows
137138
.filter((row) => row.activity)
138139
.toSorted((left, right) => right.updatedAtMs - left.updatedAtMs)[0];
139-
const isCommand = (row: (typeof rows)[number]) => row.task.kind !== "subagent";
140-
const verb = presentation.waiting ? "Waiting on" : "Running";
140+
const label = (row: (typeof rows)[number]) =>
141+
row.isRawCommand ? <span className="font-mono">{row.task.label}</span> : row.task.label;
141142
const onlyThreadId = only?.childThreadId;
142143
const startedAtMs = only?.startedAtMs ?? null;
143144
return {
144145
id: `background-work:${input.threadId}`,
145-
icon: rows.every(isCommand) ? <TerminalIcon /> : <CircleDashedIcon />,
146-
title: only ? (
147-
<>
148-
{verb} <span className={cn(isCommand(only) && "font-mono")}>{only.task.label}</span>
149-
</>
150-
) : (
151-
presentation.title
152-
),
153-
description: only ? (
154-
only.activity
155-
) : newest ? (
156-
`${newest.task.label}: ${newest.activity}`
157-
) : rows.every(isCommand) ? (
158-
<span className="font-mono">{rows.map((row) => row.task.label).join(", ")}</span>
146+
icon: rows.every((row) => row.task.kind !== "subagent") ? (
147+
<TerminalIcon />
159148
) : (
160-
rows.map((row) => row.task.label).join(", ")
149+
<CircleDashedIcon />
161150
),
151+
title:
152+
only?.task.named === true ? (
153+
<>
154+
{presentation.waiting ? "Waiting on " : null}
155+
<span className="text-foreground/80">{label(only)}</span>
156+
</>
157+
) : (
158+
<span className="text-foreground/80">{presentation.title}</span>
159+
),
160+
description: only
161+
? (only.activity ??
162+
(presentation.waiting || !only.task.named ? null : "running in background"))
163+
: newest
164+
? `${newest.task.label}: ${newest.activity}`
165+
: rows.map((row, index) => (
166+
<Fragment key={row.task.taskId}>
167+
{index > 0 ? ", " : null}
168+
{label(row)}
169+
</Fragment>
170+
)),
162171
actions: (
163172
<>
164173
{startedAtMs === null ? null : (
165-
<span
166-
ref={tickTextContent(
167-
(nowMs) => formatDuration(Math.max(1_000, nowMs - startedAtMs)),
168-
true,
169-
)}
170-
className="tabular-nums"
171-
/>
174+
<>
175+
<span
176+
ref={tickTextContent(
177+
(nowMs) => formatDuration(Math.max(1_000, nowMs - startedAtMs)),
178+
true,
179+
)}
180+
className="tabular-nums"
181+
/>
182+
<span aria-hidden>·</span>
183+
</>
172184
)}
173185
{onlyThreadId === undefined ? null : (
174186
<InlineButton tone="muted" onClick={() => onOpenThread(onlyThreadId)}>
175187
Open
176188
</InlineButton>
177189
)}
178-
<InlineButton disabled={input.stopDisabled} onClick={() => void input.onStop()}>
190+
<InlineButton
191+
tone="muted"
192+
disabled={input.stopDisabled}
193+
onClick={() => void input.onStop()}
194+
>
179195
{input.stopping ? "Stopping..." : "Stop"}
180196
</InlineButton>
181197
</>

‎packages/client-runtime/src/state/threadExecution.ts‎

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -297,6 +297,8 @@ export interface PendingBackgroundWorkItem {
297297
readonly taskId: string;
298298
readonly kind: BackgroundWorkKind;
299299
readonly label: string;
300+
/** False when the label is only the kind's noun, such as "command". */
301+
readonly named: boolean;
300302
readonly childThreadId: ThreadId | undefined;
301303
}
302304

@@ -323,13 +325,12 @@ export function presentPendingBackgroundWork(
323325
task.kind === "subagent" && description !== undefined
324326
? formatSubagentDisplayTitle(description).trim()
325327
: description;
328+
const named = label !== undefined && label.length > 0;
326329
return {
327330
taskId: task.taskId,
328331
kind: task.kind,
329-
label:
330-
label === undefined || label.length === 0
331-
? BACKGROUND_WORK_KINDS[task.kind].singular
332-
: label,
332+
label: named ? label : BACKGROUND_WORK_KINDS[task.kind].singular,
333+
named,
333334
childThreadId: task.kind === "subagent" ? task.childThreadId : undefined,
334335
};
335336
})
@@ -341,14 +342,14 @@ export function presentPendingBackgroundWork(
341342
const [only] = items;
342343
if (items.length === 1 && only !== undefined) {
343344
const noun = BACKGROUND_WORK_KINDS[only.kind].singular;
344-
const named = only.label !== noun;
345+
const { named } = only;
345346
const title = waiting
346347
? named
347348
? `${only.kind === "monitor" ? "" : `Waiting on ${noun} `}${only.label}`
348349
: `Waiting on a ${noun}`
349350
: named
350-
? `Running: ${only.label}`
351-
: `Running a ${noun}`;
351+
? `${only.label} running in background`
352+
: `A ${noun} running in background`;
352353
return { title, items, waiting };
353354
}
354355
const counts = new Map<BackgroundWorkKind, number>();
@@ -357,7 +358,12 @@ export function presentPendingBackgroundWork(
357358
const { singular, plural } = BACKGROUND_WORK_KINDS[kind];
358359
return `${count} ${count === 1 ? singular : plural}`;
359360
});
360-
return { title: `${waiting ? "Waiting on" : "Running"} ${joinWithAnd(groups)}`, items, waiting };
361+
const groupsText = joinWithAnd(groups);
362+
return {
363+
title: waiting ? `Waiting on ${groupsText}` : `${groupsText} running in background`,
364+
items,
365+
waiting,
366+
};
361367
}
362368

363369
export interface ProviderGoalPresentation {

0 commit comments

Comments
 (0)