[PR #11332] fix(opencode): prefer session-selected model over agent default #13743

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

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

State: open
Merged: No


Fixes #11334

OpenCode currently resolves the model for a prompt as:

input.model ?? agent.model ?? lastModel(sessionID)

If an agent is launched with -m (or has a default model configured), that default can override the session-selected model for callers that don't pass model explicitly (e.g. chat integrations).

This change prefers the session's last-used model (scoped to the current agent) before falling back to the agent default.

Related: #4243, #4901

**Original Pull Request:** https://github.com/anomalyco/opencode/pull/11332 **State:** open **Merged:** No --- Fixes #11334 OpenCode currently resolves the model for a prompt as: `input.model ?? agent.model ?? lastModel(sessionID)` If an agent is launched with `-m` (or has a default model configured), that default can override the session-selected model for callers that don't pass `model` explicitly (e.g. chat integrations). This change prefers the session's last-used model (scoped to the current agent) before falling back to the agent default. Related: #4243, #4901
yindo added the pull-request label 2026-02-16 18:18: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#13743