From 32489ff6172e236720b15ad93f5c24d2c241f69a Mon Sep 17 00:00:00 2001 From: Stephane Delcroix Date: Wed, 18 Mar 2026 10:48:25 +0100 Subject: [PATCH] Fix inconsistent repo picker: use dropdown in both new session and new multi-agent flows The 'New Session' form (CreateSessionForm.razor) used a dropdown, matching the CreateSessionForm pattern - Add placeholder option ('Pick a repo') for the dropdown - Show ns-repo-label when there's only 1 repo (matches single-repo behavior) - Auto-advance to Step 2 (preset picker) when there's exactly 1 repo - Add OnMultiAgentRepoChanged handler for the dropdown's onchange event Tests: - Add RepoPickerConsistencyTests.cs with 8 tests verifying both forms use the same for repo picking ──────────────────────────── + + [Fact] + public void CreateSessionForm_UsesSelectDropdownForRepos() + { + var content = File.ReadAllText(CreateSessionFormPath); + // The "new session" form uses (not button list) + Assert.Contains("ns-repo-select", content); + // Verify the select is within the multi-agent repo picker section + Assert.Contains("OnMultiAgentRepoChanged", content); + Assert.Matches(new Regex(@"]*class=""ns-repo-select""[^>]*@onchange=""OnMultiAgentRepoChanged"""), content); + } + + [Fact] + public void SessionSidebar_MultiAgent_DoesNotUseButtonListForRepos() + { + var content = File.ReadAllText(SessionSidebarPath); + // The old pattern used - @foreach (var repo in RepoManager.Repositories) + @if (RepoManager.Repositories.Count > 1) { - var r = repo; - + } - @if (!RepoManager.Repositories.Any()) + else if (RepoManager.Repositories.Count == 1) + { +
📦 @RepoManager.Repositories[0].Name
+ } + else {
No repositories available. Add a repository first.
} @@ -1970,6 +1976,10 @@ else isAddingGroup = false; isAddingMultiAgentGroup = true; pendingMultiAgentRepo = null; + + // Auto-advance when there's exactly 1 repo (matches CreateSessionForm behavior) + if (RepoManager.Repositories.Count == 1) + SelectRepoForGroup(RepoManager.Repositories[0]); } private void CancelMultiAgentCreation() @@ -1978,6 +1988,14 @@ else pendingMultiAgentRepo = null; } + private void OnMultiAgentRepoChanged(ChangeEventArgs e) + { + var repoId = e.Value?.ToString(); + if (string.IsNullOrEmpty(repoId)) return; + var repo = RepoManager.Repositories.FirstOrDefault(r => r.Id == repoId); + if (repo != null) SelectRepoForGroup(repo); + } + private void SelectRepoForGroup(RepositoryInfo repo) { // Repo selected — advance to step 2 (presets + custom name)