Skip to content

Model selection: prefer session history over agent default (-m) #11334

Closed

Description

@rickross

When a session's model is changed via the model picker, integrations that call session.prompt without an explicit model can still be forced back to the agent's default model (e.g. when started with -m).\n\nExpected: the session's currently selected model (last used for that agent) should be used unless the request explicitly supplies a model.\n\nCurrent: resolution order is input.model ?? agent.model ?? lastModel(sessionID), which makes -m effectively pin the model and ignore session selection.\n\nRepro:\n1) Start a session with opencode -m \n2) Switch model to in the session\n3) Submit a prompt from another caller that does not pass model\n4) It uses modelA instead of modelB

Activity

  1. github-actions commented on Jan 30, 2026

    @github-actions
    Contributor

    This issue might be a duplicate of existing issues. Please check:

    Feel free to ignore if none of these address your specific case.

  2. rickross commented on Jan 30, 2026

    @rickross
    Author

    Likely same root cause as #4243 and #4901 (agent/default model taking precedence when a prompt doesn't explicitly pass model). PR #11332 proposes resolving session-selected model before agent default.

  3. github-actions commented on Apr 1, 2026

    @github-actions
    Contributor

    To stay organized issues are automatically closed after 90 days of no activity. If the issue is still relevant please open a new one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions