Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 21 additions & 3 deletions apps/code/src/renderer/features/inbox/hooks/useCreatePrReport.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<void>;
/** True while the task is being created. */
isCreatingPr: boolean;
Expand All @@ -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.
*/
Expand Down Expand Up @@ -127,13 +132,26 @@ export function useCreatePrReport({

try {
const taskService = get<TaskService>(RENDERER_TOKENS.TaskService);
let createdTask: Parameters<typeof openTask>[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",
Expand Down
Loading