@devries-cameron20 / t3code-1 / commits / 85bd3f2a2a
Fork 0

The best way to control Claude Code, Codex and more from any computer or phone

fix(web): hide Ultrathink from the Claude effort picker (#28044)

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>

Theo Browne committed Oct 31, 2026 at 02:14 UTC 85bd3f2a2a0ad4a8ddf2950e01db80765e9a1bf4
7 files changed +47 -124
apps/mobile/src/features/threads/ThreadSettingsSheet.tsx
+3 -5
@@ -560,12 +560,10 @@ function ThreadSettingsSessionProvider(
560 props.onPromptChange(change.prompt);
561 }
562 }
563 - if (!("modelOptions" in change)) return;
563 }
565 - const next =
566 - change && "modelOptions" in change
567 - ? (change.modelOptions ?? [])
568 - : applyProviderOptionSelection(displayedDescriptors, { id, value });
564 + const next = change
565 + ? (change.modelOptions ?? [])
566 + : applyProviderOptionSelection(displayedDescriptors, { id, value });
567 if (!next) {
568 return;
569 }
apps/mobile/src/features/threads/thread-settings-options.test.ts
+2 -33
@@ -24,40 +24,17 @@ const effortDescriptor: Extract<ProviderOptionDescriptor, { type: "select" }> =
24
25 describe("selectableChoices", () => {
26 // regression: #21406 bring model controls in line with web
27 - it("includes prompt-injected and workflow choices in declared order", () => {
27 + it("leaves out prompt-injected choices and keeps workflow choices in declared order", () => {
28 expect(selectableChoices(effortDescriptor).map((choice) => choice.id)).toEqual([
29 "low",
30 "medium",
31 "high",
32 - "ultrathink",
32 "ultracode",
33 ]);
34 });
35 });
36
37 describe("prompt-controlled reasoning", () => {
39 - it("adds Ultrathink to the prompt without persisting an injected option", () => {
40 - const descriptors = [effortDescriptor];
41 - const change = getTraitSelectChange(
42 - { ...getPromptControlledTraits(descriptors, "solve it"), descriptors },
43 - effortDescriptor,
44 - "solve it",
45 - "ultrathink",
46 - );
47 - expect(change).toEqual({ prompt: "Ultrathink:\nsolve it" });
48 - expect(
49 - getPromptControlledTraits(descriptors, change?.prompt ?? "").ultrathinkPromptControlled,
50 - ).toBe(true);
51 - expect(
52 - getTraitSelectChange(
53 - { ...getPromptControlledTraits(descriptors, ""), descriptors },
54 - effortDescriptor,
55 - "",
56 - "ultrathink",
57 - ),
58 - ).toEqual({ prompt: "Ultrathink:\n" });
59 - });
60 -
38 it("removes the prefix when choosing a regular effort and saves Ultracode as an option", () => {
39 const descriptors = [effortDescriptor];
40 const prompt = "Ultrathink:\nsolve it";
@@ -71,19 +48,11 @@ describe("prompt-controlled reasoning", () => {
48 ).toEqual({ prompt: "solve it", modelOptions: [{ id: "effort", value: "ultracode" }] });
49 });
50
74 - it("keeps body-controlled Ultrathink locked and preserves slash commands", () => {
51 + it("keeps body-controlled Ultrathink locked", () => {
52 const descriptors = [effortDescriptor];
53 const prompt = "please ultrathink about this";
54 const selected = { ...getPromptControlledTraits(descriptors, prompt), descriptors };
55 expect(selected.ultrathinkInBodyText).toBe(true);
56 expect(getTraitSelectChange(selected, effortDescriptor, prompt, "low")).toBeNull();
80 - expect(
81 - getTraitSelectChange(
82 - { ...getPromptControlledTraits(descriptors, "/review"), descriptors },
83 - effortDescriptor,
84 - "/review",
85 - "ultrathink",
86 - ),
87 - ).toEqual({ prompt: "/review" });
57 });
58 });
apps/web/src/components/chat/ChatComposer.tsx
+7 -9
@@ -2835,15 +2835,13 @@ export const ChatComposer = memo(function ChatComposer(props: ChatComposerProps)
2835 direction,
2836 });
2837 if (!change) return;
2838 - if (change.modelOptions) {
2839 - useComposerDraftStore
2840 - .getState()
2841 - .setProviderModelOptions(composerDraftTarget, selectedProvider, change.modelOptions, {
2842 - instanceId: selectedInstanceId,
2843 - model: selectedModel,
2844 - persistSticky: true,
2845 - });
2846 - }
2838 + useComposerDraftStore
2839 + .getState()
2840 + .setProviderModelOptions(composerDraftTarget, selectedProvider, change.modelOptions, {
2841 + instanceId: selectedInstanceId,
2842 + model: selectedModel,
2843 + persistSticky: true,
2844 + });
2845 if (change.prompt !== promptRef.current) {
2846 applyPromptReplacementStable(0, promptRef.current.length, change.prompt, {
2847 expandedCursorAfterReplace: change.cursor,
apps/web/src/components/chat/TraitsPicker.tsx
+9 -18
@@ -5,7 +5,6 @@ import {
5 replaceDescriptorCurrentValue,
6 selectableProviderOptionChoices,
7 REASONING_SELECT_DESCRIPTOR_IDS,
8 - ULTRATHINK_PROMPT_PREFIX,
8 } from "@t3tools/client-runtime/model-traits";
9 import {
10 type ModelSelection,
@@ -258,7 +257,8 @@ export function getReasoningTraitStep(input: {
257 const descriptor = selected.selectDescriptors.find((entry) =>
258 REASONING_SELECT_DESCRIPTOR_IDS.has(entry.id),
259 );
261 - if (!descriptor || descriptor.options.length < 2) return null;
260 + const choices = descriptor ? selectableProviderOptionChoices(descriptor) : [];
261 + if (!descriptor || choices.length < 2) return null;
262 const isPrimary = descriptor.id === selected.primarySelectDescriptor?.id;
263 const current =
264 isPrimary && selected.ultrathinkPromptControlled
@@ -268,26 +268,17 @@ export function getReasoningTraitStep(input: {
268 { instanceId: input.instanceId, model: input.model, options: input.modelOptions ?? [] },
269 input.reportedModelSelection,
270 );
271 + // Walk the full catalog order so a typed Ultrathink keeps its place, then land on a pickable level.
272 const ordered = input.direction > 0 ? descriptor.options : descriptor.options.toReversed();
273 const position =
274 [current, getDescriptorStringValue(descriptor)]
275 .map((value) => ordered.findIndex((option) => option.id === value))
276 .find((index) => index >= 0) ?? -1;
276 - for (const option of [
277 - ...ordered.slice(position + 1),
278 - ...ordered.slice(0, Math.max(position, 0)),
279 - ]) {
280 - const change = getTraitSelectChange(selected, descriptor, input.prompt, option.id);
281 - if (!change) return null;
282 - if ("modelOptions" in change) {
283 - return change.modelOptions
284 - ? { prompt: change.prompt, modelOptions: change.modelOptions }
285 - : null;
286 - }
287 - // A slash command refuses the Ultrathink prefix, so skip that level.
288 - if (change.prompt.startsWith(ULTRATHINK_PROMPT_PREFIX)) return change;
289 - }
290 - return null;
277 + const next = [...ordered.slice(position + 1), ...ordered.slice(0, Math.max(position, 0))].find(
278 + (option) => choices.includes(option),
279 + );
280 + const change = next && getTraitSelectChange(selected, descriptor, input.prompt, next.id);
281 + return change?.modelOptions ? { prompt: change.prompt, modelOptions: change.modelOptions } : null;
282 }
283
284 export interface TraitsMenuContentProps {
@@ -368,7 +359,7 @@ export function useTraitsSelection({
359 onPromptEdit?.(
360 (prompt) => getTraitSelectChange(selected, descriptor, prompt, value)?.prompt ?? prompt,
361 );
371 - if ("modelOptions" in change) updateModelOptions(change.modelOptions);
362 + updateModelOptions(change.modelOptions);
363 },
364 changeBoolean: (descriptorId: string, value: boolean) => {
365 updateModelOptions(
apps/web/src/components/chat/composerProviderState.test.tsx
+17 -34
@@ -324,48 +324,31 @@ describe("getComposerReasoningStep", () => {
324 ).toStrictEqual(selections(["thinking_level", "high"]));
325 });
326
327 - it("adds and strips the Ultrathink prefix while the caret stays on the same character", () => {
328 - for (const { prompt, modelOptions, direction, expected } of [
329 - {
330 - prompt: " Fix the bug \n",
331 - modelOptions: selections(["effort", "high"]),
332 - direction: 1,
333 - expected: { prompt: "Ultrathink:\nFix the bug", cursor: 20 },
334 - },
335 - {
336 - prompt: "Ultrathink:\n Fix the bug",
337 - modelOptions: selections(["effort", "medium"]),
338 - direction: -1,
339 - expected: {
340 - prompt: "Fix the bug",
341 - cursor: 8,
342 - modelOptions: selections(["effort", "high"]),
343 - },
344 - },
327 + it("never steps into Ultrathink and strips a typed prefix with the caret on the same character", () => {
328 + expect(step({ ...CLAUDE, modelOptions: selections(["effort", "high"]) })).toStrictEqual({
329 + prompt: "Fix the bug",
330 + cursor: 0,
331 + modelOptions: selections(["effort", "medium"]),
332 + });
333 + const prompt = "Ultrathink:\n Fix the bug";
334 + // A typed Ultrathink sits above the pickable levels, so up wraps and down lands on the top level.
335 + for (const [direction, to] of [
336 + [-1, "high"],
337 + [1, "medium"],
338 ] as const) {
339 const result = step({
340 ...CLAUDE,
341 prompt,
342 cursor: prompt.indexOf("bug"),
350 - modelOptions,
343 + modelOptions: selections(["effort", "medium"]),
344 direction,
345 });
353 - expect(result).toStrictEqual(expected);
354 - expect(result?.prompt.slice(result.cursor)).toMatch(/^bug/);
346 + expect(result, `by ${direction}`).toStrictEqual({
347 + prompt: "Fix the bug",
348 + cursor: 8,
349 + modelOptions: selections(["effort", to]),
350 + });
351 }
356 - expect(
357 - step({ ...CLAUDE, prompt: " Fix", modelOptions: selections(["effort", "high"]) })?.cursor,
358 - ).toBe("Ultrathink:\n".length);
359 - });
360 -
361 - it("skips Ultrathink for slash commands and does nothing when the prompt locks it", () => {
362 - expect(
363 - step({ ...CLAUDE, prompt: "/review", modelOptions: selections(["effort", "high"]) }),
364 - ).toStrictEqual({
365 - prompt: "/review",
366 - cursor: 0,
367 - modelOptions: selections(["effort", "medium"]),
368 - });
352 for (const [prompt, direction] of [
353 ["Please ultrathink harder", 1],
354 ["Ultrathink:\nPlease ultrathink harder", -1],
apps/web/src/components/chat/composerProviderState.tsx
+4 -12
@@ -152,7 +152,7 @@ export function getComposerProviderState(input: ComposerProviderStateInput): Com
152 };
153 }
154
155 -/** Expanded caret positions stay on the same character across Ultrathink prefix changes. */
155 +/** The caret stays on the same character when stepping strips a typed Ultrathink prefix. */
156 export function getComposerReasoningStep(input: {
157 provider: ProviderDriverKind;
158 instanceId: ProviderInstanceId;
@@ -167,7 +167,7 @@ export function getComposerReasoningStep(input: {
167 }): {
168 prompt: string;
169 cursor: number;
170 - modelOptions?: ReadonlyArray<ProviderOptionSelection>;
170 + modelOptions: ReadonlyArray<ProviderOptionSelection>;
171 } | null {
172 const { prompt, cursor } = input;
173 const { selections } = resolveComposerOptionSelections(
@@ -189,18 +189,10 @@ export function getComposerReasoningStep(input: {
189 direction: input.direction,
190 });
191 if (!step) return null;
192 - const modelOptions = "modelOptions" in step ? { modelOptions: step.modelOptions } : {};
193 - if (step.prompt === prompt) return { prompt, cursor, ...modelOptions };
194 - // Adding the prefix also trims the prompt.
195 - const keptStart = "modelOptions" in step ? 0 : step.prompt.length - prompt.trim().length;
196 - const offset =
197 - "modelOptions" in step
198 - ? step.prompt.length - prompt.length
199 - : keptStart - (prompt.length - prompt.trimStart().length);
192 return {
193 prompt: step.prompt,
202 - cursor: Math.min(step.prompt.length, Math.max(keptStart, cursor + offset)),
203 - ...modelOptions,
194 + cursor: Math.max(0, cursor + step.prompt.length - prompt.length),
195 + modelOptions: step.modelOptions,
196 };
197 }
198
packages/client-runtime/src/modelTraits.ts
+5 -13
@@ -4,7 +4,6 @@ import type {
4 ProviderOptionDescriptor,
5 } from "@t3tools/contracts";
6 import {
7 - applyClaudePromptEffortPrefix,
7 buildProviderOptionSelectionsFromDescriptors,
8 getProviderOptionCurrentLabel,
9 getProviderOptionCurrentValue,
@@ -12,8 +11,6 @@ import {
11 } from "@t3tools/shared/model";
12 import { REASONING_EFFORT_OPTION_IDS } from "./state/threadExecution.ts";
13
15 -export const ULTRATHINK_PROMPT_PREFIX = "Ultrathink:\n";
16 -
14 export const REASONING_SELECT_DESCRIPTOR_IDS: ReadonlySet<string> = new Set([
15 ...REASONING_EFFORT_OPTION_IDS,
16 "thinking",
@@ -51,10 +48,13 @@ export function getDescriptorStringValue(
48 return typeof value === "string" ? value : null;
49 }
50
51 +// Prompt-injected levels such as Ultrathink still work when typed, but pickers do not offer them.
52 export function selectableProviderOptionChoices(
53 descriptor: Extract<ProviderOptionDescriptor, { type: "select" }>,
54 ) {
57 - return descriptor.options;
55 + return descriptor.options.filter(
56 + (option) => !descriptor.promptInjectedValues?.includes(option.id),
57 + );
58 }
59
60 export function getPromptControlledTraits(
@@ -81,15 +81,7 @@ export function getTraitSelectChange(
81 prompt: string,
82 value: string,
83 ) {
84 - if (!value) return null;
85 - if (descriptor.promptInjectedValues?.includes(value)) {
86 - return {
87 - prompt:
88 - prompt.trim().length === 0
89 - ? ULTRATHINK_PROMPT_PREFIX
90 - : applyClaudePromptEffortPrefix(prompt, "ultrathink"),
91 - };
92 - }
84 + if (!value || descriptor.promptInjectedValues?.includes(value)) return null;
85 const isPrimary = descriptor.id === selected.primarySelectDescriptor?.id;
86 if (isPrimary && selected.ultrathinkInBodyText) return null;
87 return {