From c1f54213dd48ff8daf4bf3c3d2b53be7716bbfe7 Mon Sep 17 00:00:00 2001 From: Rafael Audibert <32079912+rafaeelaudibert@users.noreply.github.com> Date: Tue, 9 Jun 2026 12:00:52 -0700 Subject: [PATCH] fix(inbox): don't auto-redirect after creating PR task from report Creating a PR task from the inbox report detail pane no longer navigates away to the task detail page. The task is still added to the sidebar via invalidateTasks, and the success toast now surfaces a "View task" action that opens the task on demand. Generated-By: PostHog Code Task-Id: 1293530d-3f17-4a5e-9427-f8abae1842c8 --- .../features/inbox/hooks/useCreatePrReport.ts | 24 ++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) 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",