Repository navigation
Conversation
|
Thanks for your contribution! This PR doesn't have a linked issue. All PRs must reference an existing issue. Please:
See CONTRIBUTING.md for details. |
|
Thanks for updating your PR! It now meets our contributing guidelines. 👍 |
|
@stevoland you closed #9296 a while back - this PR fixes the exact repro described there (plan agent's model carried into the build agent on plan_exit), which still reproduces on current |
|
@nexxeln sorry to add to your queue - could you take a look when you have a moment? @stevoland was pinged a few days ago without response so far. It fixes the repro from #9296 and ships with a regression test. Happy to adjust anything. |
|
@rekram1-node hi! This one has been waiting on a review for a while (all checks green, mergeable). It's a small core fix: |
|
This branch has been upgraded to V2. We're no longer taking PRs for V1. If you think this is still relevant, please port it over and open it for V2. — from 𝕺𝖕𝖊𝖓𝕮𝖔𝖉𝖊 |
Issue for this PR
Closes #9296
Note: #9296 was closed pending v2 and the bug still reproduces on
dev. Earlier attempts #23971 and #29457 were closed unmerged.Type of change
What does this PR do?
plan_exitresolved the model for the synthetic build user message from the last user message, which in plan mode carries the plan agent's model. The run loop (SessionPromptrunLoop) picks its model from the newest user message on every turn and never readsagent.build.modelmid-loop, so with bothagent.plan.modelandagent.build.modelconfigured, the build kept running the plan model.This applies the same precedence
createUserMessageuses when creating prompts (input.model ?? ag.model ?? currentModel): the build agent's configured model first, then the last user message's model, then the provider default. The build agent'svariantis resolved the waycreateUserMessageresolves it (only when the agent's configured model was selected and the model exposes that variant).How did you verify your code works?
packages/opencode/test/tool/plan.test.ts: withagent.plan.model = test/test-modelandagent.build.model = test/build-model, assertsplan_exitstampsbuild-modelon the synthetic message (failed withtest-modelbefore the fix); a second case asserts the fallback to the plan model when the build agent has no configured model.bun test test/tool/plan.test.ts test/session/prompt.test.tsinpackages/opencode: 61 pass, 1 skip, 0 fail.bun test test/agent/agent.test.ts test/agent/plan-mode-subagent-bypass.test.ts: 48 pass, 0 fail.bun typecheckinpackages/opencode: clean.Screenshots / recordings
Not a UI change.
Checklist