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
if matches!(
&ctx.execution_process.run_reason,
ExecutionProcessRunReason::CodingAgent
) && let Some(analytics) = &analytics
{
analytics.analytics_service.track_event(&analytics.user_id, "task_attempt_finished", Some(json!({
if let Some(true) = config.read().await.analytics_enabled {
if matches!(
&ctx.execution_process.run_reason,
ExecutionProcessRunReason::CodingAgent
) && let Some(analytics) = &analytics
{
analytics.analytics_service.track_event(&analytics.user_id, "task_attempt_finished", Some(json!({
"task_id": ctx.task.id.to_string(),
"project_id": ctx.task.project_id.to_string(),
"attempt_id": ctx.task_attempt.id.to_string(),
"execution_success": matches!(ctx.execution_process.status, ExecutionProcessStatus::Completed),
"exit_code": ctx.execution_process.exit_code,
})));
}
}
}