fix(opencode): preserve variant for delegated tasks (#30630)
This commit is contained in:
parent
d3d4335509
commit
ee74dd83f5
@ -172,6 +172,7 @@ export const TaskTool = Tool.define(
|
||||
Effect.orDie,
|
||||
)
|
||||
if (msg.info.role !== "assistant") return yield* Effect.fail(new Error("Not an assistant message"))
|
||||
const variant = msg.info.variant
|
||||
|
||||
const model = next.model ?? {
|
||||
modelID: msg.info.modelID,
|
||||
@ -201,6 +202,7 @@ export const TaskTool = Tool.define(
|
||||
modelID: model.modelID,
|
||||
providerID: model.providerID,
|
||||
},
|
||||
variant: next.model ? undefined : variant,
|
||||
agent: next.name,
|
||||
tools: {
|
||||
...(next.permission.some((rule) => rule.permission === "todowrite") ? {} : { todowrite: false }),
|
||||
@ -221,6 +223,7 @@ export const TaskTool = Tool.define(
|
||||
.prompt({
|
||||
sessionID: ctx.sessionID,
|
||||
agent: currentParent.agent ?? ctx.agent,
|
||||
variant,
|
||||
parts: [
|
||||
{
|
||||
type: "text",
|
||||
|
||||
@ -81,6 +81,7 @@ const seed = Effect.fn("TaskToolTest.seed")(function* (title = "Pinned") {
|
||||
tokens: { input: 0, output: 0, reasoning: 0, cache: { read: 0, write: 0 } },
|
||||
modelID: ref.modelID,
|
||||
providerID: ref.providerID,
|
||||
variant: "xhigh",
|
||||
time: { created: Date.now() },
|
||||
}
|
||||
yield* session.updateMessage(assistant)
|
||||
@ -242,6 +243,7 @@ describe("tool.task", () => {
|
||||
expect(result.metadata.sessionId).toBe(child.id)
|
||||
expect(result.output).toContain(`<task id="${child.id}" state="completed">`)
|
||||
expect(seen?.sessionID).toBe(child.id)
|
||||
expect(seen?.variant).toBe("xhigh")
|
||||
}),
|
||||
)
|
||||
|
||||
@ -586,6 +588,7 @@ describe("tool.task", () => {
|
||||
expect(waited.info?.status).toBe("completed")
|
||||
expect(waited.info?.output).toBe("second done")
|
||||
const notification = yield* Effect.promise(() => injected.promise)
|
||||
expect(notification.variant).toBe("xhigh")
|
||||
expect(notification.parts[0]?.type).toBe("text")
|
||||
if (notification.parts[0]?.type === "text") expect(notification.parts[0].text).toContain("second done")
|
||||
}),
|
||||
|
||||
Loading…
Reference in New Issue
Block a user