mirror of
https://github.com/RooVetGit/Roo-Code.git
synced 2026-08-28 05:27:24 +00:00
clean logging
This commit is contained in:
parent
616c4b6f30
commit
2c77f32be6
3 changed files with 2 additions and 84 deletions
|
|
@ -352,23 +352,11 @@ export class Task extends EventEmitter<ClineEvents> {
|
|||
// Cline Messages
|
||||
|
||||
private async getSavedClineMessages(): Promise<ClineMessage[]> {
|
||||
return await readTaskMessages({ taskId: this.taskId, globalStoragePath: this.globalStoragePath })
|
||||
return readTaskMessages({ taskId: this.taskId, globalStoragePath: this.globalStoragePath })
|
||||
}
|
||||
|
||||
private async addToClineMessages(message: ClineMessage) {
|
||||
console.log("[Task#addToClineMessages] Adding message:", JSON.stringify(message, null, 2))
|
||||
this.clineMessages.push(message)
|
||||
|
||||
// Verify the message was added correctly
|
||||
const addedMessage = this.clineMessages[this.clineMessages.length - 1]
|
||||
console.log("[Task#addToClineMessages] Verified added message:", {
|
||||
ts: addedMessage.ts,
|
||||
type: addedMessage.type,
|
||||
say: addedMessage.say,
|
||||
hasCheckpoint: !!addedMessage.checkpoint,
|
||||
checkpoint: addedMessage.checkpoint,
|
||||
})
|
||||
|
||||
const provider = this.providerRef.deref()
|
||||
await provider?.postStateToWebview()
|
||||
this.emit("message", { action: "created", message })
|
||||
|
|
@ -552,10 +540,6 @@ export class Task extends EventEmitter<ClineEvents> {
|
|||
}
|
||||
|
||||
async handleWebviewAskResponse(askResponse: ClineAskResponse, text?: string, images?: string[]) {
|
||||
// Checkpoint saving is now handled in webviewMessageHandler before this method is called
|
||||
console.log("[Task#handleWebviewAskResponse] Processing askResponse:", askResponse)
|
||||
|
||||
// Set the response, which will trigger the ask promise to resolve
|
||||
this.askResponse = askResponse
|
||||
this.askResponseText = text
|
||||
this.askResponseImages = images
|
||||
|
|
@ -877,20 +861,7 @@ export class Task extends EventEmitter<ClineEvents> {
|
|||
let responseText: string | undefined
|
||||
let responseImages: string[] | undefined
|
||||
if (response === "messageResponse") {
|
||||
// The checkpoint was already saved in handleWebviewAskResponse and attached to pendingUserMessageCheckpoint
|
||||
// The say method will automatically handle it for user_feedback messages
|
||||
console.log("[Task#resumeTaskFromHistory] Adding user_feedback message")
|
||||
await this.say("user_feedback", text, images)
|
||||
|
||||
// Verify the message was added with checkpoint
|
||||
const lastMessage = this.clineMessages[this.clineMessages.length - 1]
|
||||
console.log("[Task#resumeTaskFromHistory] Last message after say:", {
|
||||
ts: lastMessage?.ts,
|
||||
say: lastMessage?.say,
|
||||
hasCheckpoint: !!lastMessage?.checkpoint,
|
||||
checkpoint: lastMessage?.checkpoint,
|
||||
})
|
||||
|
||||
responseText = text
|
||||
responseImages = images
|
||||
}
|
||||
|
|
@ -1231,19 +1202,8 @@ export class Task extends EventEmitter<ClineEvents> {
|
|||
],
|
||||
)
|
||||
|
||||
// The say method will automatically handle the pending checkpoint for user_feedback messages
|
||||
console.log("[Task] Tool approval - About to say user_feedback")
|
||||
await this.say("user_feedback", text, images)
|
||||
|
||||
// Verify the message was added with checkpoint
|
||||
const lastMessage = this.clineMessages[this.clineMessages.length - 1]
|
||||
console.log("[Task] Tool approval - Last message after say:", {
|
||||
ts: lastMessage?.ts,
|
||||
say: lastMessage?.say,
|
||||
hasCheckpoint: !!lastMessage?.checkpoint,
|
||||
checkpoint: lastMessage?.checkpoint,
|
||||
})
|
||||
|
||||
// Track consecutive mistake errors in telemetry.
|
||||
TelemetryService.instance.captureConsecutiveMistakeError(this.taskId)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -653,10 +653,6 @@ export class ClineProvider
|
|||
`[subtasks] ${cline.parentTask ? "child" : "parent"} task ${cline.taskId}.${cline.instanceId} instantiated`,
|
||||
)
|
||||
|
||||
// Don't save checkpoint here - it will be saved in handleWebviewAskResponse
|
||||
// when the user message is actually sent. The checkpoint service might not
|
||||
// be initialized yet at this point.
|
||||
|
||||
return cline
|
||||
}
|
||||
|
||||
|
|
@ -1579,16 +1575,7 @@ export class ClineProvider
|
|||
currentTaskItem: this.getCurrentCline()?.taskId
|
||||
? (taskHistory || []).find((item: HistoryItem) => item.id === this.getCurrentCline()?.taskId)
|
||||
: undefined,
|
||||
clineMessages: (() => {
|
||||
const messages = this.getCurrentCline()?.clineMessages || []
|
||||
const messagesWithCheckpoints = messages.filter((m) => m.checkpoint)
|
||||
console.log("[ClineProvider#getStateToPostToWebview] Total messages:", messages.length)
|
||||
console.log(
|
||||
"[ClineProvider#getStateToPostToWebview] Messages with checkpoints:",
|
||||
messagesWithCheckpoints.length,
|
||||
)
|
||||
return messages
|
||||
})(),
|
||||
clineMessages: this.getCurrentCline()?.clineMessages || [],
|
||||
taskHistory: (taskHistory || [])
|
||||
.filter((item: HistoryItem) => item.ts && item.task)
|
||||
.sort((a: HistoryItem, b: HistoryItem) => b.ts - a.ts),
|
||||
|
|
|
|||
|
|
@ -106,20 +106,6 @@ export const webviewMessageHandler = async (
|
|||
const currentCline = provider.getCurrentCline()
|
||||
let hasCheckpoint = false
|
||||
if (currentCline) {
|
||||
// Debug: Log all messages to understand the state
|
||||
console.log("[webviewMessageHandler] Total messages:", currentCline.clineMessages.length)
|
||||
console.log("[webviewMessageHandler] Looking for message with ts:", messageTs)
|
||||
console.log(
|
||||
"[webviewMessageHandler] All messages with timestamps:",
|
||||
currentCline.clineMessages.map((m, idx) => ({
|
||||
index: idx,
|
||||
ts: m.ts,
|
||||
say: m.say,
|
||||
hasCheckpoint: !!m.checkpoint,
|
||||
checkpoint: m.checkpoint,
|
||||
})),
|
||||
)
|
||||
|
||||
const { messageIndex } = findMessageIndices(messageTs, currentCline)
|
||||
if (messageIndex !== -1) {
|
||||
const targetMessage = currentCline.clineMessages[messageIndex]
|
||||
|
|
@ -128,7 +114,6 @@ export const webviewMessageHandler = async (
|
|||
typeof targetMessage.checkpoint === "object" &&
|
||||
"hash" in targetMessage.checkpoint
|
||||
)
|
||||
console.log("[webviewMessageHandler] hasCheckpoint:", hasCheckpoint)
|
||||
} else {
|
||||
console.log("[webviewMessageHandler] Message not found! Looking for ts:", messageTs)
|
||||
}
|
||||
|
|
@ -219,19 +204,6 @@ export const webviewMessageHandler = async (
|
|||
const currentCline = provider.getCurrentCline()
|
||||
let hasCheckpoint = false
|
||||
if (currentCline) {
|
||||
console.log(
|
||||
"[webviewMessageHandler] Edit - Total messages in currentCline:",
|
||||
currentCline.clineMessages.length,
|
||||
)
|
||||
console.log("[webviewMessageHandler] Edit - Looking for messageTs:", messageTs)
|
||||
|
||||
// Log all messages with their timestamps and checkpoint status
|
||||
currentCline.clineMessages.forEach((msg, idx) => {
|
||||
console.log(
|
||||
`[webviewMessageHandler] Edit - Message ${idx}: ts=${msg.ts}, type=${msg.type}, say=${msg.say}, hasCheckpoint=${!!msg.checkpoint}, checkpoint=${JSON.stringify(msg.checkpoint)}`,
|
||||
)
|
||||
})
|
||||
|
||||
const { messageIndex } = findMessageIndices(messageTs, currentCline)
|
||||
if (messageIndex !== -1) {
|
||||
const targetMessage = currentCline.clineMessages[messageIndex]
|
||||
|
|
@ -240,7 +212,6 @@ export const webviewMessageHandler = async (
|
|||
typeof targetMessage.checkpoint === "object" &&
|
||||
"hash" in targetMessage.checkpoint
|
||||
)
|
||||
console.log("[webviewMessageHandler] Edit - hasCheckpoint:", hasCheckpoint)
|
||||
} else {
|
||||
console.log("[webviewMessageHandler] Edit - Message not found in clineMessages!")
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue