TypeScript
fix(mobile): show each turn's diffstat on its work row (#21392)
maria8bbb85c9023a
diff --git a/apps/mobile/src/features/threads/ThreadFeed.tsx b/apps/mobile/src/features/threads/ThreadFeed.tsxindex 9ced3600473..77729684a79 100644--- a/apps/mobile/src/features/threads/ThreadFeed.tsx+++ b/apps/mobile/src/features/threads/ThreadFeed.tsx@@ -26,6 +26,8 @@ import { scopeThreadRef } from "@t3tools/client-runtime/environment";import type { HandoffEndpoints } from "@t3tools/client-runtime/handoff";import { resolveUserMessagePresentation } from "@t3tools/client-runtime/user-message";import { canForkProjectedAssistantItem } from "@t3tools/client-runtime/state/thread-workflows";+import type { ThreadCheckpointSummary } from "@t3tools/client-runtime/state/thread-checkpoints";+import { formatDiffCount } from "@t3tools/client-runtime/diff-count";import type { WorkflowOpening } from "@t3tools/client-runtime/state/subagentRuntime";import {AuthFilesystemReadScope,@@ -153,6 +155,8 @@ import {type MediaVideoPreviewSource,} from "../../lib/videoPreviewSource";import { CopyTextButton } from "./CopyTextButton";+import { getReviewSectionIdForCheckpoint } from "../review/reviewModel";+import { setReviewSelectedSectionId } from "../review/reviewState";import { Menu } from "../../components/ui/Menu";import { copyPromptLink } from "../prompt-links/prompt-link-actions";import { parseReviewCommentMessageSegments } from "../review/reviewCommentSelection";@@ -1002,6 +1006,7 @@ function renderFeedEntry(readonly onToggleWorkGroup: (groupId: string, anchorKey?: string) => void;readonly onToggleWorkRow: (rowId: string, anchorKey?: string, groupId?: string) => void;readonly onToggleTurnFold: (runId: RunId) => void;+ readonly onOpenTurnDiff: (checkpoint: ThreadCheckpointSummary) => void;readonly onPressPreview: (source: FilePreviewSource) => void;readonly onPressVideo: (attachment: ChatFileAttachment, sourceIdentifier: string) => void;readonly markdownLinkHandlers: MarkdownLinkHandlers;@@ -1028,29 +1033,38 @@ function renderFeedEntry(if (entry.type === "run-fold") {return (- <Pressable- accessibilityRole="button"- accessibilityState={{ expanded: entry.expanded }}- onPress={() => props.onToggleTurnFold(entry.runId)}- hitSlop={4}- className="mb-1 min-h-11 flex-row items-center gap-2 border-b border-border-subtle px-2"- style={{- minHeight: Math.max(TURN_FOLD_HEIGHT - 3.5, props.workRowSizing.estimatedRowHeight),- }}- >- <Text- key={props.workRowSizing.textSizeKey}- className="font-t3-medium text-sm tabular-nums text-foreground-muted"+ <View className="mb-1 flex-row items-center border-b border-border-subtle px-2">+ <Pressable+ accessibilityRole="button"+ accessibilityState={{ expanded: entry.expanded }}+ onPress={() => props.onToggleTurnFold(entry.runId)}+ hitSlop={4}+ className="min-h-11 min-w-0 flex-1 flex-row items-center gap-2"+ style={{+ minHeight: Math.max(TURN_FOLD_HEIGHT - 3.5, props.workRowSizing.estimatedRowHeight),+ }}>- {entry.label}- </Text>- <ThreadDisclosureChevron- expanded={entry.expanded}- collapsedDirection="right"- size={15}- tintColor={iconSubtleColor}- />- </Pressable>+ <Text+ key={props.workRowSizing.textSizeKey}+ numberOfLines={1}+ className="shrink font-t3-medium text-sm tabular-nums text-foreground-muted"+ >+ {entry.label}+ </Text>+ <ThreadDisclosureChevron+ expanded={entry.expanded}+ collapsedDirection="right"+ size={15}+ tintColor={iconSubtleColor}+ />+ </Pressable>+ {entry.checkpointSummary ? (+ <TurnDiffStat+ checkpoint={entry.checkpointSummary}+ onOpenTurnDiff={props.onOpenTurnDiff}+ />+ ) : null}+ </View>);}@@ -1102,6 +1116,14 @@ function renderFeedEntry(hasFailure={entry.hasFailure}shimmer={entry.shimmer}thought={entry.thought}+ trailing={+ entry.checkpointSummary ? (+ <TurnDiffStat+ checkpoint={entry.checkpointSummary}+ onOpenTurnDiff={props.onOpenTurnDiff}+ />+ ) : null+ }onToggle={() => props.onToggleWorkGroup(entry.groupId, entry.id)}/>);@@ -1425,6 +1447,12 @@ function renderFeedEntry(<MessageAttachmentUnknown key={attachment.id} name={attachment.name} />);})}+ {showAssistantMeta && message.checkpointSummary ? (+ <TurnDiffStat+ checkpoint={message.checkpointSummary}+ onOpenTurnDiff={props.onOpenTurnDiff}+ />+ ) : null}{showAssistantMeta ? (<View className="mt-1 flex-row items-center gap-1"><CopyTextButton@@ -1475,6 +1503,32 @@ function renderFeedEntry();}+function TurnDiffStat(props: {+ readonly checkpoint: ThreadCheckpointSummary;+ readonly onOpenTurnDiff: (checkpoint: ThreadCheckpointSummary) => void;+}) {+ const { files } = props.checkpoint;+ const additions = files.reduce((total, file) => total + file.additions, 0);+ const deletions = files.reduce((total, file) => total + file.deletions, 0);+ const fileCountLabel = `${files.length} file${files.length === 1 ? "" : "s"} changed`;+ return (+ <Pressable+ accessibilityRole="button"+ accessibilityLabel={`Review ${fileCountLabel}, ${additions} additions, ${deletions} deletions`}+ onPress={() => props.onOpenTurnDiff(props.checkpoint)}+ className="min-h-11 shrink-0 flex-row items-center gap-2 px-2 active:bg-subtle"+ >+ <Text className="font-t3-medium text-xs tabular-nums text-adaptive-emerald-700-300">+ +{formatDiffCount(additions)}+ </Text>+ <Text className="font-t3-medium text-xs tabular-nums text-adaptive-rose-700-300">+ −{formatDiffCount(deletions)}+ </Text>+ <SymbolView name="chevron.right" size={12} tintColorClassName="accent-foreground-muted" />+ </Pressable>+ );+}+type UserMessageContentProps = {readonly text: string;readonly environmentId: EnvironmentId;@@ -1687,6 +1741,19 @@ export const ThreadFeed = memo(function ThreadFeed(props: ThreadFeedProps) {const duoColumns = useNativeWorkspaceColumnsSupported() && isDuoDevice(deviceType);const openPullRequest = useOpenPullRequest();const navigation = useNavigation();+ const onOpenTurnDiff = useCallback(+ (checkpoint: ThreadCheckpointSummary) => {+ setReviewSelectedSectionId(+ scopedThreadKey(props.environmentId, props.threadId),+ getReviewSectionIdForCheckpoint(checkpoint),+ );+ navigation.navigate("ThreadReview", {+ environmentId: props.environmentId,+ threadId: props.threadId,+ });+ },+ [navigation, props.environmentId, props.threadId],+ );const { themeAppearance } = useAppearancePreferences();const copyFeedbackTimeoutRef = useRef<ReturnType<typeof setTimeout> | null>(null);const disclosureSettleFrameRef = useRef<number | null>(null);@@ -2469,7 +2536,7 @@ export const ThreadFeed = memo(function ThreadFeed(props: ThreadFeedProps) {if (entry.type === "html-render") {return htmlRenderRowHeight(htmlRenderFrameHeight(entry.render, contentWidth));}- if (workRowSizing.fixedRowHeight === undefined) {+ if (workRowSizing.fixedRowHeight === undefined || entry.checkpointSummary) {return undefined;}switch (entry.type) {@@ -2546,6 +2613,7 @@ export const ThreadFeed = memo(function ThreadFeed(props: ThreadFeedProps) {onToggleWorkGroup,onToggleWorkRow,onToggleTurnFold,+ onOpenTurnDiff,onPressPreview,onPressVideo,markdownLinkHandlers,diff --git a/apps/mobile/src/features/threads/thread-work-log.tsx b/apps/mobile/src/features/threads/thread-work-log.tsxindex b056bab4b64..b7ceb8c7b90 100644--- a/apps/mobile/src/features/threads/thread-work-log.tsx+++ b/apps/mobile/src/features/threads/thread-work-log.tsx@@ -1303,6 +1303,7 @@ export function ThreadWorkGroupToggle(props: {readonly hasFailure: boolean;readonly shimmer: boolean;readonly thought?: string | undefined;+ readonly trailing?: ReactNode;readonly onToggle: () => void;}) {const statusLabel = props.hasFailure ? `${props.summary}, tool call failed` : props.summary;@@ -1335,49 +1336,54 @@ export function ThreadWorkGroupToggle(props: {</Text></Pressable>) : null}- <WorkLogPressable- accessibilityRole="button"- accessibilityState={{ expanded: props.expanded }}- accessibilityLabel={accessibilityLabel}- accessibilityHint={`Double tap to ${props.expanded ? "hide" : "show"} ${props.hiddenCount} tool ${props.hiddenCount === 1 ? "call" : "calls"}.`}- onPress={() => {- void Haptics.selectionAsync();- props.onToggle();- }}- rowSizing={props.rowSizing}- >- {props.shimmer ? (- <ShimmeringWorkContent- key={props.rowSizing.textSizeKey}- environmentId={props.environmentId}- icon={icon}- iconSubtleColor={props.iconSubtleColor}- label={props.summary}- showIcon- themeAppearance={props.themeAppearance}- toolIcon={props.toolIcon}- />- ) : (- <>- <WorkLogIconSlot>- <ToolActivityIconView+ <View className="flex-row items-center">+ <View className="min-w-0 flex-1">+ <WorkLogPressable+ accessibilityRole="button"+ accessibilityState={{ expanded: props.expanded }}+ accessibilityLabel={accessibilityLabel}+ accessibilityHint={`Double tap to ${props.expanded ? "hide" : "show"} ${props.hiddenCount} tool ${props.hiddenCount === 1 ? "call" : "calls"}.`}+ onPress={() => {+ void Haptics.selectionAsync();+ props.onToggle();+ }}+ rowSizing={props.rowSizing}+ >+ {props.shimmer ? (+ <ShimmeringWorkContent+ key={props.rowSizing.textSizeKey}environmentId={props.environmentId}- icon={props.toolIcon}- fallback={icon}- fallbackColor={props.iconSubtleColor}+ icon={icon}+ iconSubtleColor={props.iconSubtleColor}+ label={props.summary}+ showIconthemeAppearance={props.themeAppearance}+ toolIcon={props.toolIcon}/>- </WorkLogIconSlot>- <WorkLogLabel key={props.rowSizing.textSizeKey}>{props.summary}</WorkLogLabel>- </>- )}- <ThreadDisclosureChevron- expanded={props.expanded}- collapsedDirection="down"- size={11}- tintColor={props.iconSubtleColor}- />- </WorkLogPressable>+ ) : (+ <>+ <WorkLogIconSlot>+ <ToolActivityIconView+ environmentId={props.environmentId}+ icon={props.toolIcon}+ fallback={icon}+ fallbackColor={props.iconSubtleColor}+ themeAppearance={props.themeAppearance}+ />+ </WorkLogIconSlot>+ <WorkLogLabel key={props.rowSizing.textSizeKey}>{props.summary}</WorkLogLabel>+ </>+ )}+ <ThreadDisclosureChevron+ expanded={props.expanded}+ collapsedDirection="down"+ size={11}+ tintColor={props.iconSubtleColor}+ />+ </WorkLogPressable>+ </View>+ {props.trailing}+ </View></WorkLogBlock>);}diff --git a/apps/mobile/src/lib/threadActivity.test.ts b/apps/mobile/src/lib/threadActivity.test.tsindex 92570bc7c10..1163df73f4a 100644--- a/apps/mobile/src/lib/threadActivity.test.ts+++ b/apps/mobile/src/lib/threadActivity.test.ts@@ -1,5 +1,8 @@import {MessageId,+ CheckpointId,+ CheckpointRef,+ CheckpointScopeId,RuntimeRequestId,NodeId,ProviderInstanceId,@@ -14,6 +17,8 @@ import {type OrchestrationV2ProjectedTurnItem,type OrchestrationV2TurnItem,} from "@t3tools/contracts";+import { deriveThreadCheckpointSummaries } from "@t3tools/client-runtime/state/thread-checkpoints";+import { getReviewSectionIdForCheckpoint } from "../features/review/reviewModel";import * as DateTime from "effect/DateTime";import { describe, expect, it } from "vite-plus/test";@@ -211,6 +216,125 @@ describe("buildThreadFeed", () => {},);+ it.each([false, true])(+ "carries a late checkpoint to only the final answer without changing cached messages (cache: %s)",+ (cached) => {+ const cache = cached ? createThreadFeedCache() : undefined;+ const earlier = {+ ...assistantMessage(),+ id: TurnItemId.make("earlier-item"),+ messageId: MessageId.make("earlier-message"),+ text: "Working on the files",+ };+ const final = assistantMessage("2026-06-20T00:00:04.000Z");+ const rows = [projected(earlier, 0), projected(final, 1)];+ const before = buildThreadFeed(rows, { cache });+ const [summary] = deriveThreadCheckpointSummaries({+ messages: [earlier, final].map((message) => ({+ ...message,+ id: message.messageId,+ role: "assistant",+ createdBy: "agent",+ creationSource: "provider",+ attachments: [],+ createdAt: message.startedAt,+ })),+ checkpoints: [+ {+ id: CheckpointId.make("checkpoint-final"),+ threadId,+ scopeId: CheckpointScopeId.make("scope"),+ runId,+ nodeId: NodeId.make("node"),+ parentCheckpointId: null,+ ordinalWithinScope: 1,+ appRunOrdinal: 2,+ ref: CheckpointRef.make("checkpoint-ref"),+ status: "ready",+ capturedAt: final.updatedAt,+ files: [+ { path: "src/one.ts", kind: "modified", additions: 10, deletions: 2 },+ { path: "src/two.ts", kind: "added", additions: 5, deletions: 0 },+ ],+ },+ ],+ });+ expect(summary).toBeDefined();+ if (!summary) return;+ const after = buildThreadFeed(rows, { checkpointSummaries: [summary], cache });+ expect(after[0]).toBe(before[0]);+ expect(after[1]).toMatchObject({+ type: "message",+ message: { id: final.messageId, checkpointSummary: summary },+ });+ expect(before[1]).not.toHaveProperty("message.checkpointSummary");+ expect(getReviewSectionIdForCheckpoint(summary)).toBe("turn:2");+ const fallback = deriveThreadFeedPresentation(+ [after.at(-1)!],+ null,+ new Set(),+ new Set(),+ null,+ false,+ cache,+ );+ expect(fallback.at(-1)).toMatchObject({ message: { checkpointSummary: summary } });+ const workRows = [+ projected(userMessage(), 0),+ projected(command(), 1),+ projected({ ...command(), id: TurnItemId.make("second-command") }, 2),+ projected(final, 3),+ ];+ const workBefore = buildThreadFeed(workRows, { cache });+ deriveThreadFeedPresentation(workBefore, null, new Set(), new Set(), null, false, cache);+ const workAfter = buildThreadFeed(workRows, { checkpointSummaries: [summary], cache });+ for (const expanded of [new Set<RunId>(), new Set([runId])]) {+ const presented = deriveThreadFeedPresentation(+ workAfter,+ null,+ expanded,+ new Set(),+ null,+ false,+ cache,+ );+ expect(presented.find((entry) => entry.type === "run-fold")).toMatchObject({+ checkpointSummary: summary,+ });+ expect(presented.at(-1)).not.toHaveProperty("message.checkpointSummary");+ }+ const active = deriveThreadFeedPresentation(+ workAfter,+ {+ runId,+ status: "running",+ startedAt: "2026-06-20T00:00:00.000Z",+ completedAt: null,+ },+ new Set(),+ new Set(),+ null,+ false,+ cache,+ );+ expect(active.find((entry) => entry.type === "work-toggle")).toMatchObject({+ checkpointSummary: summary,+ });+ expect(active.at(-1)).not.toHaveProperty("message.checkpointSummary");+ expect(workBefore.at(-1)).not.toHaveProperty("message.checkpointSummary");++ for (const checkpoint of [+ { ...summary, files: [] },+ ...(["missing", "error", "stale"] as const).map((status) => ({ ...summary, status })),+ { ...summary, runId: RunId.make("another-run") },+ { ...summary, assistantMessageId: MessageId.make("unloaded-message") },+ ]) {+ expect(buildThreadFeed(rows, { checkpointSummaries: [checkpoint], cache })).toEqual(before);+ }+ expect(buildThreadFeed(rows, { cache })).toEqual(before);+ },+ );+it("omits cached tool output and patch bodies from expanded and copied activity", () => {const rawOutput = "RAW_TOOL_OUTPUT";const items: OrchestrationV2TurnItem[] = [diff --git a/apps/mobile/src/lib/threadActivity.ts b/apps/mobile/src/lib/threadActivity.tsindex c703d223878..1e942fc8ca7 100644--- a/apps/mobile/src/lib/threadActivity.ts+++ b/apps/mobile/src/lib/threadActivity.ts@@ -4,6 +4,7 @@ import type {ThreadUserInputQuestion,} from "@t3tools/client-runtime/state/thread-requests";import { turnItemIsWorkspacePreparation } from "@t3tools/client-runtime/state/turn-item-presentation";+import type { ThreadCheckpointSummary } from "@t3tools/client-runtime/state/thread-checkpoints";import { formatSubagentDisplayTitle } from "@t3tools/client-runtime/state/subagent-display";import { isLiveSubagentTurnItem } from "@t3tools/client-runtime/state/subagentRuntime";import { extractToolActivityPresentation } from "@t3tools/client-runtime/work-log/tool-presentation";@@ -145,6 +146,7 @@ export interface ThreadFeedMessage {readonly createdAt: string;readonly updatedAt: string;readonly projectedItem?: OrchestrationV2ProjectedTurnItem;+ readonly checkpointSummary?: ThreadCheckpointSummary;}export interface LocalThreadMessage {@@ -191,7 +193,10 @@ type RawThreadFeedEntry =readonly app: McpAppReference;};-export type ThreadFeedEntry = ThreadFeedEntryContent & { readonly continuesWorkLog?: boolean };+export type ThreadFeedEntry = ThreadFeedEntryContent & {+ readonly continuesWorkLog?: boolean;+ readonly checkpointSummary?: ThreadCheckpointSummary;+};type ThreadFeedEntryContent =| Extract<RawThreadFeedEntry, { type: "message" | "html-render" | "mcp-app" }>@@ -1471,6 +1476,39 @@ export function deriveThreadFeedPresentation() {result.push(thinkingRow(activeWorkStartedAt, activeRunId));}+ const checkpointByRunId = new Map<RunId, ThreadCheckpointSummary>();+ for (const entry of sourceFeed) {+ if (entry.type === "message" && entry.message.checkpointSummary) {+ checkpointByRunId.set(entry.message.checkpointSummary.runId, entry.message.checkpointSummary);+ }+ }+ const workRowByRunId = new Map<RunId, number>();+ for (let index = tailStart; index < result.length; index += 1) {+ const row = result[index]!;+ if (+ (row.type === "run-fold" || row.type === "work-toggle") &&+ row.runId !== null &&+ checkpointByRunId.has(row.runId) &&+ (row.type === "run-fold" || !workRowByRunId.has(row.runId))+ ) {+ workRowByRunId.set(row.runId, index);+ }+ }+ for (const [runId, index] of workRowByRunId) {+ result[index] = { ...result[index]!, checkpointSummary: checkpointByRunId.get(runId)! };+ }+ for (let index = tailStart; index < result.length; index += 1) {+ const row = result[index]!;+ if (+ row.type !== "message" ||+ !row.message.checkpointSummary ||+ !workRowByRunId.has(row.message.checkpointSummary.runId)+ )+ continue;+ const message = { ...row.message };+ delete message.checkpointSummary;+ result[index] = { ...row, message };+ }// Reused rows are final: the user message after them never continues a work log.for (let index = tailStart; index < result.length; index += 1) {const row = result[index]!;@@ -1899,6 +1937,7 @@ interface ThreadFeedBuild {readonly rows: ReadonlyArray<OrchestrationV2ProjectedTurnItem>;readonly attempts: ReadonlyArray<OrchestrationV2RunAttempt> | undefined;readonly nodes: ReadonlyArray<OrchestrationV2ExecutionNode> | undefined;+ readonly checkpointSummaries: ReadonlyArray<ThreadCheckpointSummary> | undefined;readonly foldedAnswerMessageIds: ReadonlySet<string>;readonly delegatedChildrenByRun: ReadonlyMap<RunId, ReadonlySet<string>>;readonly feed: ReadonlyArray<ThreadFeedEntry>;@@ -1928,6 +1967,30 @@ function setsEqual<T>(left: ReadonlySet<T>, right: ReadonlySet<T>): boolean {return true;}+// Summaries are re-derived whenever messages change, including streamed text,+// so a new array often holds the same checkpoints.+function checkpointSummariesEqual(+ left: ReadonlyArray<ThreadCheckpointSummary> | undefined,+ right: ReadonlyArray<ThreadCheckpointSummary> | undefined,+): boolean {+ if (left === right) return true;+ if (left === undefined || right === undefined || left.length !== right.length) return false;+ return left.every((summary, index) => {+ const other = right[index]!;+ return (+ summary.checkpointId === other.checkpointId &&+ summary.scopeId === other.scopeId &&+ summary.runId === other.runId &&+ summary.checkpointTurnCount === other.checkpointTurnCount &&+ summary.checkpointRef === other.checkpointRef &&+ summary.completedAt === other.completedAt &&+ summary.status === other.status &&+ summary.files === other.files &&+ summary.assistantMessageId === other.assistantMessageId+ );+ });+}+function setMapsEqual<K, V>(left: ReadonlyMap<K, ReadonlySet<V>>,right: ReadonlyMap<K, ReadonlySet<V>>,@@ -1954,6 +2017,7 @@ export function buildThreadFeed(readonly anchoredMessages?: ReadonlyArray<LocalThreadMessage>;readonly attempts?: ReadonlyArray<OrchestrationV2RunAttempt>;readonly nodes?: ReadonlyArray<OrchestrationV2ExecutionNode>;+ readonly checkpointSummaries?: ReadonlyArray<ThreadCheckpointSummary>;readonly cache?: ThreadFeedCache;},): ThreadFeedEntry[] {@@ -2000,6 +2064,7 @@ export function buildThreadFeed(anchoredMessages.length === 0 &&previous.attempts === options?.attempts &&previous.nodes === options?.nodes &&+ checkpointSummariesEqual(previous.checkpointSummaries, options?.checkpointSummaries) &&setsEqual(previous.foldedAnswerMessageIds, foldedAnswerMessageIds) &&setMapsEqual(previous.delegatedChildrenByRun, delegatedChildrenByRun)) {@@ -2154,8 +2219,18 @@ export function buildThreadFeed(if (insertionIndex === -1) entries.push(entry);else entries.splice(insertionIndex, 0, entry);}+ const checkpointByMessageId = new Map(+ (options?.checkpointSummaries ?? [])+ .filter((checkpoint) => checkpoint.status === "ready" && checkpoint.files.length > 0)+ .map((checkpoint) => [checkpoint.assistantMessageId, checkpoint]),+ );const grouped = groupAdjacentActivities(- entries,+ entries.map((entry) => {+ if (entry.type !== "message" || entry.message.role !== "assistant") return entry;+ const checkpointSummary = checkpointByMessageId.get(entry.message.id);+ if (!checkpointSummary || checkpointSummary.runId !== entry.message.runId) return entry;+ return { ...entry, message: { ...entry.message, checkpointSummary } };+ }),delegatedChildrenByRun,// Anchored messages shift entries away from their rows; such a build is not reused.anchoredMessages.length > 0@@ -2175,6 +2250,7 @@ export function buildThreadFeed(rows: visibleTurnItems,attempts: options?.attempts,nodes: options?.nodes,+ checkpointSummaries: options?.checkpointSummaries,foldedAnswerMessageIds,delegatedChildrenByRun,feed,diff --git a/apps/mobile/src/state/thread-task-permissions.test.ts b/apps/mobile/src/state/thread-task-permissions.test.tsindex c6c6e06336c..82ac4dfff5b 100644--- a/apps/mobile/src/state/thread-task-permissions.test.ts+++ b/apps/mobile/src/state/thread-task-permissions.test.ts@@ -108,7 +108,10 @@ vi.mock("./use-atom-command", () => ({ useAtomCommand: <A>(command: A) => commanvi.mock("./threads", async () => {const { Atom } = await import("effect/reactivity");return {- environmentThreadDetails: { queueWorkflowAtom: () => Atom.make(null) },+ environmentThreadDetails: {+ queueWorkflowAtom: () => Atom.make(null),+ checkpointSummariesAtom: () => Atom.make([]),+ },threadEnvironment: {respondToApproval: state.approve,respondToUserInput: state.answer,diff --git a/apps/mobile/src/state/use-thread-composer-state.ts b/apps/mobile/src/state/use-thread-composer-state.tsindex c979ac6d4b6..f40da862253 100644--- a/apps/mobile/src/state/use-thread-composer-state.ts+++ b/apps/mobile/src/state/use-thread-composer-state.ts@@ -4,6 +4,7 @@ import { readEnvironmentScope } from "./session";import type { ComposerTextPaste } from "../native/T3ComposerEditor.types";import { useAtomValue } from "@effect/atom-react";import { threadRuntimeIsActive } from "@t3tools/client-runtime/state/shell";+import type { ThreadCheckpointSummary } from "@t3tools/client-runtime/state/thread-checkpoints";import { resolvePendingHandoff } from "@t3tools/client-runtime/handoff";import {deriveProviderSubagentStatus,@@ -117,6 +118,7 @@ import { useAtomCommand } from "./use-atom-command";const EMPTY_QUEUE_WORKFLOW_ATOM = Atom.make<null>(null).pipe(Atom.withLabel("mobile-thread-queue-workflow:empty"),);+const EMPTY_CHECKPOINT_SUMMARIES_ATOM = Atom.make<ReadonlyArray<ThreadCheckpointSummary>>([]);export function appendReviewCommentToDraft(input: {readonly environmentId: EnvironmentId;@@ -240,6 +242,11 @@ export function useThreadComposerState() {const selectedThreadMessages = selectedThreadProjection?.projection.messages;const selectedThreadAttempts = selectedThreadProjection?.projection.attempts;const selectedThreadNodes = selectedThreadProjection?.projection.nodes;+ const checkpointSummaries = useAtomValue(+ selectedThreadDetailRef === null+ ? EMPTY_CHECKPOINT_SUMMARIES_ATOM+ : environmentThreadDetails.checkpointSummariesAtom(selectedThreadDetailRef),+ );// A thread whose creation has not delivered its turn yet: the prompt only// exists in the outbox, so it is appended to whatever the server has. The// detail is usually present but empty during a worktree checkout, so this@@ -256,6 +263,7 @@ export function useThreadComposerState() {anchoredMessages: pendingCreation,attempts: selectedThreadAttempts,nodes: selectedThreadNodes,+ checkpointSummaries,cache: feedCache,});const pendingAcknowledgments = acknowledgedMessages.filter(