Skip to content

Commit a1cf111

Browse files
author
fmb4910-ops
committed
fix(plan): don't carry plan model into build agent on plan_exit
Remove the model resolution from last user message in plan_exit. Instead of stamping the plan agent's model on the synthetic build message, pass model: undefined so the prompt.ts resolution chain (input.model ?? ag.model ?? currentModel) falls through to ag.model, which is the build agent's configured model. Fixes #9296
1 parent 0ba1081 commit a1cf111

1 file changed

Lines changed: 1 addition & 8 deletions

File tree

packages/opencode/src/tool/plan.ts

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import * as Tool from "./tool"
44
import { Question } from "../question"
55
import { Session } from "@/session/session"
66
import { MessageV2 } from "../session/message-v2"
7-
import { Provider } from "@/provider/provider"
87
import { InstanceState } from "@/effect/instance-state"
98
import { MessageID, PartID } from "../session/schema"
109
import EXIT_DESCRIPTION from "./plan-exit.txt"
@@ -16,7 +15,6 @@ export const PlanExitTool = Tool.define(
1615
Effect.gen(function* () {
1716
const session = yield* Session.Service
1817
const question = yield* Question.Service
19-
const provider = yield* Provider.Service
2018

2119
return {
2220
description: EXIT_DESCRIPTION,
@@ -44,18 +42,13 @@ export const PlanExitTool = Tool.define(
4442

4543
if (answers[0]?.[0] === "No") yield* new Question.RejectedError()
4644

47-
const messages = yield* session.messages({ sessionID: ctx.sessionID }).pipe(Effect.orDie)
48-
const lastUser = messages.findLast((item) => item.info.role === "user" && item.info.model)
49-
const model =
50-
lastUser?.info.role === "user" && lastUser.info.model ? lastUser.info.model : yield* provider.defaultModel()
51-
5245
const msg: MessageV2.User = {
5346
id: MessageID.ascending(),
5447
sessionID: ctx.sessionID,
5548
role: "user",
5649
time: { created: Date.now() },
5750
agent: "build",
58-
model,
51+
model: undefined,
5952
}
6053
yield* session.updateMessage(msg)
6154
yield* session.updatePart({

0 commit comments

Comments
 (0)