The best way to control Claude Code, Codex and more from any computer or phone
fix(mobile): cap live work-log summaries for long approval prompts (#23227)
Co-authored-by: GPT-6.1 Sol <noreply@openai.com>
Victor Vogel committed
Oct 31, 2026 at 21:27 UTC
1b8516e8747973397e7ed7371c764ba20db04719
2 files changed
+82
-5
apps/mobile/src/lib/threadActivity.test.ts
+78
@@ -1842,3 +1842,81 @@ describe("streamed feed updates", () => {
1842
expect(showsDelegation(steps[3]!)).toBe(false);
1843
});
1844
});
1845
+
1846
+it.each([false, true])(
1847
+ "caps live approval headers while preserving the prompt (grouped: %s)",
1848
+ (grouped) => {
1849
+ const at = "2026-06-20T00:00:02.000Z";
1850
+ const prompt = `python3 - <<'PY'\n${"print('approval')\n".repeat(400)}PY`;
1851
+ const approval: OrchestrationV2TurnItem = {
1852
+ ...base("long-approval", at, 2),
1853
+ type: "approval_request",
1854
+ status: "waiting",
1855
+ completedAt: null,
1856
+ requestId: RuntimeRequestId.make("long-approval"),
1857
+ requestKind: "command",
1858
+ prompt,
1859
+ };
1860
+ const presented = deriveThreadFeedPresentation(
1861
+ buildThreadFeed([
1862
+ projected(userMessage(), 0),
1863
+ ...(grouped ? [projected(command(), 1)] : []),
1864
+ projected(approval, 2),
1865
+ ]),
1866
+ { runId, status: "running", startedAt: at, completedAt: null },
1867
+ new Set(),
1868
+ new Set(),
1869
+ at,
1870
+ );
1871
+ const header = presented.find((row) =>
1872
+ grouped ? row.type === "work-toggle" : row.type === "activity-group",
1873
+ );
1874
+ const label =
1875
+ header?.type === "work-toggle"
1876
+ ? header.summary
1877
+ : header?.type === "activity-group"
1878
+ ? header.activities[0]?.groupStandIn?.label
1879
+ : undefined;
1880
+ expect(label).toBeDefined();
1881
+ expect(label!.length).toBeLessThanOrEqual(203);
1882
+ expect(label).toMatch(/^python3 - <<'PY' print/);
1883
+ expect(label).not.toContain("\n");
1884
+ const feed = buildThreadFeed([projected(approval, 0)]);
1885
+ const activity = feed.flatMap((row) =>
1886
+ row.type === "activity-group" ? row.activities : [],
1887
+ )[0]!;
1888
+ expect(activity.detail).toBe(prompt);
1889
+ expect(JSON.parse(activity.getFullDetail()!).item).toMatchObject({ prompt });
1890
+ expect(activity.getCopyText()).toContain(prompt);
1891
+ },
1892
+);
1893
+
1894
+it("caps live thought previews while preserving reasoning detail", () => {
1895
+ const at = "2026-06-20T00:00:02.000Z";
1896
+ const text = "Considering the pending approval\n".repeat(100);
1897
+ const thought: OrchestrationV2TurnItem = {
1898
+ ...base("long-thought", at, 1),
1899
+ type: "reasoning",
1900
+ status: "running",
1901
+ completedAt: null,
1902
+ text,
1903
+ streaming: true,
1904
+ };
1905
+ const feed = buildThreadFeed([projected(userMessage(), 0), projected(thought, 1)]);
1906
+ const rows = deriveThreadFeedPresentation(
1907
+ feed,
1908
+ { runId, status: "running", startedAt: at, completedAt: null },
1909
+ new Set(),
1910
+ new Set(),
1911
+ at,
1912
+ );
1913
+ const header = rows.find((row) => row.type === "work-toggle");
1914
+ expect(header).toMatchObject({ summary: "Thinking", live: true });
1915
+ expect(header?.thought).toMatch(/^Considering the pending approval/);
1916
+ expect(header?.thought).not.toContain("\n");
1917
+ expect(header!.thought!.length).toBeLessThanOrEqual(203);
1918
+ const activity = feed.flatMap((row) => (row.type === "activity-group" ? row.activities : []))[0]!;
1919
+ expect(activity.detail).toBe(text);
1920
+ expect(JSON.parse(activity.getFullDetail()!).item).toMatchObject({ text });
1921
+ expect(activity.getCopyText()).toContain(text);
1922
+});
apps/mobile/src/lib/threadActivity.ts
+4
-5
@@ -1774,7 +1774,7 @@ function appendToolGroupRows(
1774
(activity.workEntry.detail?.trim() ?? "") !== "",
1775
)?.workEntry.detail
1776
: undefined;
1777
- const thought = latestThought ? liveThoughtLine(latestThought) : "";
1777
+ const thought = latestThought ? compactWorkEntryText(liveThoughtLine(latestThought)) : "";
1778
const summary = live
1779
? (expanded || thought) && latestActivity.workEntry.itemType === "reasoning"
1780
? latestActivity.lifecycleStatus === "inProgress"
@@ -1872,9 +1872,8 @@ function appendToolGroupRows(
1872
function liveToolActivitySummary(activity: ThreadFeedActivity, presentTense: boolean): string {
1873
const status = liveActivityToolStatus(activity.lifecycleStatus, presentTense);
1874
if (activity.workEntry.itemType === "reasoning") {
1875
- return (
1876
- activity.workEntry.detail?.trim().replace(/\s+/g, " ") ||
1877
- (status === "inProgress" ? "Thinking" : "Thought")
1875
+ return compactWorkEntryText(
1876
+ activity.workEntry.detail?.trim() || (status === "inProgress" ? "Thinking" : "Thought"),
1877
);
1878
}
1879
const presentation = resolveWorkEntryToolPresentation({
@@ -1897,7 +1896,7 @@ function liveToolActivitySummary(activity: ThreadFeedActivity, presentTense: boo
1896
: "Ran";
1897
return `${verb} ${program ?? "command"}`;
1898
}
1900
- return activity.detail ?? activity.summary;
1899
+ return compactWorkEntryText(activity.detail ?? activity.summary);
1900
}
1901
1902
interface ThreadFeedBuild {