Skip to content

Open-source gym & body-weight tracker, now in the App Store (iPhone + Apple Watch) and as an Android APK. Plan routines, log workouts, see which muscles are trained, import from Strong/Hevy/FitNotes. Self-host it or use it on the phone alone.

Coach: current Gemini default, and one swap for a model the key can't use (#758)

Duarte Santos3710485663d0
diff --git a/CHANGELOG.md b/CHANGELOG.md
index f28375345..c757a8f41 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -99,6 +99,9 @@ you leave it alone. Handy for deciding whether those legs are really ready (than
failing outright (thanks @rudycelekli).
- The MCP server stops showing a profile whose data was deleted, also where the system can't
watch files (thanks @rudycelekli).
+- Coach on Gemini works with a fresh AI Studio key again: the default is Gemini 3.8 Flash (free
+ tier included), and a model your key can't use any more is swapped once for one it lists,
+ on the server and on a phone with its own key. If nothing fits, the error names the model (#758).
- Jumping jacks, burpees and the other cardio moves can be counted in sets x reps (or timed):
their settings now offer Cardio, Reps and Time, Cardio still the default (#678).
- Add exercise → By muscle has the Favourites chip too, for the muscle you picked (#669).
diff --git a/api/coach/core/adapters/gemini.js b/api/coach/core/adapters/gemini.js
index 8ecb154cd..a7ab7c0c7 100644
--- a/api/coach/core/adapters/gemini.js
+++ b/api/coach/core/adapters/gemini.js
@@ -3,6 +3,8 @@
import { httpAdapter } from './http.js';
import { SYSTEM_PROMPT } from '../system-prompt.js';
+const versionOf = m => { const v = /^gemini-(\d+)(?:\.(\d+))?/.exec(m); return v ? Number(v[1]) * 100 + Number(v[2] || 0) : 0; };
+
export const geminiSpec = {
id: 'gemini',
path: model => `/v1beta/models/${encodeURIComponent(model)}:generateContent`,
@@ -27,6 +29,14 @@ export const geminiSpec = {
const text = ((cand.content && cand.content.parts) || []).map(p => p.text || '').join('');
return { text, truncated: false };
},
+ // After a refused model (#758): the newest plain Flash the key lists, since that is the one a
+ // free key can call; then the newest non-preview Gemini; then whatever text model is there.
+ preferModel: models => {
+ const newest = list => list.slice().sort((a, b) => versionOf(b) - versionOf(a))[0];
+ return newest(models.filter(m => /^gemini-[\d.]+-flash$/.test(m)))
+ || newest(models.filter(m => /^gemini-/.test(m) && !/preview|exp/.test(m)))
+ || models[0];
+ },
readModels: data => (data.models || [])
.filter(m => !m.supportedGenerationMethods || m.supportedGenerationMethods.includes('generateContent'))
.map(m => String(m.name || '').replace(/^models\//, ''))
diff --git a/api/coach/core/adapters/http.js b/api/coach/core/adapters/http.js
index 523cc9a88..48591485b 100644
--- a/api/coach/core/adapters/http.js
+++ b/api/coach/core/adapters/http.js
@@ -88,6 +88,23 @@ async function reach(spec, base, path, send) {
return second;
}
+// A model the key cannot call (#758). Google retires names for new keys while old keys keep
+// them (gemini-2.5-pro: "no longer available to new users"), so a default that worked for the
+// person who wrote it 404s for the next one, and a model saved on a phone goes stale the same
+// way. Every provider says it in its own words: 404 with "model" in it, or a 400 that names a
+// model as unknown (OpenRouter: "is not a valid model ID").
+const MODEL_REFUSED = /\bmodels?\b.*(not found|does not exist|no longer available|not available|not supported|not a valid|invalid|unknown)|(unknown|invalid|no such|not a valid) model/i;
+export const isModelGone = (status, msg) => (status === 404 && /\bmodel/i.test(msg)) || (status === 400 && MODEL_REFUSED.test(msg));
+// What a substitute must not be: the listing also carries speech, image and embedding models
+// that answer generateContent or chat with something useless for a plan.
+const NOT_TEXT = /embed|tts|audio|image|imagen|veo|lyria|live|transcri|robotics|aqa|banana|omni|computer-use|deep-research|whisper|dall-e|moderation|realtime|guard/i;
+// The model that answered in place of a refused one, per provider, endpoint and refused name, so
+// the repair round and the next job go straight there instead of paying for the 404 again.
+const substitutes = new Map();
+const substituteKey = (id, base, model) => `${id} ${base} ${model}`;
+/** The model used in place of `model` after the provider refused it, or null. */
+export const modelSubstitute = (id, cfg, model) => substitutes.get(substituteKey(id, baseUrlFor(id, cfg), model)) || null;
+
/** A fetch, bounded by AbortController. Never throws for HTTP status; throws for transport. */
async function call(fetchImpl, url, init, timeoutMs, signal) {
const ctl = new AbortController();
@@ -116,6 +133,21 @@ export function httpAdapter(spec) {
const keyOf = env => (env && env[meta.apiKeyEnv]) || null;
+ /** A model to try in place of the refused one, or null when there is nothing better to try. */
+ async function usableModel(refused, { cfg, env, fetchImpl, signal }) {
+ const listed = await adapter.models(cfg, env, { fetch: fetchImpl, signal });
+ const fallback = meta.defaultModel && meta.defaultModel !== refused ? meta.defaultModel : null;
+ if (!listed.ok) return fallback;
+ if (fallback && listed.models.includes(fallback)) return fallback;
+ const text = listed.models.filter(m => m !== refused && !NOT_TEXT.test(m));
+ if (spec.preferModel) return spec.preferModel(text) || null;
+ // Generic: the same family as the refused name (its vendor/ or name- prefix), newest-looking
+ // last in the sorted list, so a stale google/gemini-2.5-pro lands on another Gemini.
+ const family = /^[^/]+\//.exec(refused)?.[0] || /^[^-:]+/.exec(refused)?.[0] || '';
+ const kin = family ? text.filter(m => m.startsWith(family)) : [];
+ return (kin.length ? kin[kin.length - 1] : text[0]) || null;
+ }
+
const adapter = {
id,
runtime: meta.runtime,
@@ -171,10 +203,12 @@ export function httpAdapter(spec) {
if (!base) return { code: -1, text: '', stderr: `no endpoint configured for ${id}`, spawnError: true };
const key = keyOf(env);
if (!key && !meta.keyOptional) return { code: -1, text: '', stderr: `no API key configured for ${id}`, spawnError: true };
- const chosen = model || meta.defaultModel;
- if (!chosen) return { code: 1, text: '', stderr: `no model chosen for ${id} (pick one from the list the endpoint serves)` };
+ const asked = model || meta.defaultModel;
+ if (!asked) return { code: 1, text: '', stderr: `no model chosen for ${id} (pick one from the list the endpoint serves)` };
+ let chosen = substitutes.get(substituteKey(id, base, asked)) || asked;
let body = spec.body({ model: chosen, prompt, system: system || null, schema: schema || null, maxTokens });
+ let triedOtherModel = false;
let retriedWithStrictSchema = false;
let retriedWithoutJsonMode = false;
let transientRetries = 0;
@@ -218,13 +252,32 @@ export function httpAdapter(spec) {
retriedWithoutJsonMode = true;
continue;
}
+ // The model is gone for this key: once, with one it can use. The provider's own
+ // default when the key serves it (or the list could not be read), else the first text
+ // model the key lists. Only then is it the job's failure, naming the model.
+ if (isModelGone(res.status, msg) && !triedOtherModel && !(signal && signal.aborted)) {
+ triedOtherModel = true;
+ const next = await usableModel(chosen, { cfg, env, fetchImpl, signal });
+ if (next) {
+ substitutes.set(substituteKey(id, base, asked), next);
+ chosen = next;
+ if ('model' in body) body = { ...body, model: next };
+ transientRetries = 0;
+ continue;
+ }
+ }
+ if (isModelGone(res.status, msg)) {
+ substitutes.delete(substituteKey(id, base, asked));
+ const tried = chosen !== asked ? ` (and neither is "${chosen}")` : '';
+ return { code: 1, text: '', stderr: `${res.status} the model "${asked}" is not available to this key${tried}: ${shownError(spec, data, 200)}. Pick another one in the Coach settings.` };
+ }
return { code: 1, text: '', stderr: `${res.status} ${shownError(spec, data, 280)}` };
}
let out;
try { out = spec.readText(data); } catch (e) { out = { error: `unexpected response shape: ${trim(e.message, 100)}` }; }
if (out.error) return { code: 1, text: '', stderr: out.error };
if (out.truncated) return { code: 1, text: '', stderr: 'the answer was cut off at the output limit; try a smaller plan or a bigger model' };
- return { code: 0, text: String(out.text || '').trim(), stderr: '' };
+ return { code: 0, text: String(out.text || '').trim(), stderr: '', ...(chosen !== asked ? { model: chosen } : {}) };
}
}
};
diff --git a/api/coach/core/providers.js b/api/coach/core/providers.js
index 33d427171..59ebca893 100644
--- a/api/coach/core/providers.js
+++ b/api/coach/core/providers.js
@@ -28,7 +28,9 @@ export const HTTP_PROVIDERS = Object.freeze({
label: 'Google Gemini', runtime: 'HTTPS', http: true,
apiKeyEnv: 'GEMINI_API_KEY', oauthEnv: null,
defaultBase: 'https://generativelanguage.googleapis.com',
- defaultModel: 'gemini-2.5-pro',
+ // Stable and on the free tier, which is where the Discord setup guide sends people. The
+ // 2.5 names are refused for keys made after Google retired them (#758).
+ defaultModel: 'gemini-3.8-flash',
keyPlaceholder: 'AIza… or AQ.…'
}),
// Ollama, LM Studio, vLLM, OpenRouter, a corporate gateway: anything that serves the
diff --git a/api/test/adapters-http.test.js b/api/test/adapters-http.test.js
index 8e49690d9..48bdbf149 100644
--- a/api/test/adapters-http.test.js
+++ b/api/test/adapters-http.test.js
@@ -16,6 +16,7 @@ const gemini = (await import('../coach/core/adapters/gemini.js')).default;
const compatible = (await import('../coach/core/adapters/compatible.js')).default;
const { attemptOnce } = await import('../coach/core/pipeline.js');
const { HTTP_PROVIDERS, validateBaseUrl, validateHeaders } = await import('../coach/core/providers.js');
+const { modelSubstitute } = await import('../coach/core/adapters/http.js');
const { SYSTEM_PROMPT } = await import('../coach/core/system-prompt.js');
const { REVIEW_SCHEMA } = await import('../coach/core/schemas.js');
@@ -171,9 +172,10 @@ test('compatible: the 404 fallback keeps the first error when neither form answe
? { status: 404, body: { error: { message: 'model "nope" not found, try pulling it first' } } }
: { status: 404, body: '404 page not found' }));
const r = await compatible.invoke({ cfg: cfgCompat, prompt: 'P', env: {}, model: 'nope', fetch: f });
- assert.deepEqual(f.calls.map(c => c.url), ['http://ollama.lan:11434/v1/chat/completions', 'http://ollama.lan:11434/chat/completions']);
+ assert.deepEqual(f.calls.slice(0, 2).map(c => c.url), ['http://ollama.lan:11434/v1/chat/completions', 'http://ollama.lan:11434/chat/completions']);
assert.equal(r.code, 1);
- assert.match(r.stderr, /^404 model "nope" not found/);
+ // (then the model fallback asks for the list, which this endpoint cannot give: #758)
+ assert.match(r.stderr, /^404 the model "nope" is not available to this key: model "nope" not found/);
// …and a failed fallback teaches nothing: the next request still starts at /v1.
const g = fakeFetch([ok({ data: [] })]);
await compatible.models(cfgCompat, {}, { fetch: g });
@@ -187,8 +189,8 @@ test('compatible: the 404 fallback keeps the first error when neither form answe
// OpenAI itself always lives at /v1; a 404 there is a real answer, not a missing prefix.
const o = fakeFetch([{ status: 404, body: { error: { message: 'The model `x` does not exist' } } }]);
const ro = await openai.invoke({ cfg: {}, prompt: 'P', env, model: 'x', fetch: o });
- assert.equal(o.calls.length, 1);
- assert.match(ro.stderr, /^404 The model/);
+ assert.ok(o.calls.every(c => c.url.startsWith('https://api.openai.com/v1/')), 'never the bare form');
+ assert.match(ro.stderr, /^404 the model "x" is not available to this key \(and neither is "gpt-[^"]+"\): The model/);
});
test('compatible: no endpoint configured, or no model chosen, is a clean failure rather than a request', async () => {
@@ -312,6 +314,79 @@ test('an additionalProperties complaint about a request with no schema never inv
assert.ok(f.calls.length <= 2);
});
+// Gemini as it answers a key made after a model was retired for new users (#758).
+const GEMINI_GONE = { status: 404, body: { error: { code: 404, status: 'NOT_FOUND', message: 'This model models/gemini-2.5-pro is no longer available to new users. Please update your code to use models/gemini-3.1-pro-preview for the latest features and improvements.' } } };
+const geminiList = names => ok({ models: names.map(n => ({ name: 'models/' + n, supportedGenerationMethods: ['generateContent'] })) });
+const geminiAnswer = ok({ candidates: [{ content: { parts: [{ text: ANSWER }] }, finishReason: 'STOP' }] });
+const geminiAt = host => ({ provider: 'gemini', providerOptions: { gemini: { baseUrl: `https://${host}` } } });
+
+test('Gemini: the default is a current model, not one Google refuses new keys (#758)', () => {
+ assert.doesNotMatch(HTTP_PROVIDERS.gemini.defaultModel, /^gemini-(1|2)\./);
+});
+
+test('a model the key cannot use is swapped once for the provider default it lists, and remembered (#758)', async () => {
+ const cfg = geminiAt('g1.test');
+ const f = fakeFetch((n, url) => url.includes('/models?') ? geminiList(['gemini-2.5-pro', 'gemini-embedding-001', HTTP_PROVIDERS.gemini.defaultModel])
+ : url.includes('gemini-2.5-pro') ? GEMINI_GONE : geminiAnswer);
+ const r = await gemini.invoke({ cfg, prompt: 'P', env, model: 'gemini-2.5-pro', fetch: f });
+ assert.equal(r.code, 0, r.stderr);
+ assert.equal(r.model, HTTP_PROVIDERS.gemini.defaultModel);
+ assert.equal(f.calls.length, 3);
+ assert.ok(f.calls[2].url.includes(`/models/${HTTP_PROVIDERS.gemini.defaultModel}:generateContent`), f.calls[2].url);
+ assert.equal(modelSubstitute('gemini', cfg, 'gemini-2.5-pro'), HTTP_PROVIDERS.gemini.defaultModel);
+ // the repair round and the next job go straight to the model that answered
+ const g = fakeFetch(() => geminiAnswer);
+ const again = await gemini.invoke({ cfg, prompt: 'P', env, model: 'gemini-2.5-pro', fetch: g });
+ assert.equal(again.code, 0);
+ assert.equal(g.calls.length, 1);
+ assert.ok(g.calls[0].url.includes(HTTP_PROVIDERS.gemini.defaultModel));
+});
+
+test('without the default in the list, the newest plain Flash the key lists is the one tried (#758)', async () => {
+ const f = fakeFetch((n, url) => url.includes('/models?')
+ ? geminiList(['gemini-2.5-flash', 'gemini-2.5-pro', 'gemini-3.1-pro-preview', 'gemini-3.6-flash', 'gemini-3.8-flash-tts', 'gemini-3.5-flash-lite'])
+ : url.includes('gemini-2.5-pro') ? GEMINI_GONE : geminiAnswer);
+ const r = await gemini.invoke({ cfg: geminiAt('g2.test'), prompt: 'P', env, model: 'gemini-2.5-pro', fetch: f });
+ assert.equal(r.code, 0, r.stderr);
+ assert.equal(r.model, 'gemini-3.6-flash');
+});
+
+test('when no other model works either, the error names the model and says where to change it (#758)', async () => {
+ const f = fakeFetch((n, url) => url.includes('/models?') ? geminiList(['gemini-2.5-pro', 'gemini-embedding-001']) : GEMINI_GONE);
+ const r = await gemini.invoke({ cfg: geminiAt('g3.test'), prompt: 'P', env, model: 'gemini-2.5-pro', fetch: f });
+ assert.equal(r.code, 1);
+ assert.equal(f.calls.length, 2, 'the list had nothing else to try, so no second job request');
+ assert.match(r.stderr, /^404 the model "gemini-2\.5-pro" is not available to this key: This model models\/gemini-2\.5-pro is no longer available/);
+ assert.match(r.stderr, /Coach settings/);
+ const payload = { plan: { routines: [], week: {} } };
+ const cls = await attemptOnce({ adapter: gemini, cfg: geminiAt('g3.test'), kind: 'review', payload, model: 'gemini-2.5-pro', invokeOpts: { env, fetch: f } }, null);
+ assert.equal(cls.errorClass, 'provider');
+});
+
+test('the swap is one try: a substitute that is refused as well ends the job, naming it (#758)', async () => {
+ const f = fakeFetch((n, url) => url.endsWith('/v1/models') ? ok({ data: [{ id: 'claude-old' }, { id: 'claude-older' }] })
+ : { status: 404, body: { type: 'error', error: { type: 'not_found_error', message: 'model: whatever' } } });
+ const r = await anthropic.invoke({ cfg: { providerOptions: { anthropic: { baseUrl: 'https://a1.test' } } }, prompt: 'P', env, model: 'claude-old', fetch: f });
+ assert.equal(r.code, 1);
+ const posts = f.calls.filter(c => c.method === 'POST');
+ assert.deepEqual(posts.map(c => c.body.model), ['claude-old', 'claude-older']);
+ assert.match(r.stderr, /^404 the model "claude-old" is not available to this key \(and neither is "claude-older"\)/);
+});
+
+test('a 400 that names an unknown model (OpenRouter) is a model problem too; other 400s are not (#758)', async () => {
+ const cfg = { provider: 'compatible', providerOptions: { compatible: { baseUrl: 'https://openrouter.test/api/v1' } } };
+ const f = fakeFetch((n, url, init) => init.method === 'GET' ? ok({ data: [{ id: 'anthropic/claude-x' }, { id: 'google/gemini-3.8-flash' }, { id: 'openai/gpt-x' }] })
+ : JSON.parse(init.body).model === 'google/gemini-2.5-pro' ? { status: 400, body: { error: { message: 'google/gemini-2.5-pro is not a valid model ID' } } }
+ : ok({ choices: [{ message: { content: ANSWER }, finish_reason: 'stop' }] }));
+ const r = await compatible.invoke({ cfg, prompt: 'P', env: {}, model: 'google/gemini-2.5-pro', fetch: f });
+ assert.equal(r.code, 0, r.stderr);
+ assert.equal(r.model, 'google/gemini-3.8-flash', 'the same vendor as the refused name');
+ const h = fakeFetch([{ status: 400, body: { error: { message: 'temperature must be between 0 and 2' } } }]);
+ const rh = await openai.invoke({ cfg: {}, prompt: 'P', env, model: 'gpt-x', fetch: h });
+ assert.equal(h.calls.length, 1);
+ assert.match(rh.stderr, /^400 temperature/);
+});
+
test('a missing key is "missing", like an absent CLI — no request is made', async () => {
const f = fakeFetch([]);
const r = await anthropic.invoke({ cfg: {}, prompt: 'P', env: {}, fetch: f });
diff --git a/frontend/src/lib/coach-local.js b/frontend/src/lib/coach-local.js
index 29790dfc4..953778383 100644
--- a/frontend/src/lib/coach-local.js
+++ b/frontend/src/lib/coach-local.js
@@ -26,6 +26,7 @@ import anthropic from '../../../api/coach/core/adapters/anthropic.js'
import openai from '../../../api/coach/core/adapters/openai.js'
import gemini from '../../../api/coach/core/adapters/gemini.js'
import compatible from '../../../api/coach/core/adapters/compatible.js'
+import { modelSubstitute } from '../../../api/coach/core/adapters/http.js'
import { nativeFetch } from './capacitor-fetch.js'
import { getApiKey } from './coach-secrets.js'
import { loadCoachDevice, saveCoachDevice, coachLimits } from './coach-device.js'
@@ -189,11 +190,16 @@ async function run(S, kind, opts, d, adapter) {
handle: await handle(), kind, intake: opts.intake, note: opts.note, refine: opts.refine, previous: opts.previous, workoutId: opts.workoutId, today: opts.today,
lang: getLang() // what the app shows, which a profile that never picked a language does not store (#303)
})
+ const model = d.model || HTTP_PROVIDERS[d.provider].defaultModel
const attempt = await runPipeline({
adapter, cfg: cfgOf(d), kind, payload,
- model: d.model || HTTP_PROVIDERS[d.provider].defaultModel, timeoutMs: timeoutFor(d.provider),
+ model, timeoutMs: timeoutFor(d.provider),
invokeOpts: { env: envOf(d, key), fetch: nativeFetch, maxTokens: coachLimits(d).maxOutputTokens }
})
+ // The saved model was refused and another one answered (#758): keep that one, so the next
+ // launch does not pay for the same 404 again. The setup screen shows the new name.
+ const swapped = model && modelSubstitute(d.provider, cfgOf(d), model)
+ if (swapped && swapped !== d.model) await saveCoachDevice({ model: swapped })
if (!attempt.ok) {
// There is no admin card on a phone, so the reason has to reach the person holding it:
// the provider's own words for a refusal, the validator's for an answer that did not fit.
diff --git a/frontend/src/lib/coach-local.test.js b/frontend/src/lib/coach-local.test.js
index 28658abc5..9ca5badb6 100644
--- a/frontend/src/lib/coach-local.test.js
+++ b/frontend/src/lib/coach-local.test.js
@@ -17,8 +17,8 @@ vi.mock('./coach-secrets.js', () => ({ getApiKey: async () => secret.key, setApi
const wire = { calls: [], answer: null }
vi.mock('./capacitor-fetch.js', () => ({
nativeFetch: async (url, init) => {
- wire.calls.push({ url, init, body: JSON.parse(init.body) })
- const a = typeof wire.answer === 'function' ? wire.answer(wire.calls.length) : wire.answer
+ wire.calls.push({ url, init, body: init.body ? JSON.parse(init.body) : null })
+ const a = typeof wire.answer === 'function' ? wire.answer(wire.calls.length, url, init) : wire.answer
return { ok: a.status < 300, status: a.status, text: async () => JSON.stringify(a.body), json: async () => a.body }
}
}))
@@ -108,11 +108,28 @@ describe('the Coach on a phone with its own key', () => {
await local.localReview(state())
const s = await settle()
expect(s.lastError.errorClass).toBe('provider')
- expect(s.lastError.detail).toMatch(/^404 The model `gpt-4o-mini-tts` does not exist/)
+ expect(s.lastError.detail).toMatch(/^404 the model "gpt-t" is not available to this key.*: The model `gpt-4o-mini-tts` does not exist/)
expect(seen.at(-1)).toMatchObject({ kind: 'failed', errorClass: 'provider', detail: expect.stringMatching(/does not exist/) })
local.setNotifier(null)
})
+ it('a saved model the key cannot use is swapped for one it can, and the swap is kept (#758)', async () => {
+ const { HTTP_PROVIDERS } = await import('../../../api/coach/core/providers.js')
+ const next = HTTP_PROVIDERS.gemini.defaultModel
+ device.data = { mode: 'byok', provider: 'gemini', model: 'gemini-2.5-pro', baseUrl: null }
+ wire.answer = (n, url) => url.includes('/models?')
+ ? { status: 200, body: { models: [{ name: 'models/gemini-2.5-pro' }, { name: 'models/' + next }] } }
+ : url.includes('gemini-2.5-pro')
+ ? { status: 404, body: { error: { message: 'This model models/gemini-2.5-pro is no longer available to new users.' } } }
+ : { status: 200, body: { candidates: [{ finishReason: 'STOP', content: { parts: [{ text: JSON.stringify(review) }] } }] } }
+ await local.localReview(state())
+ const s = await settle()
+ expect(s.lastError).toBeNull()
+ expect(s.pending?.kind).toBe('review')
+ expect(wire.calls.at(-1).url).toContain(`/models/${next}:generateContent`)
+ expect((await loadCoachDevice()).model).toBe(next)
+ })
+
it('a 401 is an auth failure, and never a proposal', async () => {
wire.answer = { status: 401, body: { error: { message: 'bad key' } } }
await local.localReview(state())
diff --git a/frontend/src/views/CoachSetup.flow.test.jsx b/frontend/src/views/CoachSetup.flow.test.jsx
index 40f98351a..306c4dde6 100644
--- a/frontend/src/views/CoachSetup.flow.test.jsx
+++ b/frontend/src/views/CoachSetup.flow.test.jsx
@@ -317,10 +317,10 @@ describe('CoachSetup — listing the models', () => {
expect(host.querySelector('select')).toBe(null)
expect(btn('Save and use the Coach')).toBeUndefined()
- vi.mocked(localModels).mockResolvedValue({ ok: true, models: ['gemini-2.5-pro'] })
+ vi.mocked(localModels).mockResolvedValue({ ok: true, models: [HTTP_PROVIDERS.gemini.defaultModel] })
await click(btn('List models')); await settle()
expect(localModels).toHaveBeenLastCalledWith({ provider: 'gemini', baseUrl: null }, 'sk-1')
- expect(host.querySelector('select').value).toBe('gemini-2.5-pro')
+ expect(host.querySelector('select').value).toBe(HTTP_PROVIDERS.gemini.defaultModel)
})
})