Skip to content

Open-source Grok Bot alternative for named AI teammates. Local-first desktop, web, and mobile clients with per-bot tools, instructions, and memory. Independent fork of T3 Code.

Fix duplicated branch logic and feature-branch dialog on push-only

Julius Marminge61289a152d7c
diff --git a/apps/server/src/git/Layers/GitManager.test.ts b/apps/server/src/git/Layers/GitManager.test.ts
index f94f4ad39..6f0917a0e 100644
--- a/apps/server/src/git/Layers/GitManager.test.ts
+++ b/apps/server/src/git/Layers/GitManager.test.ts
@@ -563,6 +563,14 @@ it.layer(GitManagerTestLayer)("GitManager", (it) => {
Effect.map((result) => result.stdout.trim()),
),
).toBe("feature/implement-stacked-git-actions");
+
+ const mainSha = yield* runGit(repoDir, ["rev-parse", "main"]).pipe(
+ Effect.map((r) => r.stdout.trim()),
+ );
+ const mergeBase = yield* runGit(repoDir, ["merge-base", "main", "HEAD"]).pipe(
+ Effect.map((r) => r.stdout.trim()),
+ );
+ expect(mergeBase).toBe(mainSha);
}),
);
@@ -598,6 +606,14 @@ it.layer(GitManagerTestLayer)("GitManager", (it) => {
expect(result.commit.status).toBe("created");
expect(result.commit.subject).toBe("feat: custom summary line");
expect(generatedCount).toBe(0);
+
+ const mainSha = yield* runGit(repoDir, ["rev-parse", "main"]).pipe(
+ Effect.map((r) => r.stdout.trim()),
+ );
+ const mergeBase = yield* runGit(repoDir, ["merge-base", "main", result.branch.name!]).pipe(
+ Effect.map((r) => r.stdout.trim()),
+ );
+ expect(mergeBase).toBe(mainSha);
}),
);
diff --git a/apps/web/src/components/GitActionsControl.tsx b/apps/web/src/components/GitActionsControl.tsx
index 5ecae7ecf..04c03a149 100644
--- a/apps/web/src/components/GitActionsControl.tsx
+++ b/apps/web/src/components/GitActionsControl.tsx
@@ -254,7 +254,8 @@ export default function GitActionsControl({ gitCwd, activeThreadId }: GitActions
!skipDefaultBranchPrompt &&
!featureBranch &&
requiresDefaultBranchConfirmation(action, actionIsDefaultBranch) &&
- actionBranch
+ actionBranch &&
+ !!actionStatus?.hasWorkingTreeChanges
) {
if (action !== "commit_push" && action !== "commit_push_pr") {
return;
diff --git a/packages/shared/src/git.ts b/packages/shared/src/git.ts
index ff4c8469d..113112cd5 100644
--- a/packages/shared/src/git.ts
+++ b/packages/shared/src/git.ts
@@ -43,14 +43,9 @@ export function resolveAutoFeatureBranchName(
preferredBranch?: string,
): string {
const preferred = preferredBranch?.trim();
- const normalized = sanitizeBranchFragment(
+ const resolvedBase = sanitizeFeatureBranchName(
preferred && preferred.length > 0 ? preferred : AUTO_FEATURE_BRANCH_FALLBACK,
);
- const resolvedBase = normalized.includes("/")
- ? normalized.startsWith("feature/")
- ? normalized
- : `feature/${normalized}`
- : `feature/${normalized}`;
const existingNames = new Set(existingBranchNames);
if (!existingNames.has(resolvedBase)) {