GeezerVison is showing github.com — fix: user invoked subtasks causing tool_use or missing thinking signa… · zerob13/opencode@5f57cee
File tree
Expand file treeCollapse file tree
Open diff view settings
packages/opencode/src/session
Expand file treeCollapse file tree
Open diff view settings
Collapse file
Copy file name to clipboardExpand all lines: .opencode/command/commit.md +1Lines changed: 1 addition & 0 deletions - Display the source diff
- Display the rich diff
| Original file line number | Diff line number | Diff line change |
|---|
|
1 | 1 | --- |
2 | 2 | description: git commit and push |
3 | 3 | model: opencode/glm-4.6 |
| 4 | +subtask: true |
4 | 5 | --- |
5 | 6 |
|
6 | 7 | commit and push |
|
Collapse file
Copy file name to clipboardExpand all lines: packages/opencode/src/session/prompt.ts +24Lines changed: 24 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -396,6 +396,30 @@ export namespace SessionPrompt { |
396 | 396 | }, |
397 | 397 | } satisfies MessageV2.ToolPart) |
398 | 398 | } |
| 399 | + |
| 400 | + // Add synthetic user message to prevent certain reasoning models from erroring |
| 401 | + // If we create assistant messages w/ out user ones following mid loop thinking signatures |
| 402 | + // will be missing and it can cause errors for models like gemini for example |
| 403 | + const summaryUserMsg: MessageV2.User = { |
| 404 | + id: Identifier.ascending("message"), |
| 405 | + sessionID, |
| 406 | + role: "user", |
| 407 | + time: { |
| 408 | + created: Date.now(), |
| 409 | + }, |
| 410 | + agent: lastUser.agent, |
| 411 | + model: lastUser.model, |
| 412 | + } |
| 413 | + await Session.updateMessage(summaryUserMsg) |
| 414 | + await Session.updatePart({ |
| 415 | + id: Identifier.ascending("part"), |
| 416 | + messageID: summaryUserMsg.id, |
| 417 | + sessionID, |
| 418 | + type: "text", |
| 419 | + text: "Summarize the task tool output above and continue with your task.", |
| 420 | + synthetic: true, |
| 421 | + } satisfies MessageV2.TextPart) |
| 422 | + |
399 | 423 | continue |
400 | 424 | } |
401 | 425 |
|
|