fix(session): inline @agent mention uses agent's configured model#28816
Open
lexlian wants to merge 2 commits into
Open
fix(session): inline @agent mention uses agent's configured model#28816lexlian wants to merge 2 commits into
lexlian wants to merge 2 commits into
Conversation
Closes anomalyco#28809 When mentioning an agent inline (e.g. "@other hello"), the agent name lives in the parts array as AgentPartInput. createUserMessage was only reading input.agent (top-level field set by UI agent switch), which remains unset for inline mentions, causing a fallback to the default agent's model instead of the mentioned agent's configured model. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Contributor
|
Thanks for updating your PR! It now meets our contributing guidelines. 👍 |
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.
Issue for this PR
Closes #28809
Type of change
What does this PR do?
Single-line fix in
packages/opencode/src/session/prompt.ts:689:createUserMessagewas only readinginput.agent(top-level field set by the UI agent switch). When mentioning an agent inline like@other hello, the agent name lives ininput.partsasAgentPartInput, soinput.agentremains undefined. This caused the code to fall back to the default agent's model instead of using the mentioned agent's configured model.How did you verify your code works?
test/session/prompt.test.ts: inline@agentmention uses the agent's configured modelbun typecheckpasses (15/15 packages)bun test ./test/session/prompt.test.ts --test-name-pattern "inline.*agent.*mention"passesScreenshots / recordings
N/A — logic fix, no UI change.
Checklist