From 81eabe2f7b436dafb24a20d19ae9fd1724032fb6 Mon Sep 17 00:00:00 2001 From: Cursor Agent Date: Wed, 1 Apr 2026 22:50:19 +0000 Subject: [PATCH] Fix default branch confirmation dialog for push and create_pr menu actions The menu's push and create_pr actions bypassed the default branch confirmation dialog because requiresDefaultBranchConfirmation only checked for commit_push and commit_push_pr. Extend the check to also cover the split push and create_pr actions, and update the action guard and dialog copy resolver to handle them. Applied via @cursor push command --- .../components/GitActionsControl.logic.test.ts | 3 +++ .../web/src/components/GitActionsControl.logic.ts | 15 ++++++++++++--- apps/web/src/components/GitActionsControl.tsx | 7 ++++++- 3 files changed, 21 insertions(+), 4 deletions(-) diff --git a/apps/web/src/components/GitActionsControl.logic.test.ts b/apps/web/src/components/GitActionsControl.logic.test.ts index 4bd8109b07..f21c924c79 100644 --- a/apps/web/src/components/GitActionsControl.logic.test.ts +++ b/apps/web/src/components/GitActionsControl.logic.test.ts @@ -802,9 +802,12 @@ describe("when: branch has no upstream configured", () => { describe("requiresDefaultBranchConfirmation", () => { it("requires confirmation for push actions on default branch", () => { assert.isFalse(requiresDefaultBranchConfirmation("commit", true)); + assert.isTrue(requiresDefaultBranchConfirmation("push", true)); + assert.isTrue(requiresDefaultBranchConfirmation("create_pr", true)); assert.isTrue(requiresDefaultBranchConfirmation("commit_push", true)); assert.isTrue(requiresDefaultBranchConfirmation("commit_push_pr", true)); assert.isFalse(requiresDefaultBranchConfirmation("commit_push", false)); + assert.isFalse(requiresDefaultBranchConfirmation("push", false)); }); }); diff --git a/apps/web/src/components/GitActionsControl.logic.ts b/apps/web/src/components/GitActionsControl.logic.ts index e6d6638d45..80906a982b 100644 --- a/apps/web/src/components/GitActionsControl.logic.ts +++ b/apps/web/src/components/GitActionsControl.logic.ts @@ -31,7 +31,11 @@ export interface DefaultBranchActionDialogCopy { continueLabel: string; } -export type DefaultBranchConfirmableAction = "commit_push" | "commit_push_pr"; +export type DefaultBranchConfirmableAction = + | "push" + | "create_pr" + | "commit_push" + | "commit_push_pr"; export function buildGitActionProgressStages(input: { action: GitStackedAction; @@ -272,7 +276,12 @@ export function requiresDefaultBranchConfirmation( isDefaultBranch: boolean, ): boolean { if (!isDefaultBranch) return false; - return action === "commit_push" || action === "commit_push_pr"; + return ( + action === "push" || + action === "create_pr" || + action === "commit_push" || + action === "commit_push_pr" + ); } export function resolveDefaultBranchActionDialogCopy(input: { @@ -283,7 +292,7 @@ export function resolveDefaultBranchActionDialogCopy(input: { const branchLabel = input.branchName; const suffix = ` on "${branchLabel}". You can continue on this branch or create a feature branch and run the same action there.`; - if (input.action === "commit_push") { + if (input.action === "push" || input.action === "commit_push") { if (input.includesCommit) { return { title: "Commit & push to default branch?", diff --git a/apps/web/src/components/GitActionsControl.tsx b/apps/web/src/components/GitActionsControl.tsx index 3e788be2de..d8d86dd4f0 100644 --- a/apps/web/src/components/GitActionsControl.tsx +++ b/apps/web/src/components/GitActionsControl.tsx @@ -425,7 +425,12 @@ export default function GitActionsControl({ gitCwd, activeThreadId }: GitActions requiresDefaultBranchConfirmation(action, actionIsDefaultBranch) && actionBranch ) { - if (action !== "commit_push" && action !== "commit_push_pr") { + if ( + action !== "push" && + action !== "create_pr" && + action !== "commit_push" && + action !== "commit_push_pr" + ) { return; } setPendingDefaultBranchAction({