fix: preserve explicit model selection in command subtasks#18752
fix: preserve explicit model selection in command subtasks#18752Haohao-end wants to merge 3 commits intoanomalyco:devfrom
Conversation
|
The following comment was made by an LLM, it may be inaccurate: Based on my search, I found one potentially related PR: PR #17788: "fix: prioritize CLI --model argument over command markdown model"
This PR is related because both deal with model precedence and ensuring explicit model selections aren't overridden by fallback models. However, PR #17788 focuses on the CLI |
|
I noticed this PR while researching subagent model-routing behavior and ended up opening #26117 before I found it. The two overlap heavily.\n\nOne difference in #26117 is that it keeps the internal delegated model scoped to command-triggered subtasks only, so ordinary/manual subtasks keep the existing fallback path. It also explicitly avoids pre-seeding child session agent/model after I hit a switch-event/history regression during QA, and adds regression coverage around fallback behavior and non-authoritative session metadata.\n\nIf it’s useful, I’m happy to help fold those guardrails/tests into this PR instead of splitting reviewer attention across two overlapping fixes. |
Issue for this PR
Closes #18615
Type of change
What does this PR do?
This fixes model precedence in the command/subtask delegation path.
The bug was that an explicit
modelinput could still be overridden by an agent-configured fallback model when resolving a command/subtask request.I changed the precedence in
packages/opencode/src/session/prompt.tsso that it is now:Why this works:
How did you verify your code works?
I tested locally with:
cd packages/opencode && bun test test/session/prompt.test.ts --timeout 30000cd packages/opencode && bun run typecheckI also added focused regression coverage to verify that explicit model selection is preserved in the command/subtask path.
Screenshots / recordings
N/A (not a UI change)
Checklist