fix: preserve target session thinking variant in review handoffs
Uses the linked target session's last model choice for follow-up review transfers Prevents reviewer thinking settings from leaking into implementer follow-ups
This commit is contained in:
@@ -80,25 +80,28 @@ const resolveModelContext = (sessionID: string): SessionModelContext | null => {
|
|||||||
const selection = useSelectionStore.getState();
|
const selection = useSelectionStore.getState();
|
||||||
const config = useConfigStore.getState();
|
const config = useConfigStore.getState();
|
||||||
const lastChoice = useSessionUIStore.getState().getLastUserChoice(sessionID);
|
const lastChoice = useSessionUIStore.getState().getLastUserChoice(sessionID);
|
||||||
const agent = selection.getSessionAgentSelection(sessionID) || lastChoice?.agent || config.currentAgentName || undefined;
|
const agent = lastChoice?.agent || selection.getSessionAgentSelection(sessionID) || config.currentAgentName || undefined;
|
||||||
const sessionModel = selection.getSessionModelSelection(sessionID);
|
const sessionModel = selection.getSessionModelSelection(sessionID);
|
||||||
const agentModel = agent ? selection.getAgentModelForSession(sessionID, agent) : null;
|
const agentModel = agent ? selection.getAgentModelForSession(sessionID, agent) : null;
|
||||||
const lastChoiceModel = lastChoice?.providerID && lastChoice.modelID
|
const lastChoiceModel = lastChoice?.providerID && lastChoice.modelID
|
||||||
? { providerId: lastChoice.providerID, modelId: lastChoice.modelID }
|
? { providerId: lastChoice.providerID, modelId: lastChoice.modelID }
|
||||||
: null;
|
: null;
|
||||||
const selectedModel = agentModel || sessionModel || lastChoiceModel || (config.currentProviderId && config.currentModelId
|
const selectedModel = lastChoiceModel || agentModel || sessionModel || (config.currentProviderId && config.currentModelId
|
||||||
? { providerId: config.currentProviderId, modelId: config.currentModelId }
|
? { providerId: config.currentProviderId, modelId: config.currentModelId }
|
||||||
: null);
|
: null);
|
||||||
if (!selectedModel?.providerId || !selectedModel?.modelId) return null;
|
if (!selectedModel?.providerId || !selectedModel?.modelId) return null;
|
||||||
|
if (lastChoiceModel) {
|
||||||
|
return {
|
||||||
|
providerID: lastChoiceModel.providerId,
|
||||||
|
modelID: lastChoiceModel.modelId,
|
||||||
|
agent,
|
||||||
|
variant: lastChoice?.variant,
|
||||||
|
};
|
||||||
|
}
|
||||||
// Variants are model-specific; only reuse one resolved for the same model.
|
// Variants are model-specific; only reuse one resolved for the same model.
|
||||||
const selectionVariant = agent
|
const selectionVariant = agent
|
||||||
? selection.getAgentModelVariantForSession(sessionID, agent, selectedModel.providerId, selectedModel.modelId)
|
? selection.getAgentModelVariantForSession(sessionID, agent, selectedModel.providerId, selectedModel.modelId)
|
||||||
: undefined;
|
: undefined;
|
||||||
const lastChoiceVariant = lastChoiceModel
|
|
||||||
&& lastChoiceModel.providerId === selectedModel.providerId
|
|
||||||
&& lastChoiceModel.modelId === selectedModel.modelId
|
|
||||||
? lastChoice?.variant
|
|
||||||
: undefined;
|
|
||||||
const configVariant = config.currentProviderId === selectedModel.providerId && config.currentModelId === selectedModel.modelId
|
const configVariant = config.currentProviderId === selectedModel.providerId && config.currentModelId === selectedModel.modelId
|
||||||
? config.currentVariant
|
? config.currentVariant
|
||||||
: undefined;
|
: undefined;
|
||||||
@@ -106,7 +109,7 @@ const resolveModelContext = (sessionID: string): SessionModelContext | null => {
|
|||||||
providerID: selectedModel.providerId,
|
providerID: selectedModel.providerId,
|
||||||
modelID: selectedModel.modelId,
|
modelID: selectedModel.modelId,
|
||||||
agent,
|
agent,
|
||||||
variant: selectionVariant || lastChoiceVariant || configVariant || undefined,
|
variant: selectionVariant || configVariant || undefined,
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user