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:
owo
2026-08-14 22:41:43 +08:00
co-authored by Cursor
parent fb5a334edb
commit 819010de1c
10 changed files with 190 additions and 29 deletions
+7 -3
View File
@@ -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');