@devries-cameron20 / t3code Mirror · read-only / commits / a086be029c
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 23, 04:15 UTC

fix(mobile): long commands no longer freeze Android work-log taps (#19238)

Quy Ngoc Nguyen committed Oct 19, 2026 at 02:19 UTC a086be029c50e03e9fdd07d86bf907c145db6fc7
2 files changed +27 -3
apps/mobile/src/lib/threadActivity.test.ts
+16
@@ -2430,6 +2430,22 @@ it("uses a compact reasoning preview and a short expanded heading", () => {
2430 expect(workEntryRowLabel({ ...entry, toolLifecycleStatus: "completed" }, true)).toBe("Thought");
2431 });
2432
2433 +it("caps one-line work-log labels for multi-kilobyte commands", () => {
2434 + const command = `cd /repo && python3 - <<'PY'\n${"print('x')\n".repeat(400)}PY`;
2435 + const entry = {
2436 + id: "heredoc",
2437 + label: "Ran command",
2438 + createdAt: "2026-09-17T12:00:00Z",
2439 + itemType: "command_execution" as const,
2440 + tone: "tool" as const,
2441 + command,
2442 + };
2443 + for (const label of [workEntryRowLabel(entry), workEntryRowLabel(entry, true)]) {
2444 + expect(label.startsWith("cd /repo && python3 - <<'PY' print('x')")).toBe(true);
2445 + expect(label.length).toBeLessThanOrEqual(203);
2446 + }
2447 +});
2448 +
2449 it("keeps search output in expanded details rather than the compact label", () => {
2450 const entry = {
2451 id: "search",
apps/mobile/src/lib/threadActivity.ts
+11 -3
@@ -62,6 +62,7 @@ import {
62 formatSearchToolLabel,
63 } from "@t3tools/shared/toolActivity";
64 import { formatDuration } from "@t3tools/shared/orchestrationTiming";
65 +import { truncate } from "@t3tools/shared/String";
66 import type { HtmlRenderReference } from "@t3tools/shared/htmlRender";
67 import type { McpAppReference } from "@t3tools/shared/mcpApp";
68 import {
@@ -249,8 +250,15 @@ export interface AgentSpawnSummary {
250 }>;
251 }
252
253 +/**
254 + * Work-log headers render one line, but Android still lays out and hit-tests
255 + * the whole string, so a multi-kilobyte heredoc stalls touch dispatch until
256 + * the app ANRs. Expanded bodies and copy keep the full text.
257 + */
258 +const WORK_LOG_LABEL_MAX_LENGTH = 200;
259 +
260 function compactWorkEntryText(value: string): string {
253 - return value.replace(/\s+/gu, " ").trim();
261 + return truncate(value.replace(/\s+/gu, " "), WORK_LOG_LABEL_MAX_LENGTH);
262 }
263
264 export function workEntryRowLabel(entry: WorkLogPresentationEntry, expanded = false): string {
@@ -289,7 +297,7 @@ export function workEntryRowLabel(entry: WorkLogPresentationEntry, expanded = fa
297 ? entry.changedFiles[0]!
298 : `${entry.changedFiles[0]!} +${entry.changedFiles.length - 1} more`
299 : null);
292 - if (expanded) return preview?.trim() || entry.label;
300 + if (expanded) return preview?.trim() ? truncate(preview, WORK_LOG_LABEL_MAX_LENGTH) : entry.label;
301 return preview ? compactWorkEntryText(preview) || entry.label : entry.label;
302 }
303
@@ -862,7 +870,7 @@ function singleToolCallLabel(activity: ThreadFeedActivity, expanded: boolean): s
870 const presentation = resolveWorkEntryToolPresentation(activity.workEntry, "completed");
871 if (presentation) return presentation.displayName;
872 const command = activity.workEntry.command?.trim();
865 - return command || activity.summary;
873 + return command ? truncate(command, WORK_LOG_LABEL_MAX_LENGTH) : activity.summary;
874 }
875
876 function isEmptyMessage(entry: RawThreadFeedEntry): boolean {