fix task finished event (#440)

This commit is contained in:
Gabriel Gordon-Hall
2025-08-08 14:09:25 +01:00
committed by GitHub
parent 3ed134d7d5
commit 8fb00cb839

View File

@@ -351,18 +351,20 @@ impl LocalContainerService {
} }
// Fire event when CodingAgent execution has finished // Fire event when CodingAgent execution has finished
if matches!( if let Some(true) = config.read().await.analytics_enabled {
&ctx.execution_process.run_reason, if matches!(
ExecutionProcessRunReason::CodingAgent &ctx.execution_process.run_reason,
) && let Some(analytics) = &analytics ExecutionProcessRunReason::CodingAgent
{ ) && let Some(analytics) = &analytics
analytics.analytics_service.track_event(&analytics.user_id, "task_attempt_finished", Some(json!({ {
analytics.analytics_service.track_event(&analytics.user_id, "task_attempt_finished", Some(json!({
"task_id": ctx.task.id.to_string(), "task_id": ctx.task.id.to_string(),
"project_id": ctx.task.project_id.to_string(), "project_id": ctx.task.project_id.to_string(),
"attempt_id": ctx.task_attempt.id.to_string(), "attempt_id": ctx.task_attempt.id.to_string(),
"execution_success": matches!(ctx.execution_process.status, ExecutionProcessStatus::Completed), "execution_success": matches!(ctx.execution_process.status, ExecutionProcessStatus::Completed),
"exit_code": ctx.execution_process.exit_code, "exit_code": ctx.execution_process.exit_code,
}))); })));
}
} }
} }