Skip to content

fix(opencode): prefer session-selected model over agent default - #11332

Closed
rickross wants to merge 1 commit into
anomalyco:devfrom
rickross:fix/session-model-precedence
Closed

rickross wants to merge 1 commit into
anomalyco:devfrom
rickross:fix/session-model-precedence

Conversation

@rickross

@rickross rickross commented Jan 30, 2026 •

Copy link
Copy Markdown

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

@github-actions

Copy link
Copy Markdown
Contributor

Hey! Your PR title Prefer session-selected model over agent default doesn't follow conventional commit format.

Please update it to start with one of:

  • feat: or feat(scope): new feature
  • fix: or fix(scope): bug fix
  • docs: or docs(scope): documentation changes
  • chore: or chore(scope): maintenance tasks
  • refactor: or refactor(scope): code refactoring
  • test: or test(scope): adding or updating tests

Where scope is the package name (e.g., app, desktop, opencode).

See CONTRIBUTING.md for details.

@github-actions

Copy link
Copy Markdown
Contributor

The following comment was made by an LLM, it may be inaccurate:

No duplicate PRs found

@rickross rickross changed the title Prefer session-selected model over agent default fix(opencode): prefer session-selected model over agent default Jan 30, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Thanks for your contribution!

This PR doesn't have a linked issue. All PRs must reference an existing issue.

Please:

  1. Open an issue describing the bug/feature (if one doesn't exist)
  2. Add Fixes #<number> or Closes #<number> to this PR description

See CONTRIBUTING.md for details.

@github-actions

github-actions Bot commented Apr 1, 2026

Copy link
Copy Markdown
Contributor

Closing this pull request because it has had no updates for more than 60 days. If you plan to continue working on it, feel free to reopen or open a new PR.

@github-actions github-actions Bot closed this Apr 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

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

1 participant