Compare commits

...
Author SHA1 Message Date
pashpashpash 3d9d823b0f changeset 2025-03-28 16:45:43 -07:00
pashpashpash 66e2c22aef added telemetry to track diff edit failures 2025-03-28 16:44:49 -07:00
3 changed files with 32 additions and 0 deletions
+5
View File
@@ -0,0 +1,5 @@
---
"claude-dev": minor
---
added telemetry to track replace_in_file tool failures
+10
View File
@@ -1748,6 +1748,16 @@ export class Cline {
)
} catch (error) {
await this.say("diff_error", relPath)
// Extract error type from error message if possible, or use a generic type
const errorType =
error instanceof Error && error.message.includes("does not match anything")
? "search_not_found"
: "other_diff_error"
// Add telemetry for diff edit failure
telemetryService.captureDiffEditFailure(this.taskId, errorType)
pushToolResult(
formatResponse.toolError(
`${(error as Error)?.message}\n\n` +
@@ -32,6 +32,8 @@ class PostHogClient {
HISTORICAL_LOADED: "task.historical_loaded",
// Tracks when the retry button is clicked for failed operations
RETRY_CLICKED: "task.retry_clicked",
// Tracks when a diff edit (replace_in_file) operation fails
DIFF_EDIT_FAILED: "task.diff_edit_failed",
},
// UI interaction events for tracking user engagement
UI: {
@@ -377,6 +379,21 @@ class PostHogClient {
})
}
/**
* Records when a diff edit (replace_in_file) operation fails
* @param taskId Unique identifier for the task
* @param errorType Type of error that occurred (e.g., "search_not_found", "invalid_format")
*/
public captureDiffEditFailure(taskId: string, errorType?: string) {
this.capture({
event: PostHogClient.EVENTS.TASK.DIFF_EDIT_FAILED,
properties: {
taskId,
errorType,
},
})
}
/**
* Records when a different model is selected for use
* @param model Name of the selected model