@devries-cameron20 / t3code Mirror · read-only / commits / 9294a9801e
Fork 0

The best way to control Claude Code, Codex and more from any computer or phone

Mirrored from https://github.com/Camo67/t3code.git

Synced Nov 21, 03:37 UTC

fix(acp,web): stop showing "Running Ran" for commandless ACP tool calls (#39837)

Co-authored-by: Julius Marminge <julius0216@outlook.com>

Charles Bine committed Nov 20, 2026 at 16:09 UTC 9294a9801e804646dbce0cad78fea1102e6c98ce
7 files changed +260 -20
apps/mobile/src/lib/threadActivity.test.ts
+31
@@ -740,6 +740,37 @@ describe("buildThreadFeed", () => {
740 expect(summarizeToolGroup([activity.workEntry]).summary).toBe("Changed 3 files");
741 });
742
743 + it("labels a running command without command text by its status", () => {
744 + const item: OrchestrationV2TurnItem = {
745 + ...base("commandless", "2026-06-20T00:00:02.000Z", 1),
746 + type: "command_execution",
747 + title: "Ran command",
748 + status: "running",
749 + completedAt: null,
750 + runId: null,
751 + input: "",
752 + };
753 + const feed = buildThreadFeed([
754 + projected({ ...userMessage(), runId: null }, 0),
755 + projected(item, 1),
756 + ]);
757 + const activity = feed.flatMap((entry) =>
758 + entry.type === "activity-group" ? entry.activities : [],
759 + )[0]!;
760 + expect(workEntryRowLabel(activity.workEntry)).toBe("Running command");
761 + const presented = deriveThreadFeedPresentation(
762 + feed,
763 + null,
764 + new Set(),
765 + new Set(),
766 + "2026-06-20T00:00:01.000Z",
767 + true,
768 + );
769 + expect(presented.find((entry) => entry.type === "activity-group")).toMatchObject({
770 + activities: [{ live: true, groupStandIn: { label: "Running command" } }],
771 + });
772 + });
773 +
774 it("anchors feedback before later committed turns", () => {
775 const laterUser = {
776 ...userMessage("2026-08-29T00:00:05.000Z"),
apps/mobile/src/lib/threadActivity.ts
+11 -1
@@ -21,6 +21,7 @@ import {
21 commandProgramName,
22 } from "@t3tools/client-runtime/work-log/command-label";
23 import {
24 + commandlessCommandLabel,
25 contextCompactionLabel,
26 liveThoughtLine,
27 toolItemForDisplay,
@@ -300,6 +301,12 @@ export function workEntryRowLabel(
301 const presentation = resolveWorkEntryToolPresentation(entry, undefined, resolve);
302 if (presentation) return presentation.displayName;
303 if (entry.command?.trim()) return compactWorkEntryText(commandDisplayText(entry.command));
304 + const commandless = commandlessCommandLabel(
305 + entry,
306 + liveActivityToolStatus(entry.toolLifecycleStatus, false),
307 + resolve,
308 + );
309 + if (commandless) return commandless;
310 const action = toolGroupAction(entry);
311 const isToolRead = action === "read" && entry.itemType === "dynamic_tool";
312 if (action === "code-search" || action === "search") {
@@ -2424,7 +2431,10 @@ function liveToolActivitySummary(
2431 ? resolve(msg("Stopped {program}", { program }))
2432 : resolve(msg("Ran {program}", { program }));
2433 }
2427 - return compactWorkEntryText(activity.detail ?? activity.summary);
2434 + return (
2435 + commandlessCommandLabel(activity.workEntry, status, resolve) ??
2436 + compactWorkEntryText(activity.detail ?? activity.summary)
2437 + );
2438 }
2439
2440 interface ThreadFeedBuild {
apps/server/src/orchestration-v2/Adapters/AcpAdapterV2.test.ts
+116
@@ -11980,6 +11980,122 @@ describe("AcpAdapterV2", () => {
11980 );
11981 }).pipe(Effect.provide(layerTest)),
11982 );
11983 +
11984 + it.effect("leaves command_execution input empty when the tool call carries no command", () =>
11985 + Effect.gen(function* () {
11986 + const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;
11987 + const selfInvocation = yield* resolveSelfInvocation();
11988 + const mockAgentPath = yield* bundledMockAgentPath;
11989 + type RuntimeService = AcpSessionRuntime.AcpSessionRuntime["Service"];
11990 + let sessionUpdateHandler: Parameters<RuntimeService["handleSessionUpdate"]>[0] | undefined;
11991 + const promptStarted = yield* Deferred.make<void>();
11992 + const promptGate = yield* Deferred.make<EffectAcpSchema.PromptResponse>();
11993 + const instanceId = ProviderInstanceId.make("acp-test-empty-command-input");
11994 + const adapter = yield* makeAcpAdapterV2({
11995 + instanceId,
11996 + flavor: {
11997 + driver: ACP_TEST_DRIVER,
11998 + capabilities: AcpProviderCapabilitiesV2,
11999 + makeRuntime: makeMockRuntime({
12000 + childProcessSpawner,
12001 + mockAgentPath,
12002 + wrapRuntime: (runtime) => ({
12003 + ...runtime,
12004 + handleSessionUpdate: (handler) =>
12005 + Effect.sync(() => {
12006 + sessionUpdateHandler = handler;
12007 + }).pipe(Effect.andThen(runtime.handleSessionUpdate(handler))),
12008 + prompt: () =>
12009 + Deferred.succeed(promptStarted, undefined).pipe(
12010 + Effect.andThen(Deferred.await(promptGate)),
12011 + ),
12012 + }),
12013 + }),
12014 + },
12015 + selfInvocation,
12016 + });
12017 + const threadId = ThreadId.make("thread-acp-empty-command-input");
12018 + const runtimePolicy = ProviderAdapter.ProviderAdapterV2RuntimePolicy.make({
12019 + runtimeMode: "full-access",
12020 + interactionMode: "default",
12021 + cwd: process.cwd(),
12022 + });
12023 + const modelSelection = { instanceId, model: "default" } as const;
12024 + const runtime = yield* adapter.openSession({
12025 + threadId,
12026 + providerSessionId: ProviderSessionId.make("provider-session-acp-empty-command-input"),
12027 + modelSelection,
12028 + runtimePolicy,
12029 + });
12030 + const events = yield* Queue.unbounded<ProviderAdapter.ProviderAdapterV2Event>();
12031 + yield* runtime.events.pipe(
12032 + Stream.runForEach((event) => Queue.offer(events, event)),
12033 + Effect.forkScoped,
12034 + );
12035 + const providerThread = yield* runtime.ensureThread({
12036 + threadId,
12037 + modelSelection,
12038 + runtimePolicy,
12039 + });
12040 + const now = yield* DateTime.now;
12041 + yield* runtime.startTurn(
12042 + makeTurnInput({ threadId, providerThread, instanceId, runtimePolicy, now }),
12043 + );
12044 + yield* Deferred.await(promptStarted);
12045 +
12046 + const sessionId = "mock-session-1";
12047 + yield* sessionUpdateHandler!({
12048 + sessionId,
12049 + update: {
12050 + sessionUpdate: "tool_call",
12051 + toolCallId: "call-exec-no-cmd",
12052 + title: "Run command",
12053 + kind: "execute",
12054 + status: "in_progress",
12055 + rawInput: {},
12056 + },
12057 + });
12058 + yield* sessionUpdateHandler!({
12059 + sessionId,
12060 + update: {
12061 + sessionUpdate: "tool_call",
12062 + toolCallId: "call-monitor-no-cmd",
12063 + title: "Monitor",
12064 + kind: "other",
12065 + status: "in_progress",
12066 + rawInput: { variant: "monitor" },
12067 + },
12068 + });
12069 + yield* Deferred.succeed(promptGate, { stopReason: "end_turn" });
12070 +
12071 + const commandItems: Array<{
12072 + readonly nativeId: string | null | undefined;
12073 + readonly status: string;
12074 + readonly input: string;
12075 + }> = [];
12076 + let terminal = false;
12077 + while (!terminal) {
12078 + const event = yield* Queue.take(events);
12079 + if (event.type === "turn_item.updated" && event.turnItem.type === "command_execution") {
12080 + commandItems.push({
12081 + nativeId: event.turnItem.nativeItemRef?.nativeId,
12082 + status: event.turnItem.status,
12083 + input: event.turnItem.input,
12084 + });
12085 + }
12086 + if (event.type === "turn.terminal") {
12087 + terminal = true;
12088 + }
12089 + }
12090 +
12091 + assert.deepEqual(commandItems, [
12092 + { nativeId: "call-exec-no-cmd", status: "running", input: "" },
12093 + { nativeId: "call-monitor-no-cmd", status: "running", input: "" },
12094 + { nativeId: "call-exec-no-cmd", status: "completed", input: "" },
12095 + { nativeId: "call-monitor-no-cmd", status: "completed", input: "" },
12096 + ]);
12097 + }).pipe(Effect.provide(layerTest)),
12098 + );
12099 });
12100
12101 describe("acpPostSettleContinuationOfferEvidence", () => {
apps/web/src/components/chat/MessagesTimeline.active-tools.test.ts
+50 -1
@@ -1,6 +1,10 @@
1 import { RunId } from "@t3tools/contracts";
2 import { describe, expect, it } from "vite-plus/test";
3 -import { deriveMessagesTimelineRows, liveWorkEntryLabel } from "./MessagesTimeline.logic";
3 +import {
4 + deriveMessagesTimelineRows,
5 + liveWorkEntryLabel,
6 + workEntryDisplayLabel,
7 +} from "./MessagesTimeline.logic";
8
9 describe("long active tool groups", () => {
10 it.each([false, true])(
@@ -49,3 +53,48 @@ describe("long active tool groups", () => {
53 },
54 );
55 });
56 +
57 +describe("liveWorkEntryLabel for a command execution without a command", () => {
58 + it.each([
59 + {
60 + status: "inProgress" as const,
61 + active: true,
62 + toolTitle: "Ran command",
63 + expected: "Running command",
64 + },
65 + {
66 + status: "inProgress" as const,
67 + active: true,
68 + toolTitle: "Command",
69 + expected: "Running command",
70 + },
71 + {
72 + status: "failed" as const,
73 + active: false,
74 + toolTitle: "Ran command",
75 + expected: "Failed command",
76 + },
77 + {
78 + status: "failed" as const,
79 + active: false,
80 + toolTitle: "Run command",
81 + expected: "Failed command",
82 + },
83 + ])(
84 + "labels a $status entry titled $toolTitle as $expected",
85 + ({ status, active, toolTitle, expected }) => {
86 + const entry = {
87 + id: "work-empty-command",
88 + createdAt: "2026-10-12T00:00:00Z",
89 + label: "Ran command",
90 + toolTitle,
91 + tone: "tool" as const,
92 + itemType: "command_execution" as const,
93 + command: "",
94 + toolLifecycleStatus: status,
95 + };
96 + expect(liveWorkEntryLabel(entry, undefined, active)).toBe(expected);
97 + expect(workEntryDisplayLabel(entry, undefined)).toBe(expected);
98 + },
99 + );
100 +});
apps/web/src/components/chat/MessagesTimeline.logic.ts
+13 -12
@@ -20,6 +20,8 @@ import {
20 commandProgramName,
21 } from "@t3tools/client-runtime/work-log/command-label";
22 import {
23 + commandlessCommandLabel,
24 + genericCommandStatusLabel,
25 liveActivityToolStatus,
26 normalizeCompactToolLabel,
27 resolveWorkEntryToolPresentation,
@@ -157,6 +159,12 @@ export function workEntryDisplayLabel(
159 const toolPresentation = resolveWorkEntryToolPresentation(entry, undefined, resolve);
160 if (toolPresentation) return toolPresentation.displayName;
161 if (entry.command?.trim()) return commandDisplayText(entry.command);
162 + const commandless = commandlessCommandLabel(
163 + entry,
164 + liveActivityToolStatus(entry.toolLifecycleStatus, false),
165 + resolve,
166 + );
167 + if (commandless) return commandless;
168 const action = toolGroupAction(entry);
169 if (action === "code-search" || action === "search") {
170 const searchLabel =
@@ -271,17 +279,7 @@ export function liveWorkEntryLabel(
279 if (command) {
280 const program = commandProgramName(command);
281 if (program == null) {
274 - return resolve(
275 - status === "inProgress"
276 - ? msg("Running command")
277 - : status === "failed"
278 - ? msg("Failed command")
279 - : status === "declined"
280 - ? msg("Declined command")
281 - : status === "stopped"
282 - ? msg("Stopped command")
283 - : msg("Ran command"),
284 - );
282 + return genericCommandStatusLabel(status, resolve);
283 }
284 return resolve(
285 status === "inProgress"
@@ -295,7 +293,10 @@ export function liveWorkEntryLabel(
293 : msg("Ran {program}", { program }),
294 );
295 }
298 - return workEntryDisplayLabel(entry, workspaceRoot, resolve);
296 + return (
297 + commandlessCommandLabel(entry, status, resolve) ??
298 + workEntryDisplayLabel(entry, workspaceRoot, resolve)
299 + );
300 }
301
302 export function workEntryIsVisibleInGroup(
packages/client-runtime/src/work-log/presentation.ts
+37
@@ -255,6 +255,43 @@ export function liveActivityToolStatus(status: string | undefined, presentTense:
255 return "completed";
256 }
257
258 +export function genericCommandStatusLabel(
259 + status: ReturnType<typeof liveActivityToolStatus>,
260 + resolve: MFunctionType = mFallback,
261 +) {
262 + return resolve(
263 + status === "inProgress"
264 + ? msg("Running command")
265 + : status === "failed"
266 + ? msg("Failed command")
267 + : status === "declined"
268 + ? msg("Declined command")
269 + : status === "stopped"
270 + ? msg("Stopped command")
271 + : msg("Ran command"),
272 + );
273 +}
274 +
275 +const GENERIC_COMMAND_TITLES = new Set(["Ran command", "Run command", "Command"]);
276 +
277 +export function commandlessCommandLabel(
278 + entry: Pick<
279 + WorkLogPresentationEntry,
280 + "itemType" | "command" | "toolTitle" | "label" | "structuredPayload"
281 + >,
282 + status: ReturnType<typeof liveActivityToolStatus>,
283 + resolve: MFunctionType = mFallback,
284 +): string | null {
285 + if (entry.itemType !== "command_execution" || entry.command?.trim()) return null;
286 + // The provider's own title, before a client substitutes its translated fallback.
287 + const title = (
288 + entry.structuredPayload ? entry.structuredPayload.title : entry.toolTitle || entry.label
289 + )?.trim();
290 + return !title || GENERIC_COMMAND_TITLES.has(normalizeCompactToolLabel(title))
291 + ? genericCommandStatusLabel(status, resolve)
292 + : null;
293 +}
294 +
295 export function resolveWorkEntryToolPresentation(
296 entry: Pick<
297 WorkLogPresentationEntry,
packages/provider-acp/src/server/adapter.ts
+2 -6
@@ -4801,7 +4801,7 @@ export const makeAcpAdapterV2 = Effect.fn("makeAcpAdapterV2")(function* (
4801 turnItem = {
4802 ...base,
4803 type: "command_execution",
4804 - input: toolCall.command ?? monitorCommand ?? toolCall.title ?? "Command",
4804 + input: toolCall.command ?? monitorCommand ?? "",
4805 ...(textFromUnknown(rawOutput) === undefined
4806 ? {}
4807 : { output: textFromUnknown(rawOutput) }),
@@ -4850,11 +4850,7 @@ export const makeAcpAdapterV2 = Effect.fn("makeAcpAdapterV2")(function* (
4850 turnItem = {
4851 ...base,
4852 type: "command_execution",
4853 - input:
4854 - toolCall.command ??
4855 - monitorCommand ??
4856 - toolCall.title ??
4857 - (inputVariant === "monitor" ? "Monitor" : "Command"),
4853 + input: toolCall.command ?? monitorCommand ?? "",
4854 ...(textFromUnknown(rawOutput) === undefined
4855 ? {}
4856 : { output: textFromUnknown(rawOutput) }),