Revert "revert(ui): restore inherited semantics for Default thinking effort"

This reverts commit 35875e818c.
This commit is contained in:
Iuliia Ivashko
2026-09-04 14:12:56 +03:00
parent 3cd31a090a
commit bde6fed8a2
8 changed files with 212 additions and 52 deletions
@@ -326,7 +326,13 @@ export const ModelControls: React.FC<ModelControlsProps> = ({
const currentModelId = useConfigStore((state) => state.currentModelId);
const effectiveCurrentVariant = useConfigStore((state) => state.currentVariant);
const currentVariantSelection = useConfigStore((state) => state.currentVariantSelection);
const currentVariant = currentVariantSelection.override ?? undefined;
// What the picker shows is what the next send carries: an explicit choice
// when there is one, "Default" when "Default" was picked, and otherwise the
// inherited effort — showing "Default" while an inherited effort is in
// force is how a switch away from it looks like it did not stick.
const currentVariant = currentVariantSelection.override === null
? undefined
: currentVariantSelection.override ?? effectiveCurrentVariant;
const currentAgentName = useConfigStore((state) => state.currentAgentName);
const settingsDefaultVariant = useConfigStore((state) => state.settingsDefaultVariant);
const settingsDefaultAgent = useConfigStore((state) => state.settingsDefaultAgent);
@@ -728,6 +734,10 @@ export const ModelControls: React.FC<ModelControlsProps> = ({
const effectiveAgentName = uiAgentName || currentAgentName;
if (currentSessionId && effectiveAgentName) {
const savedVariant = getAgentModelVariantForSession(currentSessionId, effectiveAgentName, providerId, modelId);
// An explicit "Default" is a choice: it stops the fallbacks below.
if (savedVariant === null) {
return undefined;
}
if (savedVariant && variantOptions.includes(savedVariant)) {
return savedVariant;
}
@@ -777,7 +787,9 @@ export const ModelControls: React.FC<ModelControlsProps> = ({
const effectiveAgentName = agentNameOverride ?? resolveLiveAgentName();
if (currentSessionId && effectiveAgentName) {
saveAgentModelVariantForSession(currentSessionId, effectiveAgentName, providerId, modelId, variant);
// `null`, not `undefined`: picking "Default" is a choice to record,
// not the absence of one.
saveAgentModelVariantForSession(currentSessionId, effectiveAgentName, providerId, modelId, variant ?? null);
}
}, [
addRecentEffort,
@@ -1113,11 +1125,10 @@ export const ModelControls: React.FC<ModelControlsProps> = ({
return;
}
// The chosen effort does not exist on this model: drop the choice and
// inherit, rather than pin an explicit "Default" the user never picked.
if (currentVariant && !availableVariants.includes(currentVariant)) {
setCurrentVariantOverride(
null,
resolveInheritedVariantForModel(currentProviderId, currentModelId),
);
setCurrentVariant(resolveInheritedVariantForModel(currentProviderId, currentModelId));
return;
}
@@ -1143,7 +1154,8 @@ export const ModelControls: React.FC<ModelControlsProps> = ({
const inheritedVariant = resolveInheritedVariantForModel(currentProviderId, currentModelId);
if (savedVariant && availableVariants.includes(savedVariant)) {
setCurrentVariantOverride(savedVariant, inheritedVariant);
} else if (currentVariantSelection.override === null) {
} else if (savedVariant === null || currentVariantSelection.override === null) {
// "Default" was picked for this session, or is picked right now.
setCurrentVariantOverride(null, inheritedVariant);
} else {
setCurrentVariant(inheritedVariant);