Skip to content

Commit 12b0cc4

Browse files
authored
fix autoresume not working fine in useChat (#11486)
## Description <!-- Provide a brief description of the changes in this PR --> https://github.com/user-attachments/assets/f77fa8de-d1fc-420c-8f9e-8dd03791dae5 ## Related Issue(s) <!-- Link to the issue(s) this PR addresses, using hashtag notation: #123 --> #11283 ## Type of Change - [x] Bug fix (non-breaking change that fixes an issue) - [ ] New feature (non-breaking change that adds functionality) - [ ] Breaking change (fix or feature that would cause existing functionality to change) - [ ] Documentation update - [ ] Code refactoring - [ ] Performance improvement - [ ] Test update ## Checklist - [ ] I have made corresponding changes to the documentation (if applicable) - [ ] I have added tests that prove my fix is effective or that my feature works <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Bug Fixes** * Fixed auto-resume functionality in useChat that was not working properly. * **Improvements** * Improved detection and handling of suspended tool resumption in agentic workflows. * Added resume schema propagation to make suspend/approve/resume flows more reliable and consistent. <sub>✏️ Tip: You can customize this high-level summary in your review settings.</sub> <!-- end of auto-generated comment: release notes by coderabbit.ai -->
1 parent 4837644 commit 12b0cc4

File tree

6 files changed

+316
-231
lines changed

6 files changed

+316
-231
lines changed

.changeset/young-coins-marry.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
'@mastra/ai-sdk': patch
3+
'@mastra/core': patch
4+
---
5+
6+
Fix autoresume not working fine in useChat

client-sdks/ai-sdk/src/helpers.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,7 @@ export function convertMastraChunkToAISDKv5<OUTPUT extends OutputSchema = undefi
165165
toolCallId: chunk.payload.toolCallId,
166166
toolName: chunk.payload.toolName,
167167
args: chunk.payload.args,
168+
resumeSchema: chunk.payload.resumeSchema,
168169
},
169170
} satisfies DataChunkType;
170171
case 'tool-call-suspended':
@@ -176,6 +177,7 @@ export function convertMastraChunkToAISDKv5<OUTPUT extends OutputSchema = undefi
176177
toolCallId: chunk.payload.toolCallId,
177178
toolName: chunk.payload.toolName,
178179
suspendPayload: chunk.payload.suspendPayload,
180+
resumeSchema: chunk.payload.resumeSchema,
179181
},
180182
} satisfies DataChunkType;
181183
case 'tool-call-input-streaming-start':

0 commit comments

Comments
 (0)