mirror of
https://github.com/anomalyco/opencode.git
synced 2026-08-21 18:13:33 +00:00
fix(opencode): continue unknown finish responses (#43892)
Co-authored-by: rekram1-node <rekram1-node@users.noreply.github.com>
This commit is contained in:
parent
0af9dd61d2
commit
57fa34f235
2 changed files with 29 additions and 1 deletions
|
|
@ -1110,7 +1110,7 @@ const layer = Layer.effect(
|
|||
|
||||
if (
|
||||
lastAssistant?.finish &&
|
||||
!["tool-calls"].includes(lastAssistant.finish) &&
|
||||
!["tool-calls", "unknown"].includes(lastAssistant.finish) &&
|
||||
!hasToolCalls &&
|
||||
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", () =>
|
||||
Effect.gen(function* () {
|
||||
const { dir, llm } = yield* useServerConfig(providerCfg)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue