Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions apps/mobile/src/features/threads/ThreadDetailScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand Down
10 changes: 8 additions & 2 deletions apps/mobile/src/features/threads/ThreadFeed.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down Expand Up @@ -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<LegendListRef | null>;
readonly freeze: SharedValue<boolean>;
Expand Down Expand Up @@ -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,
Expand All @@ -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",
);
Expand Down
14 changes: 13 additions & 1 deletion apps/mobile/src/features/threads/pending-thread-feed.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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"),
Expand Down Expand Up @@ -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]!;
Expand Down
8 changes: 8 additions & 0 deletions apps/mobile/src/features/threads/pending-thread-feed.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,3 +40,11 @@ export function appendPendingThreadMessages(
})),
];
}

// The floating control already says Compacting; web hides this row too.
export function hideThinkingWhileCompacting(
feed: ReadonlyArray<PendingThreadFeedEntry>,
isCompacting: boolean,
): ReadonlyArray<PendingThreadFeedEntry> {
return isCompacting ? feed.filter((entry) => entry.type !== "thinking") : feed;
}
Loading