diff --git a/frontend/__tests__/components/features/microagent-management/microagent-management.test.tsx b/frontend/__tests__/components/features/microagent-management/microagent-management.test.tsx
index d0b4df9e54..ecbb078b47 100644
--- a/frontend/__tests__/components/features/microagent-management/microagent-management.test.tsx
+++ b/frontend/__tests__/components/features/microagent-management/microagent-management.test.tsx
@@ -2545,64 +2545,6 @@ describe("MicroagentManagement", () => {
screen.queryByTestId("learn-this-repo-trigger"),
).not.toBeInTheDocument();
});
-
- it("should handle API call for branches when learn this repo modal opens", async () => {
- // Mock branch API
- const branchesSpy = vi
- .spyOn(OpenHands, "getRepositoryBranches")
- .mockResolvedValue({
- branches: [
- { name: "main", commit_sha: "abc123", protected: false },
- { name: "develop", commit_sha: "def456", protected: false },
- ],
- has_next_page: false,
- current_page: 1,
- per_page: 30,
- total_count: 2,
- });
-
- // Mock other APIs
- const getRepositoryMicroagentsSpy = vi.spyOn(
- OpenHands,
- "getRepositoryMicroagents",
- );
- const searchConversationsSpy = vi.spyOn(OpenHands, "searchConversations");
- getRepositoryMicroagentsSpy.mockResolvedValue([]);
- searchConversationsSpy.mockResolvedValue([]);
-
- // Test with direct Redux state that has modal visible
- renderWithProviders(, {
- preloadedState: {
- metrics: {
- cost: null,
- max_budget_per_task: null,
- usage: null,
- },
- microagentManagement: {
- selectedMicroagentItem: null,
- addMicroagentModalVisible: false,
- updateMicroagentModalVisible: false,
- learnThisRepoModalVisible: true, // Modal should be visible
- selectedRepository: {
- id: "1",
- full_name: "test-org/test-repo",
- git_provider: "github",
- is_public: true,
- owner_type: "user",
- pushed_at: "2021-10-01T12:00:00Z",
- },
- personalRepositories: [],
- organizationRepositories: [],
- repositories: [],
- },
- },
- });
-
- // The branches API should be called when the modal is visible
- await waitFor(() => {
- expect(branchesSpy).toHaveBeenCalledWith("test-org/test-repo");
- });
- });
});
// Learn something new button functionality tests
diff --git a/frontend/src/components/features/microagent-management/microagent-management-content.tsx b/frontend/src/components/features/microagent-management/microagent-management-content.tsx
index 315e7b9e67..7d75792a2c 100644
--- a/frontend/src/components/features/microagent-management/microagent-management-content.tsx
+++ b/frontend/src/components/features/microagent-management/microagent-management-content.tsx
@@ -288,7 +288,6 @@ export function MicroagentManagementContent() {
conversationInstructions: formData.query,
repository: {
name: repositoryName,
- branch: formData.selectedBranch,
gitProvider,
},
createMicroagent,
diff --git a/frontend/src/components/features/microagent-management/microagent-management-learn-this-repo-modal.tsx b/frontend/src/components/features/microagent-management/microagent-management-learn-this-repo-modal.tsx
index afa5ac0ac6..af35a976a4 100644
--- a/frontend/src/components/features/microagent-management/microagent-management-learn-this-repo-modal.tsx
+++ b/frontend/src/components/features/microagent-management/microagent-management-learn-this-repo-modal.tsx
@@ -1,4 +1,4 @@
-import { useEffect, useRef, useState } from "react";
+import { useState } from "react";
import { useTranslation } from "react-i18next";
import { useSelector } from "react-redux";
import { FaCircleInfo } from "react-icons/fa6";
@@ -10,13 +10,6 @@ import { RootState } from "#/store";
import XIcon from "#/icons/x.svg?react";
import { cn, getRepoMdCreatePrompt } from "#/utils/utils";
import { LearnThisRepoFormData } from "#/types/microagent-management";
-import { Branch } from "#/types/git";
-import { useRepositoryBranches } from "#/hooks/query/use-repository-branches";
-import {
- BranchDropdown,
- BranchLoadingState,
- BranchErrorState,
-} from "../home/repository-selection";
interface MicroagentManagementLearnThisRepoModalProps {
onConfirm: (formData: LearnThisRepoFormData) => void;
@@ -32,47 +25,11 @@ export function MicroagentManagementLearnThisRepoModal({
const { t } = useTranslation();
const [query, setQuery] = useState("");
- const [selectedBranch, setSelectedBranch] = useState(null);
const { selectedRepository } = useSelector(
(state: RootState) => state.microagentManagement,
);
- // Add a ref to track if the branch was manually cleared by the user
- const branchManuallyClearedRef = useRef(false);
-
- const {
- data: branches,
- isLoading: isLoadingBranches,
- isError: isBranchesError,
- } = useRepositoryBranches(selectedRepository?.full_name || null);
-
- const branchesItems = branches?.map((branch) => ({
- key: branch.name,
- label: branch.name,
- }));
-
- // Auto-select main or master branch if it exists.
- useEffect(() => {
- if (
- branches &&
- branches.length > 0 &&
- !selectedBranch &&
- !isLoadingBranches
- ) {
- // Look for main or master branch
- const mainBranch = branches.find((branch) => branch.name === "main");
- const masterBranch = branches.find((branch) => branch.name === "master");
-
- // Select main if it exists, otherwise select master if it exists
- if (mainBranch) {
- setSelectedBranch(mainBranch);
- } else if (masterBranch) {
- setSelectedBranch(masterBranch);
- }
- }
- }, [branches, isLoadingBranches, selectedBranch]);
-
const onSubmit = (event: React.FormEvent) => {
event.preventDefault();
@@ -83,7 +40,6 @@ export function MicroagentManagementLearnThisRepoModal({
onConfirm({
query: finalQuery,
- selectedBranch: selectedBranch?.name || "",
});
};
@@ -95,66 +51,9 @@ export function MicroagentManagementLearnThisRepoModal({
onConfirm({
query: finalQuery,
- selectedBranch: selectedBranch?.name || "",
});
};
- const handleBranchSelection = (key: React.Key | null) => {
- const selectedBranchObj = branches?.find((branch) => branch.name === key);
- setSelectedBranch(selectedBranchObj || null);
- // Reset the manually cleared flag when a branch is explicitly selected
- branchManuallyClearedRef.current = false;
- };
-
- const handleBranchInputChange = (value: string) => {
- // Clear the selected branch if the input is empty or contains only whitespace
- // This fixes the issue where users can't delete the entire default branch name
- if (value === "" || value.trim() === "") {
- setSelectedBranch(null);
- // Set the flag to indicate that the branch was manually cleared
- branchManuallyClearedRef.current = true;
- } else {
- // Reset the flag when the user starts typing again
- branchManuallyClearedRef.current = false;
- }
- };
-
- // Render the appropriate UI for branch selector based on the loading/error state
- const renderBranchSelector = () => {
- if (!selectedRepository) {
- return (
- {}}
- onInputChange={() => {}}
- isDisabled
- wrapperClassName="max-w-full w-full"
- label={t(I18nKey.REPOSITORY$SELECT_BRANCH)}
- />
- );
- }
-
- if (isLoadingBranches) {
- return ;
- }
-
- if (isBranchesError) {
- return ;
- }
-
- return (
-
- );
- };
-
return (
-
- {renderBranchSelector()}
-
diff --git a/frontend/src/i18n/translation.json b/frontend/src/i18n/translation.json
index 675f36c56e..584d3dfc1a 100644
--- a/frontend/src/i18n/translation.json
+++ b/frontend/src/i18n/translation.json
@@ -11984,20 +11984,20 @@
"uk": "Бажаєте, щоб OpenHands розпочав нову розмову, щоб допомогти вам зрозуміти цей репозиторій?"
},
"MICROAGENT_MANAGEMENT$WHAT_YOU_WOULD_LIKE_TO_KNOW_ABOUT_THIS_REPO": {
- "en": "What would you like to know about this repository?",
- "ja": "このリポジトリについて何を知りたいですか?",
- "zh-CN": "您想了解此存储库的哪些内容?",
- "zh-TW": "您想了解此存儲庫的哪些內容?",
- "ko-KR": "이 저장소에 대해 무엇을 알고 싶으신가요?",
- "no": "Hva vil du vite om dette depotet?",
- "it": "Cosa vorresti sapere su questo repository?",
- "pt": "O que você gostaria de saber sobre este repositório?",
- "es": "¿Qué te gustaría saber sobre este repositorio?",
- "ar": "ماذا تريد أن تعرف عن هذا المستودع؟",
- "fr": "Que souhaitez-vous savoir sur ce dépôt ?",
- "tr": "Bu depo hakkında ne bilmek istersiniz?",
- "de": "Was möchten Sie über dieses Repository wissen?",
- "uk": "Що ви хотіли б дізнатися про цей репозиторій?"
+ "en": "What would you like to know about this repository? (optional)",
+ "ja": "このリポジトリについて知りたいことは何ですか?(任意)",
+ "zh-CN": "您想了解此存储库的哪些内容?(可选)",
+ "zh-TW": "您想了解此存儲庫的哪些內容?(選填)",
+ "ko-KR": "이 저장소에 대해 무엇을 알고 싶으신가요? (선택 사항)",
+ "no": "Hva vil du vite om dette depotet? (valgfritt)",
+ "it": "Cosa vorresti sapere su questo repository? (opzionale)",
+ "pt": "O que você gostaria de saber sobre este repositório? (opcional)",
+ "es": "¿Qué te gustaría saber sobre este repositorio? (opcional)",
+ "ar": "ماذا ترغب في معرفته عن هذا المستودع؟ (اختياري)",
+ "fr": "Que souhaitez-vous savoir sur ce dépôt ? (facultatif)",
+ "tr": "Bu depo hakkında ne bilmek istersiniz? (isteğe bağlı)",
+ "de": "Was möchten Sie über dieses Repository wissen? (optional)",
+ "uk": "Що ви хотіли б дізнатися про цей репозиторій? (необов'язково)"
},
"MICROAGENT_MANAGEMENT$DESCRIBE_WHAT_TO_KNOW_ABOUT_THIS_REPO": {
"en": "Describe what you would like to know about this repository.",
diff --git a/frontend/src/types/microagent-management.tsx b/frontend/src/types/microagent-management.tsx
index 1d68b7416f..07952a8182 100644
--- a/frontend/src/types/microagent-management.tsx
+++ b/frontend/src/types/microagent-management.tsx
@@ -22,5 +22,4 @@ export interface MicroagentFormData {
export interface LearnThisRepoFormData {
query: string;
- selectedBranch: string;
}