[PR #12582] fix: look for recent model in fallback in cli #14279

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

Original Pull Request: https://github.com/anomalyco/opencode/pull/12582

State: closed
Merged: Yes


What does this PR do?

Fixes #12667

Currently, if the model is not passed when using the cli opencode run (so no --model or in opencode.json and so on), then it falls back and chooses the highest priority model from Provider.sort() but this is unlike the TUI where it reads the model from the model.json file so it uses whatever we had used last in the TUI. This PR makes it so that CLI also reads from there and uses it if no model is passed before finally falling back to the priority thing.

If you paste a large clearly AI generated description here your PR may be IGNORED or CLOSED!

How did you verify your code works?

I ran bun dev to open the TUI and change model and verified that it is what was chosen when I did bun dev run "Hello"

**Original Pull Request:** https://github.com/anomalyco/opencode/pull/12582 **State:** closed **Merged:** Yes --- ### What does this PR do? Fixes #12667 Currently, if the model is not passed when using the cli `opencode run` (so no `--model` or in `opencode.json` and so on), then it falls back and chooses the highest priority model from `Provider.sort()` but this is unlike the TUI where it reads the model from the `model.json` file so it uses whatever we had used last in the TUI. This PR makes it so that CLI also reads from there and uses it if no model is passed before finally falling back to the priority thing. **If you paste a large clearly AI generated description here your PR may be IGNORED or CLOSED!** ### How did you verify your code works? I ran bun dev to open the TUI and change model and verified that it is what was chosen when I did `bun dev run "Hello"`
yindo added the pull-request label 2026-02-16 18:19:05 -05:00
yindo closed this issue 2026-02-16 18:19:05 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#14279