mirror of
https://github.com/sst/opencode.git
synced 2025-12-23 10:11:41 +00:00
fix: user invoked subtasks causing tool_use or missing thinking signa… (#5650)
This commit is contained in:
parent
1755a3fe07
commit
5f57cee8e4
2 changed files with 25 additions and 0 deletions
|
|
@ -1,6 +1,7 @@
|
|||
---
|
||||
description: git commit and push
|
||||
model: opencode/glm-4.6
|
||||
subtask: true
|
||||
---
|
||||
|
||||
commit and push
|
||||
|
|
|
|||
|
|
@ -396,6 +396,30 @@ export namespace SessionPrompt {
|
|||
},
|
||||
} satisfies MessageV2.ToolPart)
|
||||
}
|
||||
|
||||
// Add synthetic user message to prevent certain reasoning models from erroring
|
||||
// If we create assistant messages w/ out user ones following mid loop thinking signatures
|
||||
// will be missing and it can cause errors for models like gemini for example
|
||||
const summaryUserMsg: MessageV2.User = {
|
||||
id: Identifier.ascending("message"),
|
||||
sessionID,
|
||||
role: "user",
|
||||
time: {
|
||||
created: Date.now(),
|
||||
},
|
||||
agent: lastUser.agent,
|
||||
model: lastUser.model,
|
||||
}
|
||||
await Session.updateMessage(summaryUserMsg)
|
||||
await Session.updatePart({
|
||||
id: Identifier.ascending("part"),
|
||||
messageID: summaryUserMsg.id,
|
||||
sessionID,
|
||||
type: "text",
|
||||
text: "Summarize the task tool output above and continue with your task.",
|
||||
synthetic: true,
|
||||
} satisfies MessageV2.TextPart)
|
||||
|
||||
continue
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue