Skip to content

armgit / E2B

Public Imported from GitHub
0

Open-source, secure environment with real-world tools for enterprise-grade agents.

Log the run cancel even if we don't add the comment due to merge

Tomas Valentaa008b6db5ea3
diff --git a/pages/api/agent/run.ts b/pages/api/agent/run.ts
index 00de42017..0f993ae71 100644
--- a/pages/api/agent/run.ts
+++ b/pages/api/agent/run.ts
@@ -160,32 +160,32 @@ async function deleteRun(req: NextApiRequest, res: NextApiResponse) {
repo: authData.github.repo,
pullNumber: authData.github.pr_number,
})
+ }
- const users = deployment
- .projects
- .teams
- .users_teams
- .map(u => u.users)
- .flat()
-
- const result = await Promise.allSettled(users.map(async u => {
- posthog?.capture({
- distinctId: u.id,
- event: 'cancelled agent run',
- properties: {
- agent_deployment_id: deployment.id,
- agent: TemplateID.SmolDeveloper,
- repository: `${authData.github.owner}/${authData.github.repo}`,
- run_id,
-
- pr_number: authData.github.pr_number,
- },
- })
- }))
+ const users = deployment
+ .projects
+ .teams
+ .users_teams
+ .map(u => u.users)
+ .flat()
- await posthog?.shutdownAsync()
- console.log('Analytics logged', result)
- }
+ const result = await Promise.allSettled(users.map(async u => {
+ posthog?.capture({
+ distinctId: u.id,
+ event: 'cancelled agent run',
+ properties: {
+ agent_deployment_id: deployment.id,
+ agent: TemplateID.SmolDeveloper,
+ repository: `${authData.github.owner}/${authData.github.repo}`,
+ run_id,
+
+ pr_number: authData.github.pr_number,
+ },
+ })
+ }))
+
+ await posthog?.shutdownAsync()
+ console.log('Analytics logged', result)
res.status(200).json({})
} catch (err: any) {