You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Bug]: Confirming Push on the default branch commits and pushes files that changed while the dialog was open #41823
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
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.
Click the Git quick action, which reads Push. The dialog "Push to default ref?" opens.
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.
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.
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.
Activity