File tree Expand file tree Collapse file tree 2 files changed +25
-0
lines changed
packages/opencode/src/session Expand file tree Collapse file tree 2 files changed +25
-0
lines changed Original file line number Diff line number Diff line change 11---
22description : git commit and push
33model : opencode/glm-4.6
4+ subtask : true
45---
56
67commit and push
Original file line number Diff line number Diff line change @@ -396,6 +396,30 @@ export namespace SessionPrompt {
396396 } ,
397397 } satisfies MessageV2 . ToolPart )
398398 }
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+
399423 continue
400424 }
401425
You can’t perform that action at this time.
0 commit comments