diff --git a/apps/code/src/renderer/features/inbox/hooks/useCreatePrReport.ts b/apps/code/src/renderer/features/inbox/hooks/useCreatePrReport.ts index 4f7588d21..17e6ee4f7 100644 --- a/apps/code/src/renderer/features/inbox/hooks/useCreatePrReport.ts +++ b/apps/code/src/renderer/features/inbox/hooks/useCreatePrReport.ts @@ -30,7 +30,11 @@ interface UseCreatePrReportOptions { } interface UseCreatePrReportReturn { - /** Create an auto-mode implementation task for the report and navigate to it on success. */ + /** + * Create an auto-mode implementation task for the report. Adds the task to + * the sidebar and surfaces a success toast with a "View task" action instead + * of navigating away. + */ createPrReport: () => Promise; /** True while the task is being created. */ isCreatingPr: boolean; @@ -40,7 +44,8 @@ interface UseCreatePrReportReturn { * Create an implementation (PR) task directly from the inbox detail pane. * * Mirrors the Discuss flow: bypasses TaskInput so the user stays on the inbox - * until the task is ready, then jumps straight to the task detail page. The + * until the task is ready. The task is added to the sidebar and a success toast + * offers a "View task" action to jump to the task detail page on demand. The * agent gets a short prompt that points it at the inbox MCP tools instead of * inlining the entire report summary. */ @@ -127,13 +132,26 @@ export function useCreatePrReport({ try { const taskService = get(RENDERER_TOKENS.TaskService); + let createdTask: Parameters[0] | null = null; const result = await taskService.createTask(input, (output) => { + createdTask = output.task; invalidateTasks(output.task); - void openTask(output.task); }); if (result.success) { sonnerToast.dismiss(toastId); + const task = createdTask; + toast.success("PR task started", { + description: reportTitle ?? undefined, + action: task + ? { + label: "View task", + onClick: () => { + void openTask(task); + }, + } + : undefined, + }); track(ANALYTICS_EVENTS.TASK_CREATED, { auto_run: true, created_from: "command-menu",