@devries-cameron20 / t3code Mirror · read-only / commits / 3e90486b75
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 21, 21:00 UTC

fix(mobile): show and let users skip compaction before sending to stale Claude threads (#34482)

Julius Marminge committed Nov 11, 2026 at 16:28 UTC 3e90486b75c44fa06a1442efa175f2996a2f56da
3 files changed +28 -10
apps/mobile/src/features/threads/ThreadDetailScreen.tsx
+13 -4
@@ -249,7 +249,8 @@ export interface ThreadDetailScreenProps {
249 /** Set while the next send compacts the thread first. */
250 readonly compactBeforeSend?: {
251 readonly tokens: number;
252 - readonly keepFullHistory: () => void;
252 + readonly keepFullHistory: boolean;
253 + readonly toggleKeepFullHistory: () => void;
254 } | null;
255 readonly creationState:
256 | {
@@ -1691,11 +1692,19 @@ function ThreadDetailBody(
1692 {props.compactBeforeSend ? (
1693 <View className="px-4 pb-3">
1694 <Notice
1694 - message={`Your next message compacts ${formatTokens(props.compactBeforeSend.tokens)} tokens of history first.`}
1695 + message={
1696 + props.compactBeforeSend.keepFullHistory
1697 + ? `Your next message keeps all ${formatTokens(props.compactBeforeSend.tokens)} tokens of history.`
1698 + : `Your next message compacts ${formatTokens(props.compactBeforeSend.tokens)} tokens of history first.`
1699 + }
1700 icon="arrow.down.right.and.arrow.up.left"
1701 floating
1697 - onDismiss={props.compactBeforeSend.keepFullHistory}
1698 - dismissLabel="Keep the full history"
1702 + onDismiss={props.compactBeforeSend.toggleKeepFullHistory}
1703 + dismissLabel={
1704 + props.compactBeforeSend.keepFullHistory
1705 + ? "Compact first"
1706 + : "Keep the full history"
1707 + }
1708 />
1709 </View>
1710 ) : null}
apps/mobile/src/state/thread-task-permissions.test.ts
+12 -4
@@ -346,15 +346,23 @@ describe("mobile task permissions", () => {
346 expect.not.objectContaining({ compactBeforeSend: true }),
347 );
348 state.draft = { ...state.draft, modelSelection: undefined };
349 - composer.compactBeforeSend?.keepFullHistory();
349 + composer.compactBeforeSend?.toggleKeepFullHistory();
350 const kept = useThreadComposerState(NO_SIDE_CHATS);
351 - expect(kept.compactBeforeSend).toBeNull();
352 - await kept.onSendMessage();
351 + expect(kept.compactBeforeSend?.keepFullHistory).toBe(true);
352 + kept.compactBeforeSend?.toggleKeepFullHistory();
353 + const compactAgain = useThreadComposerState(NO_SIDE_CHATS);
354 + expect(compactAgain.compactBeforeSend?.keepFullHistory).toBe(false);
355 + await compactAgain.onSendMessage();
356 + expect(state.enqueue).toHaveBeenLastCalledWith(
357 + expect.objectContaining({ compactBeforeSend: true }),
358 + );
359 + compactAgain.compactBeforeSend?.toggleKeepFullHistory();
360 + await useThreadComposerState(NO_SIDE_CHATS).onSendMessage();
361 expect(state.enqueue).toHaveBeenLastCalledWith(
362 expect.not.objectContaining({ compactBeforeSend: true }),
363 );
364 // Keeping covers one send, as on web.
357 - expect(useThreadComposerState(NO_SIDE_CHATS).compactBeforeSend?.tokens).toBe(248_000);
365 + expect(useThreadComposerState(NO_SIDE_CHATS).compactBeforeSend?.keepFullHistory).toBe(false);
366 state.freshPending = true;
367 await composer.onSendMessage();
368 expect(state.enqueue).toHaveBeenLastCalledWith(
apps/mobile/src/state/use-thread-composer-state.ts
+3 -2
@@ -892,11 +892,12 @@ export function useThreadComposerState(input: {
892 providerSubagentStatus,
893 isCompacting,
894 compactBeforeSend:
895 - compactTokens === null || selectedThreadKey === null || keepFullHistory
895 + compactTokens === null || selectedThreadKey === null
896 ? null
897 : {
898 tokens: compactTokens,
899 - keepFullHistory: () => setKeepFullHistory(selectedThreadKey, true),
899 + keepFullHistory,
900 + toggleKeepFullHistory: () => setKeepFullHistory(selectedThreadKey, !keepFullHistory),
901 },
902 composerDraftKey,
903 followUpBehavior,