t3code icon indicating copy to clipboard operation
t3code copied to clipboard

[Bug]: Clean default-branch Push offers feature-branch checkout that fails with no changes to commit

Open moshemiz06 opened this issue 1 month ago • 1 comments

Before submitting

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

Area

apps/web and apps/server

Steps to reproduce

  1. Open a project on its default branch, main, with an origin remote and at least one local commit to push. Leave the working tree clean. This can happen when an agent has already committed its changes, or after new-project publication failed after creating the remote.
  2. Click the primary Push action.
  3. In the default-branch confirmation, select Check out feature branch & continue.
  4. The action fails before pushing: Cannot create a feature branch because there are no changes to commit.

Expected behavior

The confirmation should offer an action the backend can complete. If automatic feature-branch creation needs uncommitted changes, that option should be disabled or omitted with a clear explanation for a clean working tree. Continuing a push on the current branch should remain available.

Actual behavior

The confirmation offers feature-branch checkout even when there is nothing to commit, then reports a Git manager error. This is confusing when the project already contains the commits the user is trying to publish.

The source for the installed release explains the path:

  • GitActionsControl.logic.ts:304 returns a button labeled Push with action commit_push for a clean default branch with local commits to push. The corresponding upstream-present path does the same.
  • GitActionsControl.tsx:2143 disables Check out feature branch & continue only according to branch-change permissions, without checking for working-tree changes.
  • GitActionsControl.tsx:1433 submits that action with featureBranch: true.
  • GitManager.ts:2819 requires a commit/branch suggestion from working-tree changes and returns the observed error when there are none.

The confirmation needs to account for the backend's feature-branch preconditions before offering this action.

Impact

Minor bug or occasional failure. An offered action fails deterministically for already-committed changes, making first-time publishing harder to understand.

Version or commit

0.0.46-nightly.20261011.2994, release commit d07a07f33c0a1b317dea6234636976231c3688b5.

Environment

Ubuntu 26.04.1 LTS, x86_64; Git 2.53.0; headless t3 serve; default branch main; clean working tree with two commits and no upstream at the time of failure.

Logs or stack traces

Server trace entry from 2026-10-12 at 16:00:42 UTC:

GitManagerError: Git manager failed in runFeatureBranchStep: Cannot create a feature branch because there are no changes to commit.
    at runFeatureBranchStep
    at runStackedAction.runAction
    at ws.rpc.git.runStackedAction

The affected project was clean and contained an initial commit plus an application commit. The reported error and path are confirmed in its server trace and the installed release's source. I did not repeat the UI interaction during investigation; the collaborative preview could not launch because of this host's browser sandbox configuration.

Workaround

Push the existing commits on the current branch without requesting automatic feature-branch creation. On this machine, git push --set-upstream origin main succeeded after separately correcting the remote's SSH/HTTPS mismatch. Local HEAD and remote main matched afterward.

moshemiz06 avatar Oct 12 '26 16:10 moshemiz06

[!NOTE] Grok responding on behalf of Julius.

Confirmed on main, and it's a real bug. On a clean default branch with local commits, Push maps to commit_push. The default-branch confirmation disables Check out feature branch & continue only through canChangeThreadBranch (GitActionsControl.tsx), and it never checks for working-tree changes. Then GitManager.runFeatureBranchStep needs a branch suggestion built from uncommitted changes, so it always throws Cannot create a feature branch because there are no changes to commit. The dialog is offering an action that can't succeed.

Workaround: pick the continue-on-current-branch option, or create the branch yourself (git switch -c my-branch) and then push.

A fix should either disable or hide the feature-branch option when the tree is clean, or let the server create the branch from HEAD when there's nothing to commit.

Related, not duplicates: #13831 / #16907 (the confirmation copy changes while the dialog closes).

juliusmarminge avatar Oct 12 '26 16:10 juliusmarminge