Include reasoning messages in cloud tasks (#8401)

This commit is contained in:
Matt Rubens 2025-09-30 15:49:30 -04:00 • committed by GitHub
parent e33efc6242
commit c552027960
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -2252,6 +2252,22 @@ export class Task extends EventEmitter<TaskEvents> implements TaskLike {
// Note: updateApiReqMsg() is now called from within drainStreamInBackgroundToFindAllUsage
// to ensure usage data is captured even when the stream is interrupted. The background task
// uses local variables to accumulate usage data before atomically updating the shared state.
// Complete the reasoning message if it exists
// We can't use say() here because the reasoning message may not be the last message
// (other messages like text blocks or tool uses may have been added after it during streaming)
if (reasoningMessage) {
const lastReasoningIndex = findLastIndex(
this.clineMessages,
(m) => m.type === "say" && m.say === "reasoning",
)
if (lastReasoningIndex !== -1 && this.clineMessages[lastReasoningIndex].partial) {
this.clineMessages[lastReasoningIndex].partial = false
await this.updateClineMessage(this.clineMessages[lastReasoningIndex])
}
}
await this.persistGpt5Metadata(reasoningMessage)
await this.saveClineMessages()
await this.providerRef.deref()?.postStateToWebview()