Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions src/core/task/Task.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2252,6 +2252,22 @@ export class Task extends EventEmitter<TaskEvents> implements TaskLike {
// Note: updateApiReqMsg() is now called from within drainStreamInBackgroundToFindAllUsage
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this comment block associated with the await this.persistGpt5Metadata(reasoningMessage) section below the new code? (Or if not what?)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good question... kind of feels like the model just left an irrelevant comment at some point

// 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()
Expand Down