fix: stabilize /model reasoning-effort selection (v0.3.5)
Keep pending model outside the picker map, omit undefined reasoningEffort in selectModel payload, auto-apply single-effort models, and surface RPC errors. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
+7
-3
@@ -53,12 +53,16 @@ export async function selectSessionModel(ctx, sessionId, selection) {
|
||||
if (!api?.sessions?.selectModel) {
|
||||
throw new Error('apiProxy unavailable (use ctx.get / inject apiProxy)');
|
||||
}
|
||||
const raw = await call(api.sessions.selectModel, {
|
||||
// Omit undefined reasoningEffort — some validators treat explicit undefined as invalid.
|
||||
const payload = {
|
||||
sessionId,
|
||||
provider: selection.provider,
|
||||
model: selection.model,
|
||||
reasoningEffort: selection.reasoningEffort,
|
||||
});
|
||||
};
|
||||
if (selection.reasoningEffort !== undefined && selection.reasoningEffort !== '') {
|
||||
payload.reasoningEffort = selection.reasoningEffort;
|
||||
}
|
||||
const raw = await call(api.sessions.selectModel, payload);
|
||||
const value = unwrap(raw);
|
||||
if (!value?.selected) {
|
||||
throw new Error(unwrapError(raw) ?? 'failed to select model');
|
||||
|
||||
Reference in New Issue
Block a user