[PR #1683] [MERGED] Fix: Respect agent's preferred model at TUI startup #10019

Closed
opened 2026-02-16 18:14:34 -05:00 by yindo · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/anomalyco/opencode/pull/1683
Author: @spoons-and-mirrors
Created: 8/7/2025
Status: Merged
Merged: 8/11/2025
Merged by: @adamdotdevin

Base: devHead: fix/use-preferred-model-on-start


📝 Commits (1)

  • 7f2c0e1 fix(tui): use agent's preferred model on startup

📊 Changes

1 file changed (+14 additions, -3 deletions)

View changed files

📝 packages/tui/internal/app/app.go (+14 -3)

📄 Description

Summary

  • Fixed TUI not using mode's preferred model when booting into a specific mode
  • Added mode model selection as Priority 3 in the model selection chain during app initialization

Description

Previously, when opencode TUI started up and loaded a mode (either the last-used mode or a manually specified one), it wouldn't automatically switch to that mode's preferred model defined in the mode's YAML frontmatter. The auto-switching only worked when manually changing modes during an active session.

This fix adds the current mode's preferred model as Priority 3 in the model selection chain, ensuring that when the app boots with a specific mode, it will use that mode's preferred model unless overridden by higher-priority settings (command line flags or config file).

Changes

  • Added Priority 3 check for a.Mode.Model in InitializeProvider()
  • Fixed backwards compatibility logic to check current mode (a.Mode.Name) instead of saved state mode
  • Updated priority comments to reflect new ordering

Model Selection Priority (after fix)

  1. Command line --model flag
  2. Config file model setting
  3. Current mode's preferred model← NEW
  4. Recent model usage
  5. State-based model (backwards compatibility)
  6. Internal priority fallback

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/anomalyco/opencode/pull/1683 **Author:** [@spoons-and-mirrors](https://github.com/spoons-and-mirrors) **Created:** 8/7/2025 **Status:** ✅ Merged **Merged:** 8/11/2025 **Merged by:** [@adamdotdevin](https://github.com/adamdotdevin) **Base:** `dev` ← **Head:** `fix/use-preferred-model-on-start` --- ### 📝 Commits (1) - [`7f2c0e1`](https://github.com/anomalyco/opencode/commit/7f2c0e16feb5634b5062cc4df8cbedc2c5ddde96) fix(tui): use agent's preferred model on startup ### 📊 Changes **1 file changed** (+14 additions, -3 deletions) <details> <summary>View changed files</summary> 📝 `packages/tui/internal/app/app.go` (+14 -3) </details> ### 📄 Description ### Summary - Fixed TUI not using mode's preferred model when booting into a specific mode - Added mode model selection as Priority 3 in the model selection chain during app initialization ### Description Previously, when opencode TUI started up and loaded a mode (either the last-used mode or a manually specified one), it wouldn't automatically switch to that mode's preferred model defined in the mode's YAML frontmatter. The auto-switching only worked when manually changing modes during an active session. This fix adds the current mode's preferred model as Priority 3 in the model selection chain, ensuring that when the app boots with a specific mode, it will use that mode's preferred model unless overridden by higher-priority settings (command line flags or config file). ### Changes - Added Priority 3 check for **a.Mode.Model** in **InitializeProvider()** - Fixed backwards compatibility logic to check current mode (**a.Mode.Name**) instead of saved state mode - Updated priority comments to reflect new ordering ### Model Selection Priority (after fix) 1. Command line **--model** flag 2. Config file model setting 3. **Current mode's preferred model**← NEW 4. Recent model usage 5. State-based model (backwards compatibility) 6. Internal priority fallback --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
yindo added the pull-request label 2026-02-16 18:14:34 -05:00
yindo closed this issue 2026-02-16 18:14:34 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#10019