fix(opencode): continue unknown finish responses (#43892)
Co-authored-by: rekram1-node <rekram1-node@users.noreply.github.com>
This commit is contained in:
committed by
GitHub
parent
0af9dd61d2
commit
57fa34f235
@@ -1110,7 +1110,7 @@ const layer = Layer.effect(
|
|||||||
|
|
||||||
if (
|
if (
|
||||||
lastAssistant?.finish &&
|
lastAssistant?.finish &&
|
||||||
!["tool-calls"].includes(lastAssistant.finish) &&
|
!["tool-calls", "unknown"].includes(lastAssistant.finish) &&
|
||||||
!hasToolCalls &&
|
!hasToolCalls &&
|
||||||
lastAssistant.parentID === lastUser.id
|
lastAssistant.parentID === lastUser.id
|
||||||
) {
|
) {
|
||||||
|
|||||||
@@ -850,6 +850,34 @@ it.instance("loop continues when finish is tool-calls", () =>
|
|||||||
}),
|
}),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
it.instance("loop continues when finish is unknown", () =>
|
||||||
|
Effect.gen(function* () {
|
||||||
|
const { llm } = yield* useServerConfig(providerCfg)
|
||||||
|
const prompt = yield* SessionPrompt.Service
|
||||||
|
const sessions = yield* Session.Service
|
||||||
|
const session = yield* sessions.create({
|
||||||
|
title: "Pinned",
|
||||||
|
permission: [{ permission: "*", pattern: "*", action: "allow" }],
|
||||||
|
})
|
||||||
|
yield* prompt.prompt({
|
||||||
|
sessionID: session.id,
|
||||||
|
agent: "build",
|
||||||
|
noReply: true,
|
||||||
|
parts: [{ type: "text", text: "hello" }],
|
||||||
|
})
|
||||||
|
yield* llm.push(reply())
|
||||||
|
yield* llm.text("second")
|
||||||
|
|
||||||
|
const result = yield* prompt.loop({ sessionID: session.id })
|
||||||
|
expect(yield* llm.calls).toBe(2)
|
||||||
|
expect(result.info.role).toBe("assistant")
|
||||||
|
if (result.info.role === "assistant") {
|
||||||
|
expect(result.parts.some((part) => part.type === "text" && part.text === "second")).toBe(true)
|
||||||
|
expect(result.info.finish).toBe("stop")
|
||||||
|
}
|
||||||
|
}),
|
||||||
|
)
|
||||||
|
|
||||||
it.instance("glob tool keeps instance context during prompt runs", () =>
|
it.instance("glob tool keeps instance context during prompt runs", () =>
|
||||||
Effect.gen(function* () {
|
Effect.gen(function* () {
|
||||||
const { dir, llm } = yield* useServerConfig(providerCfg)
|
const { dir, llm } = yield* useServerConfig(providerCfg)
|
||||||
|
|||||||
Reference in New Issue
Block a user