Skip to content

Commit ee1bb23

Browse files
t3dotggclaude
andcommitted
fix(web): stopped calls in tool cards show a stopped mark, and card polish
Co-Authored-By: Claude Opus 5.5 <[email protected]>
1 parent 125d5d6 commit ee1bb23

5 files changed

Lines changed: 44 additions & 22 deletions

File tree

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

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -293,13 +293,12 @@ function WorkEntryLogRow(props: WorkEntryRowProps) {
293293
? "Thinking"
294294
: "Thought"
295295
: questionHeading ||
296-
(displayLabel ??
297-
(toolCallCards && workEntry.command
298-
? withoutWorkspaceRoot(
299-
withoutLeadingCd(workEntryDisplayLabel(workEntry, workspaceRoot)),
300-
workspaceRoot,
301-
)
302-
: workEntryDisplayLabel(workEntry, workspaceRoot)));
296+
(toolCallCards && workEntry.command
297+
? withoutWorkspaceRoot(
298+
withoutLeadingCd(displayLabel ?? workEntryDisplayLabel(workEntry, workspaceRoot)),
299+
workspaceRoot,
300+
)
301+
: (displayLabel ?? workEntryDisplayLabel(workEntry, workspaceRoot)));
303302
const answerPreview =
304303
workEntry.questionAnswer && hasQuestionAnswer(workEntry.questionAnswer)
305304
? getQuestionAnswerPreview(workEntry.questionAnswer)
@@ -380,9 +379,11 @@ function WorkEntryLogRow(props: WorkEntryRowProps) {
380379
? "font-medium text-destructive"
381380
: cardState !== "none"
382381
? "text-foreground/90"
383-
: workLogEntryIsToolLike(workEntry)
384-
? "text-secondary-label"
385-
: "text-foreground/80";
382+
: toolCallCards && isReasoning
383+
? "text-muted-foreground"
384+
: workLogEntryIsToolLike(workEntry)
385+
? "text-secondary-label"
386+
: "text-foreground/80";
386387
const threadLabel = isReasoning ? null : threadReadLabel(previewText, threadTarget);
387388
const accessiblePreview = [threadLabel?.text ?? previewText, answerPreview]
388389
.filter(Boolean)
@@ -398,8 +399,8 @@ function WorkEntryLogRow(props: WorkEntryRowProps) {
398399
]
399400
.filter(Boolean)
400401
.join(", ")
401-
: cardState === "running"
402-
? `${accessiblePreview}, running`
402+
: cardState === "running" || cardState === "stopped"
403+
? `${accessiblePreview}, ${cardState}`
403404
: cardState === "done"
404405
? `${accessiblePreview}, completed${callDurationMs !== null ? ` in ${formatDuration(callDurationMs)}` : ""}`
405406
: accessiblePreview;

‎apps/web/src/components/chat/ToolCallCard.logic.test.ts‎

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,12 @@ import { ThreadId, TurnItemId } from "@t3tools/contracts";
22
import * as DateTime from "effect/DateTime";
33
import { describe, expect, it } from "vite-plus/test";
44
import type { WorkLogEntry } from "../../session-logic";
5-
import { toolGroupStats, withoutLeadingCd, withoutWorkspaceRoot } from "./ToolCallCard.logic";
5+
import {
6+
toolCallState,
7+
toolGroupStats,
8+
withoutLeadingCd,
9+
withoutWorkspaceRoot,
10+
} from "./ToolCallCard.logic";
611

712
const at = (ms: number) => DateTime.makeUnsafe(new Date(Date.UTC(2026, 9, 27, 12, 0, 0, ms)));
813

@@ -77,3 +82,11 @@ describe("withoutWorkspaceRoot", () => {
7782
);
7883
});
7984
});
85+
86+
describe("toolCallState", () => {
87+
it("marks an unfinished call outside the working run as stopped, not done", () => {
88+
const entry = { ...commandEntry("a", 0, 400), toolLifecycleStatus: "inProgress" as const };
89+
expect(toolCallState(entry, true)).toBe("running");
90+
expect(toolCallState(entry, false)).toBe("stopped");
91+
});
92+
});

‎apps/web/src/components/chat/ToolCallCard.logic.ts‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { workLogEntryIsToolLike, workEntryDisplayIndicatesToolFailure } from "..
22
import type { WorkLogEntry } from "../../session-logic";
33
import * as DateTime from "effect/DateTime";
44

5-
export type ToolCallState = "running" | "done" | "failed" | "none";
5+
export type ToolCallState = "running" | "done" | "failed" | "stopped" | "none";
66

77
function entryItem(entry: WorkLogEntry) {
88
return entry.projectedItem?.item ?? entry.structuredPayload;
@@ -30,7 +30,10 @@ export function toolCallStartedAt(entry: WorkLogEntry): string {
3030
export function toolCallState(entry: WorkLogEntry, live: boolean): ToolCallState {
3131
if (!workLogEntryIsToolLike(entry) || entry.itemType === "reasoning") return "none";
3232
if (workEntryDisplayIndicatesToolFailure(entry)) return "failed";
33-
if (entry.toolLifecycleStatus === "inProgress") return live ? "running" : "none";
33+
// An unfinished call outside the working run was interrupted; it must not read as done.
34+
if (entry.toolLifecycleStatus === "inProgress" || entry.toolLifecycleStatus === "stopped") {
35+
return live && entry.toolLifecycleStatus === "inProgress" ? "running" : "stopped";
36+
}
3437
return "done";
3538
}
3639

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ const cardFrame = "border-border bg-foreground/[0.025]";
1717
const toolCardClassName = {
1818
whole: cn(cardFrame, "mt-1.5 rounded-xl border"),
1919
top: cn(cardFrame, "mt-1.5 rounded-t-xl border border-b-0"),
20-
bottom: cn(cardFrame, "rounded-b-xl border border-t-0"),
20+
bottom: cn(cardFrame, "mb-2 rounded-b-xl border border-t-0"),
2121
};
2222

2323
function entryIconKey(entry: TimelineWorkEntry) {
@@ -40,16 +40,16 @@ function ToolStack({ entries }: { entries: ReadonlyArray<TimelineWorkEntry> }) {
4040
if (seen.size === STACK_LIMIT) break;
4141
}
4242
return (
43-
<span className="flex shrink-0 items-center [&>*+*]:-ms-1.5" aria-hidden>
43+
<span className="flex shrink-0 items-center [&>*+*]:-ms-1" aria-hidden>
4444
{[...seen].map(([key, entry]) => (
4545
<span
4646
key={key}
47-
className="flex size-5 items-center justify-center rounded-full bg-background text-icon-muted ring-1 ring-foreground/15"
47+
className="flex size-5 items-center justify-center rounded-full bg-muted text-icon-muted ring-2 ring-background"
4848
>
4949
<ToolActivityIconView
5050
icon={entry.toolIcon ?? entry.toolSource?.icon}
5151
fallbackName={workEntryIconName(entry)}
52-
className="block size-3 shrink-0 stroke-2"
52+
className="block size-3.5 shrink-0 stroke-2"
5353
muted={false}
5454
/>
5555
</span>
@@ -92,7 +92,7 @@ function CardHeader(props: {
9292
)}
9393
>
9494
<ToolStack entries={props.entries} />
95-
<span className="min-w-0 truncate text-secondary-label">{props.label}</span>
95+
<span className="min-w-0 truncate text-muted-foreground">{props.label}</span>
9696
{props.failedCount > 0 ? (
9797
<span className="shrink-0 text-destructive-foreground before:me-2 before:text-muted-foreground before:content-['·']">
9898
{props.failedCount} failed

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

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { CheckIcon, CircleDashedIcon, XIcon } from "lucide-react";
1+
import { CheckIcon, CircleDashedIcon, MinusIcon, XIcon } from "lucide-react";
22
import { use } from "react";
33
import { formatDuration, type WorkLogEntry } from "../../session-logic";
44
import { cn } from "~/lib/utils";
@@ -33,13 +33,18 @@ function StatusGlyph({ state }: { state: ToolCallState }) {
3333
if (state === "failed") {
3434
return <XIcon className="size-3.5 shrink-0 text-destructive-foreground" aria-hidden />;
3535
}
36+
if (state === "stopped") {
37+
return <MinusIcon className="size-3.5 shrink-0 text-muted-foreground" aria-hidden />;
38+
}
3639
return <CircleDashedIcon className="size-3.5 shrink-0 text-foreground/80" aria-hidden />;
3740
}
3841

3942
/** Trailing result note, duration, and status for one call. Running calls tick their elapsed time. */
4043
export function ToolCallMeta({ entry, state }: { entry: WorkLogEntry; state: ToolCallState }) {
4144
const { timestampFormat } = use(TimelineRowCtx);
42-
if (state === "none") return null;
45+
if (state === "none") {
46+
return <TimelineRowTimestamp createdAt={entry.createdAt} timestampFormat={timestampFormat} />;
47+
}
4348
const durationMs = state === "done" || state === "failed" ? toolCallDurationMs(entry) : null;
4449
const note = state === "failed" ? toolCallResultNote(entry) : null;
4550
const startedAt = toolCallStartedAt(entry);

0 commit comments

Comments
 (0)