summaryrefslogtreecommitdiffhomepage
path: root/packages
diff options
context:
space:
mode:
authorAiden Cline <[email protected]>2026-01-20 22:51:54 -0600
committerAiden Cline <[email protected]>2026-01-20 22:51:54 -0600
commit9dc95c4c698006772f12ecec03635023bf3d74d8 (patch)
treedacc91c0d74033b4ed089624f540f02aab930202 /packages
parentb93f33eaa4ea48f5096abe01af8bc5d9a6095fb9 (diff)
downloadopencode-9dc95c4c698006772f12ecec03635023bf3d74d8.tar.gz
opencode-9dc95c4c698006772f12ecec03635023bf3d74d8.zip
tweak: ensure synthetic user message following subtasks is only added when user manually invoked subtask
Diffstat (limited to 'packages')
-rw-r--r--packages/opencode/src/session/prompt.ts44
1 files changed, 23 insertions, 21 deletions
diff --git a/packages/opencode/src/session/prompt.ts b/packages/opencode/src/session/prompt.ts
index f52e692d9..587f94980 100644
--- a/packages/opencode/src/session/prompt.ts
+++ b/packages/opencode/src/session/prompt.ts
@@ -454,28 +454,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,
+ if (task.command) {
+ // 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)
}
- 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
}