Skip to content

Commit 217c1a9

Browse files
committed
revert: keep "high" fallback on cross-model effort switch
When a user switches to a model that doesn't support their last-used effort level, fall back to "high" rather than clamping. Matches the pre-feature behavior. Clamping is still applied for the new explicit default-effort setting on initial load, where there's no prior behavior to preserve. Generated-By: PostHog Code Task-Id: c5674c04-c95c-4bfe-bfcf-248a921b4aae
1 parent 076df47 commit 217c1a9

1 file changed

Lines changed: 11 additions & 13 deletions

File tree

apps/code/src/renderer/features/task-detail/hooks/usePreviewConfig.ts

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -227,21 +227,19 @@ export function usePreviewConfig(
227227

228228
const { lastUsedReasoningEffort, defaultReasoningEffort } =
229229
useSettingsStore.getState();
230-
const availableValues: string[] =
231-
effortOpts?.map((e) => e.value) ?? [];
232230
const isValidEffort = (effort: unknown): effort is string =>
233-
typeof effort === "string" && availableValues.includes(effort);
231+
typeof effort === "string" &&
232+
!!effortOpts?.some((e) => e.value === effort);
234233
const resolveEffortFallback = (): string => {
235-
const desired =
236-
defaultReasoningEffort === "last_used"
237-
? lastUsedReasoningEffort
238-
: defaultReasoningEffort;
239-
if (isValidEffort(desired)) return desired;
240-
const clamped =
241-
typeof desired === "string"
242-
? clampEffortToAvailable(desired, availableValues)
243-
: null;
244-
return clamped ?? availableValues[0] ?? "high";
234+
if (
235+
defaultReasoningEffort !== "last_used" &&
236+
isValidEffort(defaultReasoningEffort)
237+
) {
238+
return defaultReasoningEffort;
239+
}
240+
return isValidEffort(lastUsedReasoningEffort)
241+
? lastUsedReasoningEffort
242+
: "high";
245243
};
246244
if (effortOpts && existingIdx >= 0) {
247245
const currentEffort = updated[existingIdx].currentValue;

0 commit comments

Comments
 (0)