tweak: ensure synthetic user message following subtasks is only added when user manually invoked subtask
This commit is contained in:
@@ -454,28 +454,30 @@ export namespace SessionPrompt {
|
|||||||
} satisfies MessageV2.ToolPart)
|
} satisfies MessageV2.ToolPart)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add synthetic user message to prevent certain reasoning models from erroring
|
if (task.command) {
|
||||||
// If we create assistant messages w/ out user ones following mid loop thinking signatures
|
// Add synthetic user message to prevent certain reasoning models from erroring
|
||||||
// will be missing and it can cause errors for models like gemini for example
|
// If we create assistant messages w/ out user ones following mid loop thinking signatures
|
||||||
const summaryUserMsg: MessageV2.User = {
|
// will be missing and it can cause errors for models like gemini for example
|
||||||
id: Identifier.ascending("message"),
|
const summaryUserMsg: MessageV2.User = {
|
||||||
sessionID,
|
id: Identifier.ascending("message"),
|
||||||
role: "user",
|
sessionID,
|
||||||
time: {
|
role: "user",
|
||||||
created: Date.now(),
|
time: {
|
||||||
},
|
created: Date.now(),
|
||||||
agent: lastUser.agent,
|
},
|
||||||
model: lastUser.model,
|
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)
|
||||||
}
|
}
|
||||||
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
|
continue
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user