Skip to content

[Bug]: Confirming Push on the default branch commits and pushes files that changed while the dialog was open #41823

Done

Description

@juliusmarminge

Before submitting

  • I searched existing issues and did not find a duplicate.
  • I included enough detail to reproduce or investigate the problem.

Area

apps/web

What happens

On the default branch with a clean working tree and local commits to push, the Git quick action is labelled Push and opens the "Push to default ref?" confirmation, which says it will push local commits. If files in the checkout change while that dialog is open (an agent turn or an editor writes a file), confirming also commits those changes with a generated message and pushes that commit to the default branch.

Steps to reproduce

  1. Open a project whose checkout is on its default branch (for example main) with an upstream, a clean working tree, and one local commit that is not pushed.
  2. Click the Git quick action, which reads Push. The dialog "Push to default ref?" opens.
  3. Leave the dialog open and change a file in the checkout, for example echo test >> README.md in a terminal, or let a running agent turn edit a file.
  4. Click Push to main.

I have not run this; the steps follow the code on main.

Expected behavior

Only the commits that existed when the dialog opened are pushed. The changed file stays uncommitted.

Actual behavior

A new commit containing every change in the working tree is created and pushed to the default branch, although the dialog only mentioned pushing.

Impact

Unreviewed changes are committed and published to the default branch.

Version or commit

main @ 6ac6817

Environment

Web and desktop.

Where

  • GitActionsControl.logic.ts: resolveQuickAction returns the label "Push" with action commit_push on the default branch, in the clean-tree branch and again in the isAhead branch.
  • GitActionsControl.tsx: runGitActionWithToast works out includesCommit once, when the dialog opens; continuePendingDefaultBranchAction then sends the stored commit_push with no file list and no new status check.
  • GitManager.ts: runStackedAction reads the status again when it runs and commits whatever is there.

Related: #18702, which is about the same clean default-branch Push.

Likely fix: send push when the confirmation was shown as push-only.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions