@devries-cameron20 / t3code Mirror · read-only / commits / b3ce149be5
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, 22:15 UTC

fix(mobile): Fast can be turned on for an existing thread (#29761)

Julius Marminge committed Nov 11, 2026 at 15:32 UTC b3ce149be54fe445298c26dadac974ef581662ec
11 files changed +151 -64
apps/mobile/src/features/settings/SettingsScheduledTasksRouteScreen.tsx
+2 -1
@@ -61,6 +61,7 @@ import { webhookAddress } from "@t3tools/client-runtime/webhook-address";
61 import { tryCopyTextWithHaptic } from "../../lib/copyTextWithHaptic";
62 import { usePreparedConnection } from "../../state/session";
63 import { buildModelOptions } from "../../lib/modelOptions";
64 +import { withImplicitFastModeSelection } from "../../lib/providerOptions";
65 import { useProjects, useEnvironmentServerConfig } from "../../state/entities";
66 import { useEnvironmentQuery } from "../../state/query";
67 import { serverEnvironment } from "../../state/server";
@@ -770,7 +771,7 @@ function TaskForm({
771 title: draft.title.trim(),
772 prompt: draft.prompt.trim(),
773 projectId: draft.projectId,
773 - modelSelection: draft.modelSelection,
774 + modelSelection: withImplicitFastModeSelection(draft.modelSelection, config?.providers ?? []),
775 schedule,
776 enabled: draft.enabled,
777 threadId: draft.threadId,
apps/mobile/src/features/threads/ThreadSettingsSheet.tsx
+4 -7
@@ -27,7 +27,6 @@ import { AnimatedLegendList } from "@legendapp/list/reanimated";
27 import {
28 getProviderOptionCurrentLabel,
29 getProviderOptionCurrentValue,
30 - getProviderOptionDescriptors,
30 } from "@t3tools/shared/model";
31 import {
32 useNavigation,
@@ -487,12 +486,10 @@ function ThreadSettingsSessionProvider(
486 pendingModel ? option.key === pendingModel.key : isApplied(option);
487
488 const displayedDescriptors = pendingModel
490 - ? pendingModel.capabilities
491 - ? getProviderOptionDescriptors({
492 - caps: pendingModel.capabilities,
493 - selections: pendingModel.selection.options,
494 - })
495 - : []
489 + ? resolveProviderOptionDescriptors({
490 + capabilities: pendingModel.capabilities,
491 + selections: pendingModel.selection.options,
492 + })
493 : props.optionDescriptors;
494 const promptTraits = getPromptControlledTraits(displayedDescriptors, displayedPrompt);
495 const displayedModel =
apps/mobile/src/features/threads/thread-settings-options.test.ts
+36 -4
@@ -2,13 +2,19 @@ import {
2 getPromptControlledTraits,
3 getTraitSelectChange,
4 } from "@t3tools/client-runtime/model-traits";
5 -import type {
6 - ManagedPolicySummary,
7 - ProviderOptionDescriptor,
8 - RuntimeMode,
5 +import {
6 + ProviderInstanceId,
7 + type ManagedPolicySummary,
8 + type ProviderOptionDescriptor,
9 + type RuntimeMode,
10 } from "@t3tools/contracts";
11 import { describe, expect, it } from "vite-plus/test";
12
13 +import {
14 + applyProviderOptionSelection,
15 + resolveProviderOptionDescriptors,
16 + withImplicitFastModeSelection,
17 +} from "../../lib/providerOptions";
18 import {
19 RUNTIME_MODE_CHOICES,
20 resolveNewThreadRuntimeMode,
@@ -64,6 +70,32 @@ const effortDescriptor: Extract<ProviderOptionDescriptor, { type: "select" }> =
70 promptInjectedValues: ["ultrathink"],
71 };
72
73 +describe("fast mode switch", () => {
74 + // regression: #29729 Cursor reports Fast on by default, but its picker shows an unset fastMode as off
75 + it("shows an unset fast mode as off, saves it as off and turns it on when toggled", () => {
76 + const capabilities = {
77 + optionDescriptors: [
78 + { id: "fastMode", label: "Fast", type: "boolean", currentValue: true } as const,
79 + ],
80 + };
81 + const selection = { instanceId: ProviderInstanceId.make("cursor"), model: "composer-2.5" };
82 + const descriptors = resolveProviderOptionDescriptors({ capabilities, selections: undefined });
83 + const shown = descriptors.find((descriptor) => descriptor.id === "fastMode")?.currentValue;
84 +
85 + expect({
86 + shown,
87 + saved: withImplicitFastModeSelection(selection, [
88 + { instanceId: selection.instanceId, models: [{ slug: selection.model, capabilities }] },
89 + ]).options,
90 + afterToggle: applyProviderOptionSelection(descriptors, { id: "fastMode", value: !shown }),
91 + }).toEqual({
92 + shown: false,
93 + saved: [{ id: "fastMode", value: false }],
94 + afterToggle: [{ id: "fastMode", value: true }],
95 + });
96 + });
97 +});
98 +
99 describe("selectableChoices", () => {
100 // regression: #21406 bring model controls in line with web
101 it("leaves out prompt-injected choices and keeps workflow choices in declared order", () => {
apps/mobile/src/lib/providerOptions.ts
+22 -1
@@ -1,11 +1,15 @@
1 import type {
2 ModelCapabilities,
3 + ModelSelection,
4 + ProviderInstanceId,
5 ProviderOptionDescriptor,
6 ProviderOptionSelection,
7 + ServerProviderModel,
8 } from "@t3tools/contracts";
9 import {
10 buildProviderOptionSelectionsFromDescriptors,
11 getProviderOptionDescriptors,
12 + withImplicitFastModeDefault,
13 } from "@t3tools/shared/model";
14
15 export function resolveProviderOptionDescriptors(input: {
@@ -17,10 +21,27 @@ export function resolveProviderOptionDescriptors(input: {
21 }
22 return getProviderOptionDescriptors({
23 caps: input.capabilities,
20 - selections: input.selections,
24 + selections: withImplicitFastModeDefault(input.capabilities, input.selections),
25 });
26 }
27
28 +/** Spells out the Fast off the picker shows, or a provider such as Cursor applies its own default. */
29 +export function withImplicitFastModeSelection(
30 + selection: ModelSelection,
31 + providers: ReadonlyArray<{
32 + readonly instanceId: ProviderInstanceId;
33 + readonly models: ReadonlyArray<Pick<ServerProviderModel, "slug" | "capabilities">>;
34 + }>,
35 +): ModelSelection {
36 + const capabilities = providers
37 + .find((provider) => provider.instanceId === selection.instanceId)
38 + ?.models.find((model) => model.slug === selection.model)?.capabilities;
39 + const options = capabilities
40 + ? withImplicitFastModeDefault(capabilities, selection.options)
41 + : selection.options;
42 + return options === selection.options ? selection : { ...selection, options };
43 +}
44 +
45 export function applyProviderOptionSelection(
46 descriptors: ReadonlyArray<ProviderOptionDescriptor>,
47 change: ProviderOptionSelection,
apps/mobile/src/state/thread-outbox-model.ts
+11 -2
@@ -22,10 +22,12 @@ import {
22 type ProviderInteractionMode as ProviderInteractionModeType,
23 type RuntimeMode as RuntimeModeType,
24 type ServerProvider,
25 + type ServerProviderModel,
26 } from "@t3tools/contracts";
27 import * as Schema from "effect/Schema";
28
29 import { DraftComposerAttachmentSchema } from "../lib/composer-image-schema";
30 +import { withImplicitFastModeSelection } from "../lib/providerOptions";
31 import type { ComposerDispatchMode } from "@t3tools/client-runtime/state/composer-dispatch";
32 import type { DraftComposerAttachment } from "../lib/composerImages";
33 import { scopedThreadKey } from "../lib/scopedEntities";
@@ -118,9 +120,16 @@ function resolveProviderInteractionMode(
120 export function resolveQueuedThreadSettings(
121 message: QueuedThreadMessage,
122 thread: ThreadSettingsSnapshot,
121 - providers: ReadonlyArray<Pick<ServerProvider, "instanceId" | "showInteractionModeToggle">> = [],
123 + providers: ReadonlyArray<
124 + Pick<ServerProvider, "instanceId" | "showInteractionModeToggle"> & {
125 + readonly models: ReadonlyArray<Pick<ServerProviderModel, "slug" | "capabilities">>;
126 + }
127 + > = [],
128 ): ThreadSettingsSnapshot {
123 - const modelSelection = message.modelSelection ?? thread.modelSelection;
129 + const modelSelection = withImplicitFastModeSelection(
130 + message.modelSelection ?? thread.modelSelection,
131 + providers,
132 + );
133 const provider = providers.find(
134 (candidate) => candidate.instanceId === modelSelection.instanceId,
135 );
apps/mobile/src/state/thread-outbox.test.ts
+38 -2
@@ -357,8 +357,8 @@ describe("thread outbox", () => {
357 options: [{ id: "native-option", value: "keep-this-choice" }],
358 };
359 const providers = [
360 - { instanceId: codex.instanceId, showInteractionModeToggle: true },
361 - { instanceId: antigravity.instanceId, showInteractionModeToggle: false },
360 + { instanceId: codex.instanceId, showInteractionModeToggle: true, models: [] },
361 + { instanceId: antigravity.instanceId, showInteractionModeToggle: false, models: [] },
362 ];
363 const message = {
364 ...queuedMessage({ messageId: "queued-plan", createdAt: "2026-09-02T10:00:00.000Z" }),
@@ -391,6 +391,42 @@ describe("thread outbox", () => {
391 ).toBe("plan");
392 });
393
394 + // regression: #29729 Cursor runs its own Fast default when the turn carries no fastMode
395 + it("sends the Fast off the picker shows for a model without a Fast selection", () => {
396 + const cursor = { instanceId: ProviderInstanceId.make("cursor"), model: "composer-2.5" };
397 + const providers = [
398 + {
399 + instanceId: cursor.instanceId,
400 + showInteractionModeToggle: true,
401 + models: [
402 + {
403 + slug: cursor.model,
404 + capabilities: {
405 + optionDescriptors: [
406 + { id: "fastMode", label: "Fast", type: "boolean", currentValue: true } as const,
407 + ],
408 + },
409 + },
410 + ],
411 + },
412 + ];
413 + const thread = {
414 + modelSelection: cursor,
415 + runtimeMode: "full-access",
416 + interactionMode: "default",
417 + } as const;
418 + const message = queuedMessage({ messageId: "fast", createdAt: "2026-11-03T10:00:00.000Z" });
419 + const fastOn = { ...cursor, options: [{ id: "fastMode", value: true }] };
420 +
421 + expect(resolveQueuedThreadSettings(message, thread, providers).modelSelection.options).toEqual([
422 + { id: "fastMode", value: false },
423 + ]);
424 + expect(
425 + resolveQueuedThreadSettings({ ...message, modelSelection: fastOn }, thread, providers)
426 + .modelSelection,
427 + ).toEqual(fastOn);
428 + });
429 +
430 it("holds the mutation queue while persisted messages are loading", async () => {
431 const registry = AtomRegistry.make();
432 const message = queuedMessage({
apps/mobile/src/state/threadOutboxDelivery.permissions.test.ts
+1 -1
@@ -41,7 +41,7 @@ const state = vi.hoisted(() => ({
41 },
42 config: {
43 shellThreadFamilies: false,
44 - providers: [{ instanceId: "codex", driver: "codex" }],
44 + providers: [{ instanceId: "codex", driver: "codex", models: [] }],
45 environment: { capabilities: {} },
46 },
47 }));
apps/web/src/components/chat/composerProviderState.test.tsx
+1 -28
@@ -6,11 +6,7 @@ import {
6 type ProviderOptionSelection,
7 type ServerProviderModel,
8 } from "@t3tools/contracts";
9 -import {
10 - getComposerProviderState,
11 - getComposerReasoningStep,
12 - withImplicitFastModeDefault,
13 -} from "./composerProviderState";
9 +import { getComposerProviderState, getComposerReasoningStep } from "./composerProviderState";
10 import { readPromptUltrathink } from "./TraitsPicker";
11
12 const PROVIDER: ProviderDriverKind = ProviderDriverKind.make("codex");
@@ -209,29 +205,6 @@ describe("getComposerProviderState", () => {
205 });
206 });
207
212 -describe("withImplicitFastModeDefault", () => {
213 - // regression: #2981 a remembered Fast mode choice must survive the implicit default on new chats
214 - it("injects fastMode false only when the model exposes fastMode and no selection exists", () => {
215 - expect(
216 - withImplicitFastModeDefault(
217 - {
218 - optionDescriptors: [booleanDescriptor("fastMode", true)],
219 - },
220 - undefined,
221 - ),
222 - ).toEqual(selections(["fastMode", false]));
223 -
224 - expect(
225 - withImplicitFastModeDefault(
226 - {
227 - optionDescriptors: [booleanDescriptor("fastMode", true)],
228 - },
229 - selections(["fastMode", true]),
230 - ),
231 - ).toEqual(selections(["fastMode", true]));
232 - });
233 -});
234 -
208 describe("readPromptUltrathink", () => {
209 it("tells the Ultrathink prefix apart from the word in the body", () => {
210 expect(readPromptUltrathink("Fix the bug")).toBe("none");
apps/web/src/components/chat/composerProviderState.tsx
+1 -18
@@ -13,6 +13,7 @@ import {
13 getProviderOptionDescriptors,
14 isClaudeUltrathinkPrompt,
15 normalizeModelSlug,
16 + withImplicitFastModeDefault,
17 } from "@t3tools/shared/model";
18
19 import type { DraftId } from "../../composerDraftStore";
@@ -62,24 +63,6 @@ export function getComposerPromptInjectionState(prompt: string): ComposerPromptI
63 return isClaudeUltrathinkPrompt(prompt) ? "ultrathink" : "none";
64 }
65
65 -/** Cursor ACP can default Fast to true; T3 requires a user selection. */
66 -export function withImplicitFastModeDefault(
67 - caps: ModelCapabilities,
68 - modelOptions: ReadonlyArray<ProviderOptionSelection> | null | undefined,
69 -): ReadonlyArray<ProviderOptionSelection> | undefined {
70 - const hasExplicitFastMode = modelOptions?.some((selection) => selection.id === "fastMode");
71 - if (hasExplicitFastMode) {
72 - return modelOptions ?? undefined;
73 - }
74 - const hasFastModeDescriptor = caps.optionDescriptors?.some(
75 - (descriptor) => descriptor.type === "boolean" && descriptor.id === "fastMode",
76 - );
77 - if (!hasFastModeDescriptor) {
78 - return modelOptions ?? undefined;
79 - }
80 - return [...(modelOptions ?? []), { id: "fastMode", value: false }];
81 -}
82 -
66 function resolveComposerOptionSelections(
67 models: ReadonlyArray<ServerProviderModel>,
68 model: string,
packages/shared/src/model.test.ts
+17
@@ -11,6 +11,7 @@ import {
11 getProviderOptionDescriptors,
12 readCustomModelEntries,
13 modelSelectionsEqual,
14 + withImplicitFastModeDefault,
15 } from "./model.ts";
16
17 const codexCaps: ModelCapabilities = createModelCapabilities({
@@ -227,3 +228,19 @@ describe("provider-reported option display", () => {
228 expect(getProviderOptionCurrentLabel(descriptor, selected, reported)).toBe("Unknown");
229 });
230 });
231 +
232 +describe("withImplicitFastModeDefault", () => {
233 + // regression: #2981 a remembered Fast mode choice must survive the implicit default on new chats
234 + it("injects fastMode false only when the model exposes fastMode and no selection exists", () => {
235 + const caps = createModelCapabilities({
236 + optionDescriptors: [{ id: "fastMode", label: "Fast", type: "boolean", currentValue: true }],
237 + });
238 +
239 + expect(withImplicitFastModeDefault(caps, undefined)).toEqual([
240 + { id: "fastMode", value: false },
241 + ]);
242 + expect(withImplicitFastModeDefault(caps, [{ id: "fastMode", value: true }])).toEqual([
243 + { id: "fastMode", value: true },
244 + ]);
245 + });
246 +});
packages/shared/src/model.ts
+18
@@ -130,6 +130,24 @@ export function draftModelPickMatchesThread(pick: ModelSelection, thread: ModelS
130 return modelSelectionsEqual(withoutFastModeOff(pick), withoutFastModeOff(thread));
131 }
132
133 +/** Cursor ACP can default Fast to true; T3 requires a user selection. */
134 +export function withImplicitFastModeDefault(
135 + caps: ModelCapabilities,
136 + modelOptions: ReadonlyArray<ProviderOptionSelection> | null | undefined,
137 +): ReadonlyArray<ProviderOptionSelection> | undefined {
138 + const hasExplicitFastMode = modelOptions?.some((selection) => selection.id === "fastMode");
139 + if (hasExplicitFastMode) {
140 + return modelOptions ?? undefined;
141 + }
142 + const hasFastModeDescriptor = caps.optionDescriptors?.some(
143 + (descriptor) => descriptor.type === "boolean" && descriptor.id === "fastMode",
144 + );
145 + if (!hasFastModeDescriptor) {
146 + return modelOptions ?? undefined;
147 + }
148 + return [...(modelOptions ?? []), { id: "fastMode", value: false }];
149 +}
150 +
151 function resolveDescriptorChoiceValue(
152 descriptor: Extract<ProviderOptionDescriptor, { type: "select" }>,
153 raw: string | null | undefined,