Repository navigation
fix(core): use the agent's model when a session has none - #58355
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
Looks good. I reproduced #55727 on the base with the bot's stub-provider script, run from source: opencode run --standalone with the default agent, --agent plan and --agent reviewer (frontmatter model) all sent the default model-a instead of the agent's model-b. With this PR all three use and send model-b, and -m still overrides. The nearby core tests pass, and the core package type-checks with typecheck:tsc.
Public API is unchanged: no config keys, flags, endpoints or events change. Only the default model for a session without an explicit model now comes from the agent first.
No blocking concerns.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
An agent's
modelsetting (configagents.<id>.modelor agent frontmatter) was ignored when a session started without a model, soopencode runandopencode run --agent <id>always used the server's default model. Only the TUI applied it, on the client side.Change
session has no model: + 1. the agent's model, if it's available 2. config "model" 3. newest released model that supports textSessionRunnerModel.resolvechecks the session agent's model before falling back to the resolver. If the agent's model isn't in the available list, it falls back the same way as before.Out of scope
run --agent X --variant Vwithout--modelstill asks themodel.defaultendpoint, which doesn't know about the agent.Verification
bun typecheckinpackages/coreagents.build.modelset toopencode/gpt-6.1-solin a project config,bun run dev run --standalone "reply ok"picksgpt-6.1-solFixes #55727
Fixes #42561
Added by the opencode bot (AI-generated).
Related: #51326, #47071, #49765, #53060