fix: await updateClineMessage calls to prevent duplicate reasoning blocks

- Add await to all updateClineMessage calls in Task.ts
- Fixes race condition where reasoning blocks were rendered multiple times
- Ensures message updates complete before proceeding with next update
This commit is contained in:
Daniel Riccio 2025-06-19 12:59:24 -05:00
parent a879f247f3
commit 639cb78e1d

View file

@ -450,7 +450,7 @@ export class Task extends EventEmitter<ClineEvents> {
// data or one whole message at a time so ignore partial for
// saves, and only post parts of partial message instead of
// whole array in new listener.
this.updateClineMessage(lastMessage)
await this.updateClineMessage(lastMessage)
throw new Error("Current ask promise was ignored (#1)")
} else {
// This is a new partial message, so add it with partial
@ -486,7 +486,7 @@ export class Task extends EventEmitter<ClineEvents> {
lastMessage.progressStatus = progressStatus
lastMessage.isProtected = isProtected
await this.saveClineMessages()
this.updateClineMessage(lastMessage)
await this.updateClineMessage(lastMessage)
} else {
// This is a new and complete message, so add it like normal.
this.askResponse = undefined
@ -636,7 +636,7 @@ export class Task extends EventEmitter<ClineEvents> {
lastMessage.images = images
lastMessage.partial = partial
lastMessage.progressStatus = progressStatus
this.updateClineMessage(lastMessage)
await this.updateClineMessage(lastMessage)
} else {
// This is a new partial message, so add it with partial state.
const sayTs = Date.now()
@ -674,7 +674,7 @@ export class Task extends EventEmitter<ClineEvents> {
await this.saveClineMessages()
// More performant than an entire `postStateToWebview`.
this.updateClineMessage(lastMessage)
await this.updateClineMessage(lastMessage)
} else {
// This is a new and complete message, so add it like normal.
const sayTs = Date.now()