File tree Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -2252,6 +2252,22 @@ export class Task extends EventEmitter<TaskEvents> implements TaskLike {
22522252 // Note: updateApiReqMsg() is now called from within drainStreamInBackgroundToFindAllUsage
22532253 // to ensure usage data is captured even when the stream is interrupted. The background task
22542254 // uses local variables to accumulate usage data before atomically updating the shared state.
2255+
2256+ // Complete the reasoning message if it exists
2257+ // We can't use say() here because the reasoning message may not be the last message
2258+ // (other messages like text blocks or tool uses may have been added after it during streaming)
2259+ if ( reasoningMessage ) {
2260+ const lastReasoningIndex = findLastIndex (
2261+ this . clineMessages ,
2262+ ( m ) => m . type === "say" && m . say === "reasoning" ,
2263+ )
2264+
2265+ if ( lastReasoningIndex !== - 1 && this . clineMessages [ lastReasoningIndex ] . partial ) {
2266+ this . clineMessages [ lastReasoningIndex ] . partial = false
2267+ await this . updateClineMessage ( this . clineMessages [ lastReasoningIndex ] )
2268+ }
2269+ }
2270+
22552271 await this . persistGpt5Metadata ( reasoningMessage )
22562272 await this . saveClineMessages ( )
22572273 await this . providerRef . deref ( ) ?. postStateToWebview ( )
You can’t perform that action at this time.
0 commit comments