Skip to content

Commit cb32a92

Browse files
feat(bot): add details_url to Devin check for direct session link (#2041)
Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
1 parent ca03742 commit cb32a92

File tree

3 files changed

+79
-28
lines changed

3 files changed

+79
-28
lines changed

apps/bot/src/devin/poller.ts

Lines changed: 77 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ export interface OctokitLike {
4747
| "skipped"
4848
| "stale"
4949
| "timed_out";
50+
details_url?: string;
5051
output: { title: string; summary: string };
5152
}) => Promise<unknown>;
5253
update: (params: {
@@ -63,6 +64,7 @@ export interface OctokitLike {
6364
| "skipped"
6465
| "stale"
6566
| "timed_out";
67+
details_url?: string;
6668
output: { title: string; summary: string };
6769
}) => Promise<unknown>;
6870
};
@@ -298,23 +300,41 @@ export class DevinStatusPoller {
298300
try {
299301
const detail = await getDevinSessionDetail(pr.sessionId);
300302
if (detail.status_enum === DevinSessionStatus.Finished) {
301-
await this.updateCheckStatus(pr, "completed", "success", {
302-
title: "Devin finished",
303-
summary: `Devin session ${pr.sessionId} has completed.`,
304-
});
303+
await this.updateCheckStatus(
304+
pr,
305+
"completed",
306+
"success",
307+
{
308+
title: "Devin finished",
309+
summary: `Devin session ${pr.sessionId} has completed.`,
310+
},
311+
pr.sessionId,
312+
);
305313
} else if (detail.status_enum === DevinSessionStatus.Expired) {
306-
await this.updateCheckStatus(pr, "completed", "cancelled", {
307-
title: "Devin session expired",
308-
summary: `Devin session ${pr.sessionId} has expired.`,
309-
});
314+
await this.updateCheckStatus(
315+
pr,
316+
"completed",
317+
"cancelled",
318+
{
319+
title: "Devin session expired",
320+
summary: `Devin session ${pr.sessionId} has expired.`,
321+
},
322+
pr.sessionId,
323+
);
310324
} else {
311325
this.logger.info(
312326
`Session ${pr.sessionId} no longer running but status is ${detail.status_enum}`,
313327
);
314-
await this.updateCheckStatus(pr, "completed", "neutral", {
315-
title: "Devin session ended",
316-
summary: `Devin session ${pr.sessionId} ended with status: ${detail.status_enum}`,
317-
});
328+
await this.updateCheckStatus(
329+
pr,
330+
"completed",
331+
"neutral",
332+
{
333+
title: "Devin session ended",
334+
summary: `Devin session ${pr.sessionId} ended with status: ${detail.status_enum}`,
335+
},
336+
pr.sessionId,
337+
);
318338
}
319339
this.untrackPR(pr.prUrl);
320340
} catch (error) {
@@ -328,35 +348,59 @@ export class DevinStatusPoller {
328348
const detail = await getDevinSessionDetail(session.session_id);
329349

330350
if (detail.status_enum === DevinSessionStatus.Working) {
331-
await this.updateCheckStatus(pr, "in_progress", undefined, {
332-
title: "Devin is working",
333-
summary: `Devin session ${session.session_id} is currently working on this PR.`,
334-
});
351+
await this.updateCheckStatus(
352+
pr,
353+
"in_progress",
354+
undefined,
355+
{
356+
title: "Devin is working",
357+
summary: `Devin session ${session.session_id} is currently working on this PR.`,
358+
},
359+
session.session_id,
360+
);
335361
return;
336362
}
337363

338364
if (detail.status_enum === DevinSessionStatus.Blocked) {
339-
await this.updateCheckStatus(pr, "in_progress", undefined, {
340-
title: "Devin is blocked",
341-
summary: `Devin session ${session.session_id} is blocked and waiting for input.`,
342-
});
365+
await this.updateCheckStatus(
366+
pr,
367+
"in_progress",
368+
undefined,
369+
{
370+
title: "Devin is blocked",
371+
summary: `Devin session ${session.session_id} is blocked and waiting for input.`,
372+
},
373+
session.session_id,
374+
);
343375
return;
344376
}
345377

346378
if (detail.status_enum === DevinSessionStatus.Finished) {
347-
await this.updateCheckStatus(pr, "completed", "success", {
348-
title: "Devin finished",
349-
summary: `Devin session ${session.session_id} has completed.`,
350-
});
379+
await this.updateCheckStatus(
380+
pr,
381+
"completed",
382+
"success",
383+
{
384+
title: "Devin finished",
385+
summary: `Devin session ${session.session_id} has completed.`,
386+
},
387+
session.session_id,
388+
);
351389
this.untrackPR(pr.prUrl);
352390
return;
353391
}
354392

355393
if (detail.status_enum === DevinSessionStatus.Expired) {
356-
await this.updateCheckStatus(pr, "completed", "cancelled", {
357-
title: "Devin session expired",
358-
summary: `Devin session ${session.session_id} has expired.`,
359-
});
394+
await this.updateCheckStatus(
395+
pr,
396+
"completed",
397+
"cancelled",
398+
{
399+
title: "Devin session expired",
400+
summary: `Devin session ${session.session_id} has expired.`,
401+
},
402+
session.session_id,
403+
);
360404
this.untrackPR(pr.prUrl);
361405
return;
362406
}
@@ -380,6 +424,7 @@ export class DevinStatusPoller {
380424
| "timed_out"
381425
| undefined,
382426
output: { title: string; summary: string },
427+
sessionId: string,
383428
): Promise<void> {
384429
try {
385430
const octokit = await this.createOctokit();
@@ -394,13 +439,16 @@ export class DevinStatusPoller {
394439
(check) => check.name === CHECK_NAME,
395440
);
396441

442+
const details_url = `https://app.devin.ai/sessions/${sessionId}`;
443+
397444
if (existingCheck) {
398445
await octokit.checks.update({
399446
owner: pr.owner,
400447
repo: pr.repo,
401448
check_run_id: existingCheck.id,
402449
status,
403450
conclusion: status === "completed" ? conclusion : undefined,
451+
details_url,
404452
output,
405453
});
406454
} else {
@@ -411,6 +459,7 @@ export class DevinStatusPoller {
411459
head_sha: pr.headSha,
412460
status,
413461
conclusion: status === "completed" ? conclusion : undefined,
462+
details_url,
414463
output,
415464
});
416465
}

apps/bot/src/features/devin-status.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ async function checkDevinSession(
8080
name: CHECK_NAME,
8181
head_sha: headSha,
8282
status: "in_progress",
83+
details_url: `https://app.devin.ai/sessions/${session.session_id}`,
8384
output: {
8485
title: "Devin is working",
8586
summary: `Devin session ${session.session_id} is currently working on this PR.`,

apps/bot/src/github/check.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ export async function createOrUpdateCheck(
2525
check_run_id: existingCheck.id,
2626
status: params.status,
2727
conclusion: params.conclusion,
28+
details_url: params.details_url,
2829
output: params.output,
2930
});
3031
} else {

0 commit comments

Comments
 (0)