Skip to content
TypeScript

fix(web,client-runtime): subagent cards show Cursor reasoning effort (#17419)

IlyaLdd86a020965d
diff --git a/apps/web/src/components/chat/SubagentTooltipContent.tsx b/apps/web/src/components/chat/SubagentTooltipContent.tsx
index 65b3731673e..21057c9af47 100644
--- a/apps/web/src/components/chat/SubagentTooltipContent.tsx
+++ b/apps/web/src/components/chat/SubagentTooltipContent.tsx
@@ -11,6 +11,7 @@ import {
resolveSubagentMetadata,
subagentDetailPreview,
} from "@t3tools/client-runtime/state/subagent-display";
+import { REASONING_EFFORT_OPTION_IDS } from "@t3tools/client-runtime/state/thread-execution";
import { getModelSelectionStringOptionValue, resolveSelectableModel } from "@t3tools/shared/model";
import { getTraitsSpeedDisplay, TraitsSpeedIcon } from "./TraitsSpeed";
import type { ReactNode } from "react";
@@ -72,9 +73,9 @@ export function SubagentTooltipContent(props: {
childModel === (modelSlug ?? model) && childSelection?.instanceId === props.providerInstanceId
? childSelection
: undefined;
- const effort = ["reasoningEffort", "effort", "reasoning", "variant"]
- .map((id) => getModelSelectionStringOptionValue(matchingSelection, id))
- .find(Boolean);
+ const effort = REASONING_EFFORT_OPTION_IDS.map((id) =>
+ getModelSelectionStringOptionValue(matchingSelection, id),
+ ).find(Boolean);
const speed = provider
? providerModel?.capabilities?.optionDescriptors
?.map((descriptor) => {
diff --git a/apps/web/src/components/chat/ThreadRelationshipsControl.agents.browser.test.tsx b/apps/web/src/components/chat/ThreadRelationshipsControl.agents.browser.test.tsx
index 4efcb87b7b2..2beeb669b5b 100644
--- a/apps/web/src/components/chat/ThreadRelationshipsControl.agents.browser.test.tsx
+++ b/apps/web/src/components/chat/ThreadRelationshipsControl.agents.browser.test.tsx
@@ -893,6 +893,7 @@ it("shows readable models and only differing workspace details in agent tooltips
[[{ id: "reasoning", value: "low" }], " · low"],
[[{ id: "variant", value: "high" }], " · high"],
[[{ id: "reasoningEffort", value: "none" }], " · none"],
+ [[{ id: "reasoning_effort", value: "xhigh" }], " · xhigh"],
[[{ id: "reasoningEffort", value: true }], ""],
[[{ id: "serviceTier", value: "fast" }], ""],
[[], ""],
diff --git a/apps/web/src/components/chat/TraitsPicker.test.ts b/apps/web/src/components/chat/TraitsPicker.test.ts
index 14f4685c918..e684b4e25bd 100644
--- a/apps/web/src/components/chat/TraitsPicker.test.ts
+++ b/apps/web/src/components/chat/TraitsPicker.test.ts
@@ -115,14 +115,15 @@ describe("buildTraitsTriggerDisplay", () => {
buildTraitsTriggerDisplay({
provider: ProviderDriverKind.make("cursor"),
descriptors: [
- { ...EFFORT, id: "reasoning" },
+ CONTEXT_WINDOW,
+ { ...EFFORT, id: "reasoning_effort" },
fastModeDescriptor(true),
{ id: "thinking", label: "Thinking", type: "boolean", currentValue: true },
],
- primarySelectDescriptorId: "reasoning",
+ primarySelectDescriptorId: CONTEXT_WINDOW.id,
ultrathinkPromptControlled: false,
}),
- ).toEqual({ label: "High Fast · Thinking On" });
+ ).toEqual({ label: "1M · High Fast · Thinking On" });
});
it.each([true, false])("keeps boolean thinking %s independent of Fast", (currentValue) => {
diff --git a/apps/web/src/components/chat/TraitsPicker.tsx b/apps/web/src/components/chat/TraitsPicker.tsx
index cc200f1ebd0..b936f594101 100644
--- a/apps/web/src/components/chat/TraitsPicker.tsx
+++ b/apps/web/src/components/chat/TraitsPicker.tsx
@@ -16,6 +16,7 @@ import {
isClaudeUltrathinkPrompt,
normalizeModelSlug,
} from "@t3tools/shared/model";
+import { REASONING_EFFORT_OPTION_IDS } from "@t3tools/client-runtime/state/thread-execution";
import { memo } from "react";
import { BrainIcon } from "lucide-react";
import {
@@ -92,10 +93,7 @@ type TraitsPersistence =
const ULTRATHINK_PROMPT_PREFIX = "Ultrathink:\n";
const REASONING_SELECT_DESCRIPTOR_IDS: ReadonlySet<string> = new Set([
- "reasoningEffort",
- "reasoning",
- "effort",
- "variant",
+ ...REASONING_EFFORT_OPTION_IDS,
"thinking",
]);
diff --git a/apps/web/src/components/chat/composerProviderState.test.tsx b/apps/web/src/components/chat/composerProviderState.test.tsx
index d4cf18396ba..9f13b2497ef 100644
--- a/apps/web/src/components/chat/composerProviderState.test.tsx
+++ b/apps/web/src/components/chat/composerProviderState.test.tsx
@@ -616,17 +616,17 @@ describe("getComposerReasoningStep", () => {
provider: ProviderDriverKind.make("cursor"),
instanceId: ProviderInstanceId.make("cursor"),
models: modelWith([
- selectDescriptor("reasoning", LEVELS),
+ selectDescriptor("reasoning_effort", LEVELS),
booleanDescriptor("fastMode", true),
]),
};
expect(step({ ...cursor, modelOptions: undefined })?.modelOptions).toStrictEqual(
- selections(["reasoning", "high"], ["fastMode", false]),
+ selections(["reasoning_effort", "high"], ["fastMode", false]),
);
expect(
step({ ...cursor, modelOptions: selections(["fastMode", true]) })?.modelOptions,
- ).toStrictEqual(selections(["reasoning", "high"], ["fastMode", true]));
+ ).toStrictEqual(selections(["reasoning_effort", "high"], ["fastMode", true]));
});
it("steps from the provider-reported level for the same instance and model", () => {
diff --git a/packages/client-runtime/src/state/threadExecution.test.ts b/packages/client-runtime/src/state/threadExecution.test.ts
index 86a0986256b..4af529df8e4 100644
--- a/packages/client-runtime/src/state/threadExecution.test.ts
+++ b/packages/client-runtime/src/state/threadExecution.test.ts
@@ -441,7 +441,7 @@ describe("formatModelSelectionEffort", () => {
model: "claude-sonnet-5",
...(options === undefined ? {} : { options }),
});
- const catalog = (descriptor: { currentValue?: string }) => [
+ const catalog = (descriptor: { id?: string; currentValue?: string }) => [
{
slug: "claude-sonnet-5",
name: "Claude Sonnet 5",
@@ -464,27 +464,26 @@ describe("formatModelSelectionEffort", () => {
},
];
- it("names stored and matching reported effort, preferring the stored choice", () => {
- expect(
- formatModelSelectionEffort(selection([{ id: "effort", value: "xhigh" }]), catalog({})),
- ).toBe("Extra High");
- const reported = selection([{ id: "effort", value: "xhigh" }]);
- expect(formatModelSelectionEffort(selection(), catalog({}), reported)).toBe("Extra High");
- expect(
- formatModelSelectionEffort(
- selection([{ id: "effort", value: "medium" }]),
- catalog({}),
- reported,
- ),
- ).toBe("Medium");
- expect(
- formatModelSelectionEffort(
- selection([{ id: "effort", value: "retired-effort" }]),
- catalog({ currentValue: "medium" }),
- reported,
- ),
- ).toBeNull();
- });
+ it.each(["effort", "reasoning_effort"])(
+ "names stored and matching reported %s, preferring the stored choice",
+ (id) => {
+ expect(formatModelSelectionEffort(selection([{ id, value: "xhigh" }]), catalog({ id }))).toBe(
+ "Extra High",
+ );
+ const reported = selection([{ id, value: "xhigh" }]);
+ expect(formatModelSelectionEffort(selection(), catalog({ id }), reported)).toBe("Extra High");
+ expect(
+ formatModelSelectionEffort(selection([{ id, value: "medium" }]), catalog({ id }), reported),
+ ).toBe("Medium");
+ expect(
+ formatModelSelectionEffort(
+ selection([{ id, value: "retired-effort" }]),
+ catalog({ id, currentValue: "medium" }),
+ reported,
+ ),
+ ).toBeNull();
+ },
+ );
it("shows nothing when neither the selection nor the provider states an effort", () => {
expect(formatModelSelectionEffort(selection(), catalog({}))).toBeNull();
diff --git a/packages/client-runtime/src/state/threadExecution.ts b/packages/client-runtime/src/state/threadExecution.ts
index 2f85fb6ed79..8c27b2373c0 100644
--- a/packages/client-runtime/src/state/threadExecution.ts
+++ b/packages/client-runtime/src/state/threadExecution.ts
@@ -151,7 +151,13 @@ export function deriveReportedModelSelection(
return providerThread?.nativeMetadata?.modelSelection ?? null;
}
-const REASONING_EFFORT_OPTION_IDS = ["reasoningEffort", "effort", "reasoning", "variant"] as const;
+export const REASONING_EFFORT_OPTION_IDS: ReadonlyArray<string> = [
+ "reasoningEffort",
+ "effort",
+ "reasoning",
+ "variant",
+ "reasoning_effort",
+];
export function formatModelSelectionEffort(
selection: ModelSelection,