File tree Expand file tree Collapse file tree 3 files changed +32
-0
lines changed
Expand file tree Collapse file tree 3 files changed +32
-0
lines changed Original file line number Diff line number Diff line change 1+ ---
2+ " claude-dev " : minor
3+ ---
4+
5+ added telemetry to track replace_in_file tool failures
Original file line number Diff line number Diff line change @@ -1748,6 +1748,16 @@ export class Cline {
17481748 )
17491749 } catch ( error ) {
17501750 await this . say ( "diff_error" , relPath )
1751+
1752+ // Extract error type from error message if possible, or use a generic type
1753+ const errorType =
1754+ error instanceof Error && error . message . includes ( "does not match anything" )
1755+ ? "search_not_found"
1756+ : "other_diff_error"
1757+
1758+ // Add telemetry for diff edit failure
1759+ telemetryService . captureDiffEditFailure ( this . taskId , errorType )
1760+
17511761 pushToolResult (
17521762 formatResponse . toolError (
17531763 `${ ( error as Error ) ?. message } \n\n` +
Original file line number Diff line number Diff line change @@ -32,6 +32,8 @@ class PostHogClient {
3232 HISTORICAL_LOADED : "task.historical_loaded" ,
3333 // Tracks when the retry button is clicked for failed operations
3434 RETRY_CLICKED : "task.retry_clicked" ,
35+ // Tracks when a diff edit (replace_in_file) operation fails
36+ DIFF_EDIT_FAILED : "task.diff_edit_failed" ,
3537 } ,
3638 // UI interaction events for tracking user engagement
3739 UI : {
@@ -377,6 +379,21 @@ class PostHogClient {
377379 } )
378380 }
379381
382+ /**
383+ * Records when a diff edit (replace_in_file) operation fails
384+ * @param taskId Unique identifier for the task
385+ * @param errorType Type of error that occurred (e.g., "search_not_found", "invalid_format")
386+ */
387+ public captureDiffEditFailure ( taskId : string , errorType ?: string ) {
388+ this . capture ( {
389+ event : PostHogClient . EVENTS . TASK . DIFF_EDIT_FAILED ,
390+ properties : {
391+ taskId,
392+ errorType,
393+ } ,
394+ } )
395+ }
396+
380397 /**
381398 * Records when a different model is selected for use
382399 * @param model Name of the selected model
You can’t perform that action at this time.
0 commit comments