You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[BUG] Manual model selection with "Remember model" enabled fails to persist on restart #19864
When using the /model command to manually select a specific model (e.g., gemini-3.1-pro-preview) and toggling "Remember model for future sessions" to true via the Tab key, the setting is not honored. Upon restarting the Gemini CLI, the model routing defaults back to Auto (Gemini 3) instead of the manually selected model.
What did you expect to happen?
If "Remember model for future sessions" is set to true, the CLI should persist the manual model selection in the local configuration and automatically load that specific model on the next startup, rather than reverting to the default Auto routing.
Client information
│ About Gemini CLI │
│ │
│ CLI Version 0.29.5 │
│ Git Commit 2ef872e │
│ Model Auto (Gemini 3) │
│ Sandbox no sandbox │
│ OS darwin │
│ Auth Method Logged in with Google │
│ Tier Gemini Code Assist in Google One AI Ultra
I'm new to open source but I've been reading through the codebase to understand how model selection works, and I'd like to work on this. Could you assign this to me?
I traced the flow from ModelDialog.tsx → config.setModel() → onModelChange → saveModelChange() and the persist toggle logic looks correct on paper. I believe the issue is that saveModelChange() calls loadedSettings.setValue() which updates in-memory settings but doesn't actually flush to the user's settings.json on disk unlike saveSettings() which explicitly calls updateSettingsFilePreservingFormat. Another possibility is the persisted model.name getting overridden by the default auto-gemini-3 fallback on startup.
Is this the right direction or am I missing something?
@vanshaj2023 Dude lol that was funny for some reason. In general, in every large open source project, there are specifications on how to make PRs. There is a process you must follow to contribute. I suggest you read the documentation (or relevant topics), there is a section for contributing (main README.md). I'll leave the link here just in case: [https://github.com/google-gemini/gemini-cli/blob/main/CONTRIBUTING.md]
✅ WRITING-PLANS ACTIVATED – Gemini CLI Model Persistence Bug #19864 Leveraged (Turbo Fleet Command – Feb 21, 2026 – 1 hour after issue opened)
Project Spec (exact from #19864): [BUG] Manual model selection with "Remember model" enabled fails to persist on restart
Reproduction (verbatim):
Run /model
Select e.g. gemini-3.1-pro-preview
Toggle "Remember model for future sessions" to true (Tab key)
Restart Gemini CLI Actual: Reverts to Auto (Gemini 3) Expected: Loads the manually chosen model
Client info: Gemini CLI v0.29.5 • darwin • Tier: Gemini Code Assist in Google One AI Ultra
No comments yet. Labels: area/core, status/need-triage, Bug
Goal for our fleet:
Make nec-fleet-gemini and the Central Documentation Hub bulletproof against this core bug today.
Force reliable high-intelligence model persistence (ideal for NEC 2026 code accuracy, takeoffs, SRS quiz generation, DEATHSTAR orchestration) while the upstream fix lands.
Turn the bug into a fleet superpower: one-command model lock + auto-health dashboard.
MULTI-PHASE EXECUTION PLAN (Before Any Code Touch)
Phase 0: Lock & Monitoring (Current – 5 min)
Lock this spec
Auto-watch the issue + linked PRs (via github extension)
Confirm preferred model for nec-fleet (gemini-3.1-pro-preview for reasoning depth)
Output: Signed-off plan + live issue tracker link
Success Metric: Commander replies LOCKED
Phase 1: Immediate Workaround Tool in nec-fleet-gemini (Est. 35 min)
New MCP tool: nec_model_lock(modelName, remember=true)
Hi @LyalinDotCom, thanks for raising this. I reproduced it on my machine.
Issue: With "Remember model" on and a manual preview model (e.g. gemini-3.1-pro-preview), the CLI reverted to Auto on restart. Cause: when quota wasn't fetched, hasAccessToPreviewModel stayed false and the reset logic wrongly cleared the saved model.
Fix:hasAccessToPreviewModel is now boolean | null (null = unknown). We only reset when it's explicitly false; when null or true we keep the saved model. Same for all auth types. Fix is in PR #19891 and I've validated the fix with your repro steps.
I think from the original bug description - the issue occurs when a user temporarily selects a model, then attempts to select the identical model with persistence (--persist flag or Remember checked). Currently, config.ts checks if the model has changed, and if not, completely bypasses the onModelChange callback that saves the setting to disk.
Will send a PR for this here shortly.
Activity
vanshaj2023 commentedon Feb 22, 2026
Hi @LyalinDotCom
I'm new to open source but I've been reading through the codebase to understand how model selection works, and I'd like to work on this. Could you assign this to me?
I traced the flow from
ModelDialog.tsx→config.setModel()→onModelChange→saveModelChange()and the persist toggle logic looks correct on paper. I believe the issue is thatsaveModelChange()callsloadedSettings.setValue()which updates in-memory settings but doesn't actually flush to the user'ssettings.jsonon disk unlikesaveSettings()which explicitly callsupdateSettingsFilePreservingFormat. Another possibility is the persistedmodel.namegetting overridden by the defaultauto-gemini-3fallback on startup.Is this the right direction or am I missing something?
edwrios commentedon Feb 22, 2026
@vanshaj2023 Dude lol that was funny for some reason. In general, in every large open source project, there are specifications on how to make PRs. There is a process you must follow to contribute. I suggest you read the documentation (or relevant topics), there is a section for contributing (main README.md). I'll leave the link here just in case: [https://github.com/google-gemini/gemini-cli/blob/main/CONTRIBUTING.md]
Turbo-the-tech-dev commentedon Feb 22, 2026
✅ WRITING-PLANS ACTIVATED – Gemini CLI Model Persistence Bug #19864 Leveraged
(Turbo Fleet Command – Feb 21, 2026 – 1 hour after issue opened)
Project Spec (exact from #19864):
[BUG] Manual model selection with "Remember model" enabled fails to persist on restart
Reproduction (verbatim):
/modelgemini-3.1-pro-previewActual: Reverts to Auto (Gemini 3)
Expected: Loads the manually chosen model
Client info: Gemini CLI v0.29.5 • darwin • Tier: Gemini Code Assist in Google One AI Ultra
No comments yet. Labels: area/core, status/need-triage, Bug
Goal for our fleet:
Make nec-fleet-gemini and the Central Documentation Hub bulletproof against this core bug today.
Force reliable high-intelligence model persistence (ideal for NEC 2026 code accuracy, takeoffs, SRS quiz generation, DEATHSTAR orchestration) while the upstream fix lands.
Turn the bug into a fleet superpower: one-command model lock + auto-health dashboard.
MULTI-PHASE EXECUTION PLAN (Before Any Code Touch)
Phase 0: Lock & Monitoring (Current – 5 min)
githubextension)Success Metric: Commander replies LOCKED
Phase 1: Immediate Workaround Tool in nec-fleet-gemini (Est. 35 min)
nec_model_lock(modelName, remember=true)~/.config/gemini-cli/config.jsondirectly/nec:model(newcommands/nec/model.toml)Phase 2: Central Docs Hub – Dedicated Troubleshooting Page (Est. 45 min)
/docs/troubleshooting/model-persistence.mdPhase 3: Fleet-Wide Hardening & Footer Integration (Est. 30 min)
nec_status()tool that shows Current Model • Persisted? • Uptime/footerfeature (from PR feat: add custom footer configuration via/footer#19001) – auto-suggest items:🔌 NEC 2026 • Model: gemini-3.1-pro-preview (LOCKED) • INDEX: healthytodo-extreminder +conductordaily model-check taskPhase 4: Release, Upstream Contribution & Announcement (Est. 25 min)
Total Estimated Time: ~2 hours 20 min (can run parallel with maestro)
Risks & Mitigations:
Success Criteria:
/nec:model gemini-3.1-pro-previewsurvives 10 restartsFleet Command ready.
Reply:
LOCKED → I immediately drop:
nec_model_locktool codegemini-extension.json+ newmodel.toml/docs/troubleshooting/model-persistence.mdAMEND → tweak anything (preferred model, add voice alert, etc.)
SKIP TO WORKAROUND → only Phase 1 right now
This bug hit at the perfect time — we turn it into a fleet advantage before anyone else. ⚡🔌
Your move, Commander.
Nixxx19 commentedon Feb 22, 2026
looks interesting, would love to crack this
Fix google-gemini#19864: persist manual model on restart for Google auth
Nixxx19 commentedon Feb 22, 2026
Hi @LyalinDotCom, thanks for raising this. I reproduced it on my machine.
Issue: With "Remember model" on and a manual preview model (e.g.
gemini-3.1-pro-preview), the CLI reverted to Auto on restart. Cause: when quota wasn't fetched,hasAccessToPreviewModelstayed false and the reset logic wrongly cleared the saved model.Fix:
hasAccessToPreviewModelis nowboolean | null(null = unknown). We only reset when it's explicitly false; when null or true we keep the saved model. Same for all auth types. Fix is in PR #19891 and I've validated the fix with your repro steps.yoganand560 commentedon Feb 22, 2026
/assign
gemini-cli commentedon Feb 22, 2026
👋 @yoganand560, you've been assigned to this issue! Thank you for taking the time to contribute. Make sure to check out our contributing guidelines.
Fix: Persist manual model selection on restart #19864 (#19891)
6 remaining items
Merge(Auto) Commit 'ac04c388e': Fix: Persist manual model selection o…
Fix: Persist manual model selection on restart #19864 (#19891)
sripasg commentedon Mar 4, 2026
I think from the original bug description - the issue occurs when a user temporarily selects a model, then attempts to select the identical model with persistence (--persist flag or Remember checked). Currently,
config.tschecks if the model has changed, and if not, completely bypasses the onModelChange callback that saves the setting to disk.Will send a PR for this here shortly.
Merge main into fix/duplicate-gemini-md-case-insensitive
Fix: Persist manual model selection on restart google-gemini#19864 (g…
Fix: Persist manual model selection on restart google-gemini#19864 (g…
Fix: Persist manual model selection on restart #19864 (#19891)
Fix: Persist manual model selection on restart google-gemini#19864 (g…