diff --git a/apps/mobile/src/features/threads/ThreadDetailScreen.tsx b/apps/mobile/src/features/threads/ThreadDetailScreen.tsx index 9741e46444414..b9cecaac8acd6 100644 --- a/apps/mobile/src/features/threads/ThreadDetailScreen.tsx +++ b/apps/mobile/src/features/threads/ThreadDetailScreen.tsx @@ -1334,6 +1334,7 @@ export const ThreadDetailScreen = function ThreadDetailScreen(props: ThreadDetai threadTitle={props.selectedThread.title} latestRun={props.activityRun} activeWorkStartedAt={props.activeWorkStartedAt} + isCompacting={props.isCompacting} runlessWorkActive={props.runlessWorkActive ?? false} listRef={listRef} freeze={freeze} diff --git a/apps/mobile/src/features/threads/ThreadFeed.tsx b/apps/mobile/src/features/threads/ThreadFeed.tsx index 77729684a792e..6a295a84a90be 100644 --- a/apps/mobile/src/features/threads/ThreadFeed.tsx +++ b/apps/mobile/src/features/threads/ThreadFeed.tsx @@ -213,7 +213,11 @@ import { ThreadWorkLog, WORK_GROUP_TOGGLE_HEIGHT, } from "./thread-work-log"; -import { appendPendingThreadMessages, type PendingThreadFeedEntry } from "./pending-thread-feed"; +import { + appendPendingThreadMessages, + hideThinkingWhileCompacting, + type PendingThreadFeedEntry, +} from "./pending-thread-feed"; import type { QueuedThreadMessage } from "../../state/thread-outbox-model"; import { resolveThreadFeedFixedItemSize } from "./thread-feed-item-size"; import { htmlRenderFrameHeight } from "@t3tools/shared/htmlRender"; @@ -319,6 +323,7 @@ export interface ThreadFeedProps { readonly agentLabel: string; readonly latestRun: ThreadFeedLatestRun | null; readonly activeWorkStartedAt: string | null; + readonly isCompacting: boolean; readonly runlessWorkActive?: boolean; readonly listRef: RefObject; readonly freeze: SharedValue; @@ -2315,7 +2320,7 @@ export const ThreadFeed = memo(function ThreadFeed(props: ThreadFeedProps) { reportHeaderMaterialVisibility(false); }, [feedThreadKey, reportHeaderMaterialVisibility]); - const presentedFeed = appendPendingThreadMessages( + const derivedFeed = appendPendingThreadMessages( deriveThreadFeedPresentation( props.feed, props.latestRun, @@ -2332,6 +2337,7 @@ export const ThreadFeed = memo(function ThreadFeed(props: ThreadFeedProps) { props.feed, props.queuedMessages, ); + const presentedFeed = hideThinkingWhileCompacting(derivedFeed, props.isCompacting); const setupAnchorIndex = presentedFeed.findIndex( (entry) => entry.type === "message" && entry.message.role === "user", ); diff --git a/apps/mobile/src/features/threads/pending-thread-feed.test.ts b/apps/mobile/src/features/threads/pending-thread-feed.test.ts index 109439778c7ab..dd78af7fe639c 100644 --- a/apps/mobile/src/features/threads/pending-thread-feed.test.ts +++ b/apps/mobile/src/features/threads/pending-thread-feed.test.ts @@ -7,7 +7,7 @@ import { ThreadId, } from "@t3tools/contracts"; import type { QueuedThreadMessage } from "../../state/thread-outbox-model"; -import { appendPendingThreadMessages } from "./pending-thread-feed"; +import { appendPendingThreadMessages, hideThinkingWhileCompacting } from "./pending-thread-feed"; const pending = (id: string): QueuedThreadMessage => ({ environmentId: EnvironmentId.make("env"), @@ -54,6 +54,18 @@ describe("pending timeline messages", () => { expect(entries[1]?.pendingMessage?.text).toBe("first"); }); + it("hides the live Thinking row only while the thread is compacting", () => { + const thinking = { + type: "thinking", + runId: null, + id: "thinking", + createdAt: "2026-09-06T11:00:00.000Z", + } as const; + const entries = appendPendingThreadMessages([thinking], [], [pending("queued")]); + expect(hideThinkingWhileCompacting(entries, true).map((entry) => entry.id)).toEqual(["queued"]); + expect(hideThinkingWhileCompacting(entries, false)).toBe(entries); + }); + it("reuses the message id and suppresses the pending copy when delivery appears", () => { const queued = pending("sent"); const optimistic = appendPendingThreadMessages([], [], [queued])[0]!; diff --git a/apps/mobile/src/features/threads/pending-thread-feed.ts b/apps/mobile/src/features/threads/pending-thread-feed.ts index 80d2aa2f48ddc..d9b76303ee2ca 100644 --- a/apps/mobile/src/features/threads/pending-thread-feed.ts +++ b/apps/mobile/src/features/threads/pending-thread-feed.ts @@ -40,3 +40,11 @@ export function appendPendingThreadMessages( })), ]; } + +// The floating control already says Compacting; web hides this row too. +export function hideThinkingWhileCompacting( + feed: ReadonlyArray, + isCompacting: boolean, +): ReadonlyArray { + return isCompacting ? feed.filter((entry) => entry.type !== "thinking") : feed; +}