Skip to content

🙌 OpenHands: AI-Driven Development

Sidebar nav + conversation list layout overhaul (#170)

Robert Brennan54bf79447113
diff --git a/AGENTS.md b/AGENTS.md
index 0f1fa7598d..60b5536226 100644
--- a/AGENTS.md
+++ b/AGENTS.md
@@ -33,6 +33,8 @@
- Shared TypeScript-client adapters live in `src/api/typescript-client.ts`; prefer those helpers for agent-server-backed REST/workspace/event/VS Code calls before falling back to `open-hands-axios`.
- Local verification/build gotchas:
- `npm run typecheck` assumes generated translation types exist; run `npm run make-i18n` first if `src/i18n/declaration.ts` is missing.
+- Merge note: `main` removed the old project-management integration subcomponents/hooks and their related feature-flag/i18n surface. If a feature branch still keeps the top-level `/integrations` git-token page, retain `src/routes/git-settings.tsx` plus the git-provider token inputs/hooks, but do **not** blindly restore `src/components/features/settings/project-management/*` or the old integration mutation/query hooks unless the corresponding option types and i18n keys are also reintroduced.
+
- The OSS cleanup removed hosted-only auth, org, account, onboarding, and invitation codepaths, routes, and tests. Keep `integrations`, `git-settings`, `secrets`, MCP settings, and other local/self-hosted flows intact when simplifying OSS behavior.
- When merging main into this branch, keep the new agent-server compatibility bootstrap in `src/root.tsx`, but do not reintroduce hosted-only invitation cleanup or marketing CTA chrome in the OSS user menu; the OSS account menu should just render settings links plus Docs.
@@ -80,6 +82,10 @@
2. **localStorage** (`openhands-agent-server-git-provider-tokens`) - for frontend git API calls (repo search, branches, etc.)
The `addGitProvider` method stores to server FIRST (must succeed), then updates localStorage. This ensures server-side persistence is the source of truth.
- Agent server connection settings now live at `Settings > Agent Server` (`/settings/agent-server`). The page reads deployment defaults from `VITE_BACKEND_BASE_URL` / `VITE_SESSION_API_KEY`, saves user overrides in the `openhands-agent-server-config` localStorage key, and must stay reachable even when the backend compatibility probe fails so users can recover from missing or wrong backend configuration.
+- Backend/footer actions that launch modals from inside a dropdown or popover should intercept `onMouseDown` to keep the menu mounted, then perform the actual open on `onClick`. Current examples: `Add backend` / `Manage backends` in `src/components/features/backends/backend-selector.tsx`, plus the mirrored workspace-footer buttons in `src/components/features/conversation-panel/new-conversation-button.tsx`.
+- `BackendSelector`'s cloud-org switch paths should never rethrow from the dropdown `onChange` handler: unexpected non-Axios failures need a generic error toast instead of an unhandled promise rejection, and the malformed `(cloud backend, null org)` self-heal path should fall back to the bundled backend if `/switch` fails.
+- `NewConversationButton` should support keyboard dismissal (`Escape`) for its inline popover, while still keeping the popover open when its modal children (`FolderBrowserModal`, `ManageWorkspacesModal`) are active.
+
- README expectation: keep the first section as a concrete, chronological from-scratch quickstart for running this frontend against a real `openhands-agent-server` (clone, install uv, optional `.env`, run `npm run dev`).
- Keep README user-focused and move contributor/developer-specific workflows (`dev:safe`, mock mode, detailed env vars/build-test notes) into `DEVELOPMENT.md`.
@@ -138,14 +144,14 @@
- `src/components/conversation-events/chat/messages.tsx` is the only consumer; the grouping is transparent to upstream code. Coverage lives in `__tests__/components/conversation-events/chat/group-events.test.ts` (pure logic, including thought hoisting) and `__tests__/components/conversation-events/chat/event-message-components/event-group.test.tsx` (rendering/interaction).
- Home page workspace UX (agent-server backend):
- - `RepoConnector` no longer renders tab UI, but it still must branch on the active backend: local/bundled backends render `WorkspaceSelectionForm`, while cloud backends render the repo path (`RepositorySelectionForm` when git providers exist, otherwise `ConnectToProviderMessage`). Keep `src/routes/home.tsx` passing through the selected repo state so `TaskSuggestions` can still filter on cloud repo picks.
+ - `RepoConnector` no longer renders a tabbed launcher; it just renders `WorkspaceSelectionForm` because this build only ever talks to an agent-server backend (no cloud backend is wired up). The old `LaunchTabs` component was removed; if a cloud backend is ever supported again, branch on backend mode in `RepoConnector` and render `RepositorySelectionForm` for that path.
- `FolderBrowserModal`'s "Use this folder" button adds **only the currently navigated directory** as a single workspace (named by its basename). It no longer iterates `subdirs` and adds each child as a separate workspace.
- The `WorkspaceDropdown` sticky footer now exposes both "+ Add Workspace" (opens the folder browser) and "Manage Workspaces" (opens `ManageWorkspacesModal`, which lets users remove individual workspaces via `useWorkspacesStore.removeWorkspace`). The Manage button is hidden when there are no workspaces yet.
+ - The sidebar "+ New Conversation" trigger (`NewConversationButton` in `src/components/features/conversation-panel/`) opens a popover that is a **flat list**, not the home-screen combobox: a leading "No workspace" entry plus one entry per stored workspace, each clicking through to `useCreateConversation` immediately (no separate Launch button). It mirrors the dropdown footer actions/pattern (`+ Add Workspace`, `Manage Workspaces`) locally rather than embedding `WorkspaceDropdown` itself.
- `useResolvedWorkspaces()` now returns `isLoading` / `isError` for parent-directory scans; `WorkspaceSelectionForm` should surface that state (status text and disabling the empty dropdown while parent results are still loading) instead of assuming the merged list is immediately ready.
- `ManageWorkspacesModal` should require a confirmation step before removing either a saved workspace or a workspace parent; parent removals should mention the child-workspace impact, and tests should assert both the confirmation flow and that removing the selected workspace clears the launch selection.
- In `useWorkspacesStore`, keep `clearWorkspaces()` scoped to literal workspaces only; use explicit helpers like `clearWorkspaceParents()` / `clearAll()` for broader resets so future callers do not accidentally wipe parent registrations.
-
- Library packaging notes:
- Public npm entrypoints now come from `src/index.ts` → `src/lib/index.ts`, with domain barrels under `src/components/{conversation,terminal,browser,files,settings,sidebar}/index.ts`.
- `npm run build` remains the standalone app build (`react-router build`), while `npm run build:lib` runs `vite build` in library mode plus `tsc -p tsconfig.lib.json` to emit `.d.ts` files into `dist/`.
diff --git a/__tests__/components/backends/add-backend-menu-item.test.tsx b/__tests__/components/backends/add-backend-menu-item.test.tsx
deleted file mode 100644
index a782d7e760..0000000000
--- a/__tests__/components/backends/add-backend-menu-item.test.tsx
+++ /dev/null
@@ -1,17 +0,0 @@
-import { render, screen } from "@testing-library/react";
-import userEvent from "@testing-library/user-event";
-import { describe, expect, it, vi } from "vitest";
-import { AddBackendMenuItem } from "#/components/features/backends/add-backend-menu-item";
-
-describe("AddBackendMenuItem", () => {
- it("calls onOpen when clicked and does not render the modal itself", async () => {
- const onOpen = vi.fn();
- render(<AddBackendMenuItem onOpen={onOpen} />);
-
- const user = userEvent.setup();
- await user.click(screen.getByTestId("add-backend-menu-item"));
-
- expect(onOpen).toHaveBeenCalledOnce();
- expect(screen.queryByTestId("add-backend-modal")).not.toBeInTheDocument();
- });
-});
diff --git a/__tests__/components/backends/backend-selector.test.tsx b/__tests__/components/backends/backend-selector.test.tsx
index 48bf470f70..38a77f5861 100644
--- a/__tests__/components/backends/backend-selector.test.tsx
+++ b/__tests__/components/backends/backend-selector.test.tsx
@@ -1,9 +1,16 @@
import React from "react";
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
-import { render, screen, waitFor, within } from "@testing-library/react";
+import {
+ fireEvent,
+ render,
+ screen,
+ waitFor,
+ within,
+} from "@testing-library/react";
import userEvent from "@testing-library/user-event";
import { createRoutesStub, MemoryRouter } from "react-router";
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
+import { createAxiosError } from "test-utils";
import { __resetActiveStoreForTests } from "#/api/backend-registry/active-store";
import {
ActiveBackendProvider,
@@ -21,6 +28,7 @@ import {
getCloudOrganizationMe,
getCurrentCloudApiKey,
} from "#/api/cloud/organization-service.api";
+import { displayErrorToast } from "#/utils/custom-toast-handlers";
vi.mock("#/api/cloud/organization-service.api", () => ({
getCloudOrganizations: vi.fn(),
@@ -29,6 +37,10 @@ vi.mock("#/api/cloud/organization-service.api", () => ({
getCurrentCloudApiKey: vi.fn(),
}));
+vi.mock("#/utils/custom-toast-handlers", () => ({
+ displayErrorToast: vi.fn(),
+}));
+
function renderWithProviders(ui: React.ReactElement) {
const queryClient = new QueryClient({
defaultOptions: { queries: { retry: false } },
@@ -83,6 +95,7 @@ beforeEach(() => {
orgId: null,
isLegacyKey: true,
});
+ vi.mocked(displayErrorToast).mockReset();
});
afterEach(() => {
@@ -371,7 +384,7 @@ describe("BackendSelector", () => {
}
const RouterStub = createRoutesStub([
{ path: "/conversations/:conversationId", Component: ConversationRoute },
- { path: "/", Component: HomeRoute },
+ { path: "/conversations", Component: HomeRoute },
]);
const queryClient = new QueryClient({
defaultOptions: { queries: { retry: false } },
@@ -427,6 +440,261 @@ describe("BackendSelector", () => {
);
});
+ it("does not open backend modals on mouse down alone", async () => {
+ renderWithProviders(<BackendSelector />);
+
+ await openDropdown();
+
+ fireEvent.mouseDown(screen.getByTestId("add-backend-menu-item"));
+ expect(screen.queryByTestId("add-backend-modal")).not.toBeInTheDocument();
+
+ fireEvent.mouseDown(screen.getByTestId("manage-backends-menu-item"));
+ expect(
+ screen.queryByTestId("manage-backends-modal"),
+ ).not.toBeInTheDocument();
+ });
+
+ it("shows an error toast, dismisses the overlay, and does not switch to the failing cloud backend", async () => {
+ vi.mocked(getCloudOrganizations).mockResolvedValue({
+ items: [{ id: "org-2", name: "Acme Inc" }],
+ currentOrgId: "org-2",
+ });
+ vi.mocked(switchCloudOrganization).mockRejectedValueOnce(
+ createAxiosError(500, "Server Error", { message: "switch failed" }),
+ );
+
+ let productionId = "";
+ let activeLocalId = "";
+ renderWithProviders(
+ <>
+ <TestSeed
+ onMount={(ctx) => {
+ activeLocalId = ctx.addBackend({
+ name: "Active Local",
+ host: "http://localhost:9000",
+ apiKey: "local-key",
+ kind: "local",
+ }).id;
+ ctx.setActive(activeLocalId, null);
+ productionId = ctx.addBackend({
+ name: "Production",
+ host: "https://app.all-hands.dev",
+ apiKey: "bearer-key",
+ kind: "cloud",
+ }).id;
+ }}
+ >
+ <BackendSelector />
+ </TestSeed>
+ <EnvironmentSwitchOverlay />
+ </>,
+ );
+
+ const initialSelection = JSON.parse(
+ window.localStorage.getItem("openhands-active-backend") ?? "null",
+ );
+
+ const user = await openDropdown();
+ await waitFor(() => {
+ expect(screen.getByText("Production – Acme Inc")).toBeInTheDocument();
+ });
+
+ await user.click(screen.getByText("Production – Acme Inc"));
+
+ await waitFor(() => {
+ expect(displayErrorToast).toHaveBeenCalledWith("switch failed");
+ });
+ expect(
+ screen.queryByTestId("environment-switch-overlay"),
+ ).not.toBeInTheDocument();
+
+ const stored = JSON.parse(
+ window.localStorage.getItem("openhands-active-backend") ?? "null",
+ );
+ expect(initialSelection?.backendId).toBe(activeLocalId);
+ expect(stored?.backendId).not.toBe(productionId);
+ expect(stored?.orgId ?? null).toBeNull();
+ });
+
+ it("shows a generic error toast instead of throwing on unexpected org switch errors", async () => {
+ const consoleErrorSpy = vi
+ .spyOn(console, "error")
+ .mockImplementation(() => undefined);
+ vi.mocked(getCloudOrganizations).mockResolvedValue({
+ items: [{ id: "org-2", name: "Acme Inc" }],
+ currentOrgId: "org-2",
+ });
+ vi.mocked(switchCloudOrganization).mockRejectedValueOnce(
+ new Error("unexpected failure"),
+ );
+
+ renderWithProviders(
+ <TestSeed
+ onMount={(ctx) => {
+ ctx.addBackend({
+ name: "Production",
+ host: "https://app.all-hands.dev",
+ apiKey: "bearer-key",
+ kind: "cloud",
+ });
+ }}
+ >
+ <BackendSelector />
+ </TestSeed>,
+ );
+
+ const user = await openDropdown();
+ await waitFor(() => {
+ expect(screen.getByText("Production – Acme Inc")).toBeInTheDocument();
+ });
+
+ await user.click(screen.getByText("Production – Acme Inc"));
+
+ await waitFor(() => {
+ expect(displayErrorToast).toHaveBeenCalledWith("ERROR$GENERIC");
+ });
+ expect(consoleErrorSpy).toHaveBeenCalledWith(
+ "Unexpected error during org switch:",
+ expect.any(Error),
+ );
+ consoleErrorSpy.mockRestore();
+ });
+
+ it("falls back to the bundled backend when malformed cloud self-heal fails", async () => {
+ vi.mocked(getCloudOrganizations).mockResolvedValue({
+ items: [{ id: "org-2", name: "Acme Inc" }],
+ currentOrgId: "org-2",
+ });
+ vi.mocked(switchCloudOrganization).mockRejectedValueOnce(
+ createAxiosError(500, "Server Error", { message: "switch failed" }),
+ );
+
+ renderWithProviders(
+ <TestSeed
+ onMount={(ctx) => {
+ const production = ctx.addBackend({
+ name: "Production",
+ host: "https://app.all-hands.dev",
+ apiKey: "bearer-key",
+ kind: "cloud",
+ });
+ ctx.setActive(production.id, null);
+ }}
+ >
+ <BackendSelector />
+ </TestSeed>,
+ );
+
+ await waitFor(() => {
+ const stored = JSON.parse(
+ window.localStorage.getItem("openhands-active-backend") ?? "null",
+ );
+ expect(stored?.backendId).toBe("__bundled__");
+ expect(stored?.orgId ?? null).toBeNull();
+ });
+ });
+
+ it("renders the backend footer actions and opens/closes the add modal", async () => {
+ renderWithProviders(<BackendSelector />);
+
+ const user = await openDropdown();
+ expect(screen.getByTestId("add-backend-menu-item")).toBeInTheDocument();
+ expect(screen.getByTestId("manage-backends-menu-item")).toBeInTheDocument();
+
+ await user.click(screen.getByTestId("add-backend-menu-item"));
+ expect(await screen.findByTestId("add-backend-modal")).toBeInTheDocument();
+
+ await user.click(screen.getByTestId("add-backend-cancel"));
+ await waitFor(() => {
+ expect(screen.queryByTestId("add-backend-modal")).not.toBeInTheDocument();
+ });
+ });
+
+ it("opens the manage backends modal and removes a backend", async () => {
+ renderWithProviders(
+ <TestSeed
+ onMount={(ctx) => {
+ ctx.addBackend({
+ name: "Local 1",
+ host: "http://localhost:9000",
+ apiKey: "k",
+ kind: "local",
+ });
+ }}
+ >
+ <BackendSelector />
+ </TestSeed>,
+ );
+
+ const user = await openDropdown();
+ await user.click(screen.getByTestId("manage-backends-menu-item"));
+
+ expect(
+ await screen.findByTestId("manage-backends-modal"),
+ ).toBeInTheDocument();
+ expect(
+ screen.getByTestId("manage-backends-row-Local 1"),
+ ).toBeInTheDocument();
+
+ await user.click(screen.getByTestId("manage-backends-remove-Local 1"));
+ expect(await screen.findByTestId("confirmation-modal")).toBeInTheDocument();
+
+ await user.click(screen.getByTestId("confirm-button"));
+
+ await waitFor(() => {
+ expect(
+ screen.queryByTestId("manage-backends-row-Local 1"),
+ ).not.toBeInTheDocument();
+ });
+ expect(
+ JSON.parse(window.localStorage.getItem("openhands-backends") ?? "[]"),
+ ).toEqual([]);
+ });
+
+ it("falls back to the bundled backend when removing the active backend from manage backends", async () => {
+ renderWithProviders(
+ <TestSeed
+ onMount={(ctx) => {
+ const backend = ctx.addBackend({
+ name: "Local 1",
+ host: "http://localhost:9000",
+ apiKey: "k",
+ kind: "local",
+ });
+ ctx.setActive(backend.id);
+ }}
+ >
+ <BackendSelector />
+ </TestSeed>,
+ );
+
+ let wrapper = screen.getByTestId("backend-selector");
+ let input = wrapper.querySelector("input") as HTMLInputElement;
+ expect(input.value).toBe("Local 1");
+
+ const user = await openDropdown();
+ await user.click(screen.getByTestId("manage-backends-menu-item"));
+ await user.click(
+ await screen.findByTestId("manage-backends-remove-Local 1"),
+ );
+ await user.click(screen.getByTestId("confirm-button"));
+
+ await waitFor(() => {
+ expect(
+ screen.queryByTestId("manage-backends-row-Local 1"),
+ ).not.toBeInTheDocument();
+ });
+
+ const stored = JSON.parse(
+ window.localStorage.getItem("openhands-active-backend") ?? "null",
+ );
+ expect(stored).toBeNull();
+
+ wrapper = screen.getByTestId("backend-selector");
+ input = wrapper.querySelector("input") as HTMLInputElement;
+ expect(input.value).toBe("BACKEND$LOCAL_ROW");
+ });
+
it("redirects to the automations list when switching backends from an automation detail route", async () => {
function AutomationDetailRoute() {
return (
@@ -465,9 +733,7 @@ describe("BackendSelector", () => {
const user = await openDropdown();
await user.click(screen.getByText("Local 1"));
- expect(
- await screen.findByTestId("automations-list"),
- ).toBeInTheDocument();
+ expect(await screen.findByTestId("automations-list")).toBeInTheDocument();
});
it("does not redirect when switching backends from a non-conversation route", async () => {
diff --git a/__tests__/components/backends/environment-switch-overlay.test.tsx b/__tests__/components/backends/environment-switch-overlay.test.tsx
index a07fef6bc9..d9332155c2 100644
--- a/__tests__/components/backends/environment-switch-overlay.test.tsx
+++ b/__tests__/components/backends/environment-switch-overlay.test.tsx
@@ -3,6 +3,7 @@ import { act, render, screen } from "@testing-library/react";
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
import {
__resetEnvironmentSwitchOverlayForTests,
+ dismissEnvironmentSwitch,
ENVIRONMENT_SWITCH_DURATION_MS,
EnvironmentSwitchOverlay,
triggerEnvironmentSwitch,
@@ -43,4 +44,23 @@ describe("EnvironmentSwitchOverlay", () => {
screen.queryByTestId("environment-switch-overlay"),
).not.toBeInTheDocument();
});
+
+ it("hides immediately when dismissed before the auto-hide timeout", () => {
+ render(<EnvironmentSwitchOverlay />);
+
+ act(() => {
+ triggerEnvironmentSwitch("Acme Cloud");
+ });
+ expect(
+ screen.getByTestId("environment-switch-overlay"),
+ ).toBeInTheDocument();
+
+ act(() => {
+ dismissEnvironmentSwitch();
+ });
+
+ expect(
+ screen.queryByTestId("environment-switch-overlay"),
+ ).not.toBeInTheDocument();
+ });
});
diff --git a/__tests__/components/features/chat/components/chat-input-actions.test.tsx b/__tests__/components/features/chat/components/chat-input-actions.test.tsx
index 8ccbcf0738..69bf5507d5 100644
--- a/__tests__/components/features/chat/components/chat-input-actions.test.tsx
+++ b/__tests__/components/features/chat/components/chat-input-actions.test.tsx
@@ -1,6 +1,6 @@
import React from "react";
import { screen } from "@testing-library/react";
-import { describe, it, expect, vi, afterEach } from "vitest";
+import { afterEach, describe, expect, it, vi } from "vitest";
import { renderWithProviders } from "test-utils";
import { ActiveBackendProvider } from "#/contexts/active-backend-context";
import {
@@ -10,6 +10,12 @@ import {
} from "#/api/backend-registry/active-store";
import type { Backend } from "#/api/backend-registry/types";
+const useActiveConversationMock = vi.fn<
+ () => {
+ data: { conversation_id: string; llm_model: string | null } | undefined;
+ }
+>(() => ({ data: undefined }));
+
vi.mock("#/components/features/controls/agent-status", () => ({
AgentStatus: () => <div data-testid="agent-status-stub" />,
}));
@@ -22,7 +28,10 @@ vi.mock("#/components/features/chat/change-agent-button", () => ({
ChangeAgentButton: () => <div data-testid="change-agent-button-stub" />,
}));
-// Mock the underlying mutation service module that the pause/resume hooks call.
+vi.mock("#/hooks/query/use-active-conversation", () => ({
+ useActiveConversation: () => useActiveConversationMock(),
+}));
+
vi.mock("#/hooks/mutation/conversation-mutation-utils", () => ({
pauseConversation: vi.fn(),
resumeConversation: vi.fn(),
@@ -42,35 +51,56 @@ const cloudBackend: Backend = {
kind: "cloud",
};
-describe("ChatInputActions Change Agent button visibility", () => {
+describe("ChatInputActions", () => {
afterEach(() => {
window.localStorage.clear();
__resetActiveStoreForTests();
+ useActiveConversationMock.mockReset();
+ useActiveConversationMock.mockReturnValue({ data: undefined });
+ });
+
+ it("renders the active conversation model when one is available", () => {
+ useActiveConversationMock.mockReturnValue({
+ data: { conversation_id: "test-conversation-id", llm_model: "gpt-4o" },
+ });
+
+ renderWithProviders(<ChatInputActions disabled={false} />);
+
+ expect(screen.getByTestId("chat-input-llm-model")).toHaveTextContent(
+ "gpt-4o",
+ );
+ });
+
+ it("omits the model label when the active conversation has no llm_model", () => {
+ useActiveConversationMock.mockReturnValue({
+ data: { conversation_id: "test-conversation-id", llm_model: null },
+ });
+
+ renderWithProviders(<ChatInputActions disabled={false} />);
+
+ expect(
+ screen.queryByTestId("chat-input-llm-model"),
+ ).not.toBeInTheDocument();
});
it("hides the Change Agent button on a local backend", () => {
- // Arrange + Act — default active backend is the bundled local one.
renderWithProviders(<ChatInputActions disabled={false} />);
- // Assert
expect(
screen.queryByTestId("change-agent-button-stub"),
).not.toBeInTheDocument();
});
it("shows the Change Agent button on a cloud backend", () => {
- // Arrange
setRegisteredBackends([cloudBackend]);
setActiveSelection({ backendId: cloudBackend.id });
- // Act
renderWithProviders(
<ActiveBackendProvider>
<ChatInputActions disabled={false} />
</ActiveBackendProvider>,
);
- // Assert
expect(screen.getByTestId("change-agent-button-stub")).toBeInTheDocument();
});
});
diff --git a/__tests__/components/features/chat/components/chat-input-model.test.tsx b/__tests__/components/features/chat/components/chat-input-model.test.tsx
new file mode 100644
index 0000000000..885b1f2186
--- /dev/null
+++ b/__tests__/components/features/chat/components/chat-input-model.test.tsx
@@ -0,0 +1,58 @@
+import React from "react";
+import { screen } from "@testing-library/react";
+import { describe, it, expect, vi, beforeEach } from "vitest";
+import { renderWithProviders } from "test-utils";
+
+const useActiveConversationMock = vi.fn();
+
+vi.mock("#/hooks/query/use-active-conversation", () => ({
+ useActiveConversation: () => useActiveConversationMock(),
+}));
+
+// eslint-disable-next-line import/first
+import { ChatInputModel } from "#/components/features/chat/components/chat-input-model";
+
+describe("ChatInputModel", () => {
+ beforeEach(() => {
+ useActiveConversationMock.mockReset();
+ });
+
+ it("renders the active conversation's llm_model when present", () => {
+ useActiveConversationMock.mockReturnValue({
+ data: {
+ conversation_id: "test-conversation-id",
+ llm_model: "openai/gpt-4o",
+ },
+ });
+
+ renderWithProviders(<ChatInputModel />);
+
+ const model = screen.getByTestId("chat-input-llm-model");
+ expect(model).toBeInTheDocument();
+ expect(model).toHaveTextContent("openai/gpt-4o");
+ expect(model).toHaveAttribute("title", "openai/gpt-4o");
+ expect(model.querySelector("svg")).toBeInTheDocument();
+ });
+
+ it("renders nothing when llm_model is missing", () => {
+ useActiveConversationMock.mockReturnValue({
+ data: { conversation_id: "test-conversation-id" },
+ });
+
+ renderWithProviders(<ChatInputModel />);
+
+ expect(
+ screen.queryByTestId("chat-input-llm-model"),
+ ).not.toBeInTheDocument();
+ });
+
+ it("renders nothing when there is no active conversation", () => {
+ useActiveConversationMock.mockReturnValue({ data: undefined });
+
+ renderWithProviders(<ChatInputModel />);
+
+ expect(
+ screen.queryByTestId("chat-input-llm-model"),
+ ).not.toBeInTheDocument();
+ });
+});
diff --git a/__tests__/components/features/conversation-panel/confirm-delete-modal.test.tsx b/__tests__/components/features/conversation-panel/confirm-delete-modal.test.tsx
index 077ff88760..a9245be855 100644
--- a/__tests__/components/features/conversation-panel/confirm-delete-modal.test.tsx
+++ b/__tests__/components/features/conversation-panel/confirm-delete-modal.test.tsx
@@ -27,4 +27,18 @@ describe("ConfirmDeleteModal", () => {
expect(screen.getByText(/My Test Conversation/)).toBeInTheDocument();
});
+
+ it("falls back to the default warning when description is null", () => {
+ renderWithProviders(
+ <ConfirmDeleteModal
+ onConfirm={vi.fn()}
+ onCancel={vi.fn()}
+ description={null}
+ />,
+ );
+
+ expect(
+ screen.getByText("CONVERSATION$DELETE_WARNING"),
+ ).toBeInTheDocument();
+ });
});
diff --git a/__tests__/components/features/conversation-panel/conversation-card.test.tsx b/__tests__/components/features/conversation-panel/conversation-card.test.tsx
index 141c765ff0..7f3477f799 100644
--- a/__tests__/components/features/conversation-panel/conversation-card.test.tsx
+++ b/__tests__/components/features/conversation-panel/conversation-card.test.tsx
@@ -37,6 +37,7 @@ vi.mock("react-i18next", async () => {
CONVERSATION$CREATED: "Created",
CONVERSATION$AGO: "ago",
CONVERSATION$UPDATED: "Updated",
+ COMMON$NO_REPOSITORY: "No repository",
};
return translations[key] || key;
},
@@ -126,6 +127,52 @@ describe("ConversationCard", () => {
screen.getByTestId("conversation-card-selected-repository");
});
+ it("renders the workspace folder name when no repository is selected", () => {
+ renderWithProviders(
+ <ConversationCard
+ onDelete={onDelete}
+ onChangeTitle={onChangeTitle}
+ title="Conversation 1"
+ selectedRepository={null}
+ lastUpdatedAt="2021-10-01T12:00:00Z"
+ workspaceWorkingDir="/workspace/project/agent-canvas"
+ />,
+ );
+
+ expect(screen.getByText("agent-canvas")).toBeInTheDocument();
+ expect(
+ screen.getByTitle("/workspace/project/agent-canvas"),
+ ).toBeInTheDocument();
+ });
+
+ it("handles Windows workspace paths and falls back when the path is empty", () => {
+ const { rerender } = renderWithProviders(
+ <ConversationCard
+ onDelete={onDelete}
+ onChangeTitle={onChangeTitle}
+ title="Conversation 1"
+ selectedRepository={null}
+ lastUpdatedAt="2021-10-01T12:00:00Z"
+ workspaceWorkingDir="C:\\Users\\me\\repo"
+ />,
+ );
+
+ expect(screen.getByText("repo")).toBeInTheDocument();
+
+ rerender(
+ <ConversationCard
+ onDelete={onDelete}
+ onChangeTitle={onChangeTitle}
+ title="Conversation 1"
+ selectedRepository={null}
+ lastUpdatedAt="2021-10-01T12:00:00Z"
+ workspaceWorkingDir=" "
+ />,
+ );
+
+ expect(screen.getByText("No repository")).toBeInTheDocument();
+ });
+
it("should toggle a context menu when clicking the ellipsis button", async () => {
const user = userEvent.setup();
const onContextMenuToggle = vi.fn();
@@ -442,31 +489,7 @@ describe("ConversationCard", () => {
expect(screen.queryByTestId("ellipsis-button")).not.toBeInTheDocument();
});
- it("should render the llm model when provided", () => {
- renderWithProviders(
- <ConversationCard
- onDelete={onDelete}
- onChangeTitle={onChangeTitle}
- title="Conversation 1"
- selectedRepository={null}
- lastUpdatedAt="2021-10-01T12:00:00Z"
- llmModel="anthropic/claude-sonnet-4-20250514"
- />,
- );
-
- const model = screen.getByTestId("conversation-card-llm-model");
- expect(model).toBeInTheDocument();
- expect(model).toHaveTextContent("anthropic/claude-sonnet-4-20250514");
- expect(model).toHaveAttribute("title", "anthropic/claude-sonnet-4-20250514");
- expect(model.querySelector("svg")).toBeInTheDocument();
-
- // Verify truncation structure: text is wrapped in a span with truncate class
- const textSpan = model.querySelector("span.truncate");
- expect(textSpan).toBeInTheDocument();
- expect(textSpan).toHaveTextContent("anthropic/claude-sonnet-4-20250514");
- });
-
- it("should not render the llm model when not provided", () => {
+ it("should not render the llm model in the conversation card", () => {
renderWithProviders(
<ConversationCard
onDelete={onDelete}
diff --git a/__tests__/components/features/conversation-panel/conversation-panel.test.tsx b/__tests__/components/features/conversation-panel/conversation-panel.test.tsx
index 97f5bca69c..0b39943e27 100644
--- a/__tests__/components/features/conversation-panel/conversation-panel.test.tsx
+++ b/__tests__/components/features/conversation-panel/conversation-panel.test.tsx
@@ -1,5 +1,13 @@
import { screen, waitFor, within } from "@testing-library/react";
-import { beforeAll, beforeEach, describe, expect, it, vi } from "vitest";
+import {
+ afterEach,
+ beforeAll,
+ beforeEach,
+ describe,
+ expect,
+ it,
+ vi,
+} from "vitest";
import userEvent from "@testing-library/user-event";
import { createRoutesStub } from "react-router";
import React from "react";
@@ -8,6 +16,7 @@ import { ConversationPanel } from "#/components/features/conversation-panel/conv
import AgentServerConversationService from "#/api/conversation-service/agent-server-conversation-service.api";
import { AppConversation } from "#/api/conversation-service/agent-server-conversation-service.types";
import { ExecutionStatus } from "#/types/agent-server/core";
+import { displayErrorToast } from "#/utils/custom-toast-handlers";
// Mock the unified stop conversation hook
const mockStopConversationMutate = vi.fn();
@@ -17,16 +26,19 @@ vi.mock("#/hooks/mutation/use-unified-stop-conversation", () => ({
}),
}));
-
// Helper to create complete AppConversation mock data
-const createMockConversation = (overrides: Partial<AppConversation> = {}): AppConversation => ({
+// Default timestamps use "now" so conversations are considered recent and
+// rendered eagerly by the panel (which hides items older than ~1h by default).
+const createMockConversation = (
+ overrides: Partial<AppConversation> = {},
+): AppConversation => ({
id: "test-id",
title: "Test Conversation",
selected_repository: null,
git_provider: null,
selected_branch: null,
- updated_at: "2021-10-01T12:00:00Z",
- created_at: "2021-10-01T12:00:00Z",
+ updated_at: new Date().toISOString(),
+ created_at: new Date().toISOString(),
execution_status: ExecutionStatus.FINISHED,
conversation_url: null,
created_by_user_id: "user1",
@@ -61,7 +73,9 @@ describe("ConversationPanel", () => {
},
]);
- const renderConversationPanel = () => renderWithProviders(<RouterStub />);
+ const renderConversationPanel = (
+ options?: Parameters<typeof renderWithProviders>[1],
+ ) => renderWithProviders(<RouterStub />, options);
beforeAll(() => {
vi.mock("react-router", async (importOriginal) => ({
@@ -74,21 +88,28 @@ describe("ConversationPanel", () => {
});
const mockConversations: AppConversation[] = [
- createMockConversation({ id: "1", title: "Conversation 1", updated_at: "2021-10-01T12:00:00Z" }),
- createMockConversation({ id: "2", title: "Conversation 2", updated_at: "2021-10-02T12:00:00Z" }),
- createMockConversation({ id: "3", title: "Conversation 3", updated_at: "2021-10-03T12:00:00Z" }),
+ createMockConversation({ id: "1", title: "Conversation 1" }),
+ createMockConversation({ id: "2", title: "Conversation 2" }),
+ createMockConversation({ id: "3", title: "Conversation 3" }),
];
beforeEach(() => {
vi.clearAllMocks();
mockStopConversationMutate.mockClear();
- // Setup default mock for V1 searchConversations
- vi.spyOn(AgentServerConversationService, "searchConversations").mockResolvedValue({
+ // Setup default mock for searchConversations
+ vi.spyOn(
+ AgentServerConversationService,
+ "searchConversations",
+ ).mockResolvedValue({
items: [...mockConversations],
next_page_id: null,
});
});
+ afterEach(() => {
+ vi.useRealTimers();
+ });
+
it("should render the conversations", async () => {
renderConversationPanel();
const cards = await screen.findAllByTestId("conversation-card");
@@ -166,9 +187,9 @@ describe("ConversationPanel", () => {
it("should delete a conversation", async () => {
const user = userEvent.setup();
const mockData: AppConversation[] = [
- createMockConversation({ id: "1", title: "Conversation 1", updated_at: "2021-10-01T12:00:00Z" }),
- createMockConversation({ id: "2", title: "Conversation 2", updated_at: "2021-10-02T12:00:00Z" }),
- createMockConversation({ id: "3", title: "Conversation 3", updated_at: "2021-10-03T12:00:00Z" }),
+ createMockConversation({ id: "1", title: "Conversation 1" }),
+ createMockConversation({ id: "2", title: "Conversation 2" }),
+ createMockConversation({ id: "3", title: "Conversation 3" }),
];
const searchConversationsSpy = vi.spyOn(
@@ -273,14 +294,99 @@ describe("ConversationPanel", () => {
expect(newCards).toHaveLength(3);
});
+ it("keeps invalid timestamps recent and only shows load more after expanding older conversations", async () => {
+ const now = Date.now();
+ const minutesAgo = (minutes: number) =>
+ new Date(now - minutes * 60 * 1000).toISOString();
+
+ const user = userEvent.setup();
+ const searchConversationsSpy = vi.spyOn(
+ AgentServerConversationService,
+ "searchConversations",
+ );
+ searchConversationsSpy.mockReset();
+ searchConversationsSpy
+ .mockResolvedValueOnce({
+ items: [
+ createMockConversation({
+ id: "recent",
+ title: "Recent Conversation",
+ updated_at: minutesAgo(59),
+ }),
+ createMockConversation({
+ id: "invalid",
+ title: "Invalid Timestamp",
+ updated_at: "invalid-date",
+ }),
+ createMockConversation({
+ id: "missing",
+ title: "Missing Timestamp",
+ updated_at: undefined as unknown as string,
+ }),
+ createMockConversation({
+ id: "older",
+ title: "Older Conversation",
+ updated_at: minutesAgo(61),
+ }),
+ ],
+ next_page_id: "page-2",
+ })
+ .mockResolvedValueOnce({
+ items: [
+ createMockConversation({
+ id: "paged",
+ title: "Paged Conversation",
+ updated_at: minutesAgo(30),
+ }),
+ ],
+ next_page_id: null,
+ });
+
+ renderConversationPanel();
+
+ expect(await screen.findByText("Recent Conversation")).toBeInTheDocument();
+ expect(screen.getByText("Invalid Timestamp")).toBeInTheDocument();
+ expect(screen.getByText("Missing Timestamp")).toBeInTheDocument();
+ expect(screen.queryByText("Older Conversation")).not.toBeInTheDocument();
+ expect(
+ screen.getByTestId("older-conversations-summary"),
+ ).toBeInTheDocument();
+ expect(
+ screen.queryByTestId("load-more-conversations"),
+ ).not.toBeInTheDocument();
+
+ await user.click(screen.getByTestId("toggle-older-conversations"));
+
+ expect(await screen.findByText("Older Conversation")).toBeInTheDocument();
+
+ await user.click(screen.getByTestId("load-more-conversations"));
+
+ await waitFor(() => {
+ expect(searchConversationsSpy).toHaveBeenCalledWith(20, "page-2");
+ });
+ expect(await screen.findByText("Paged Conversation")).toBeInTheDocument();
+ });
+
it("should cancel stopping a conversation", async () => {
const user = userEvent.setup();
// Create mock data with a RUNNING conversation
const mockRunningConversations: AppConversation[] = [
- createMockConversation({ id: "1", title: "Running Conversation", execution_status: ExecutionStatus.RUNNING }),
- createMockConversation({ id: "2", title: "Starting Conversation", execution_status: ExecutionStatus.RUNNING }),
- createMockConversation({ id: "3", title: "Stopped Conversation", execution_status: ExecutionStatus.PAUSED }),
+ createMockConversation({
+ id: "1",
+ title: "Running Conversation",
+ execution_status: ExecutionStatus.RUNNING,
+ }),
+ createMockConversation({
+ id: "2",
+ title: "Starting Conversation",
+ execution_status: ExecutionStatus.RUNNING,
+ }),
+ createMockConversation({
+ id: "3",
+ title: "Stopped Conversation",
+ execution_status: ExecutionStatus.PAUSED,
+ }),
];
const searchConversationsSpy = vi.spyOn(
@@ -325,9 +431,21 @@ describe("ConversationPanel", () => {
const user = userEvent.setup();
const mockData: AppConversation[] = [
- createMockConversation({ id: "1", title: "Conversation 1", execution_status: ExecutionStatus.RUNNING }),
- createMockConversation({ id: "2", title: "Conversation 2", execution_status: ExecutionStatus.FINISHED }),
- createMockConversation({ id: "3", title: "Conversation 3", execution_status: ExecutionStatus.FINISHED }),
+ createMockConversation({
+ id: "1",
+ title: "Conversation 1",
+ execution_status: ExecutionStatus.RUNNING,
+ }),
+ createMockConversation({
+ id: "2",
+ title: "Conversation 2",
+ execution_status: ExecutionStatus.FINISHED,
+ }),
+ createMockConversation({
+ id: "3",
+ title: "Conversation 3",
+ execution_status: ExecutionStatus.FINISHED,
+ }),
];
const searchConversationsSpy = vi.spyOn(
@@ -373,9 +491,21 @@ describe("ConversationPanel", () => {
const user = userEvent.setup();
const mockMixedStatusConversations: AppConversation[] = [
- createMockConversation({ id: "1", title: "Running Conversation", execution_status: ExecutionStatus.RUNNING }),
- createMockConversation({ id: "2", title: "Starting Conversation", execution_status: ExecutionStatus.RUNNING }),
- createMockConversation({ id: "3", title: "Stopped Conversation", execution_status: ExecutionStatus.PAUSED }),
+ createMockConversation({
+ id: "1",
+ title: "Running Conversation",
+ execution_status: ExecutionStatus.RUNNING,
+ }),
+ createMockConversation({
+ id: "2",
+ title: "Starting Conversation",
+ execution_status: ExecutionStatus.RUNNING,
+ }),
+ createMockConversation({
+ id: "3",
+ title: "Stopped Conversation",
+ execution_status: ExecutionStatus.PAUSED,
+ }),
];
const searchConversationsSpy = vi.spyOn(
@@ -492,7 +622,9 @@ describe("ConversationPanel", () => {
AgentServerConversationService,
"updateConversationTitle",
);
- updateConversationTitleSpy.mockResolvedValue(createMockConversation({ id: "1", title: "Updated Title" }));
+ updateConversationTitleSpy.mockResolvedValue(
+ createMockConversation({ id: "1", title: "Updated Title" }),
+ );
renderConversationPanel();
@@ -514,7 +646,10 @@ describe("ConversationPanel", () => {
await user.tab();
// Verify API call was made with correct parameters
- expect(updateConversationTitleSpy).toHaveBeenCalledWith("1", "Updated Title");
+ expect(updateConversationTitleSpy).toHaveBeenCalledWith(
+ "1",
+ "Updated Title",
+ );
});
it("should save title when Enter key is pressed", async () => {
@@ -524,7 +659,9 @@ describe("ConversationPanel", () => {
AgentServerConversationService,
"updateConversationTitle",
);
- updateConversationTitleSpy.mockResolvedValue(createMockConversation({ id: "1", title: "Updated Title" }));
+ updateConversationTitleSpy.mockResolvedValue(
+ createMockConversation({ id: "1", title: "Updated Title" }),
+ );
renderConversationPanel();
@@ -544,7 +681,10 @@ describe("ConversationPanel", () => {
await user.keyboard("{Enter}");
// Verify API call was made
- expect(updateConversationTitleSpy).toHaveBeenCalledWith("1", "Title Updated via Enter");
+ expect(updateConversationTitleSpy).toHaveBeenCalledWith(
+ "1",
+ "Title Updated via Enter",
+ );
});
it("should trim whitespace from title", async () => {
@@ -554,7 +694,9 @@ describe("ConversationPanel", () => {
AgentServerConversationService,
"updateConversationTitle",
);
- updateConversationTitleSpy.mockResolvedValue(createMockConversation({ id: "1", title: "Updated Title" }));
+ updateConversationTitleSpy.mockResolvedValue(
+ createMockConversation({ id: "1", title: "Updated Title" }),
+ );
renderConversationPanel();
@@ -574,7 +716,10 @@ describe("ConversationPanel", () => {
await user.tab();
// Verify API call was made with trimmed title
- expect(updateConversationTitleSpy).toHaveBeenCalledWith("1", "Trimmed Title");
+ expect(updateConversationTitleSpy).toHaveBeenCalledWith(
+ "1",
+ "Trimmed Title",
+ );
});
it("should revert to original title when empty", async () => {
@@ -584,7 +729,9 @@ describe("ConversationPanel", () => {
AgentServerConversationService,
"updateConversationTitle",
);
- updateConversationTitleSpy.mockResolvedValue(createMockConversation({ id: "1", title: "Updated Title" }));
+ updateConversationTitleSpy.mockResolvedValue(
+ createMockConversation({ id: "1", title: "Updated Title" }),
+ );
renderConversationPanel();
@@ -614,7 +761,7 @@ describe("ConversationPanel", () => {
"updateConversationTitle",
);
updateConversationTitleSpy.mockRejectedValue(new Error("API Error"));
- // Provide return type for mock
+ // Provide return type for mock
renderConversationPanel();
@@ -634,7 +781,10 @@ describe("ConversationPanel", () => {
await user.tab();
// Verify API call was made
- expect(updateConversationTitleSpy).toHaveBeenCalledWith("1", "Failed Update");
+ expect(updateConversationTitleSpy).toHaveBeenCalledWith(
+ "1",
+ "Failed Update",
+ );
// Wait for error handling
await waitFor(() => {
@@ -678,7 +828,9 @@ describe("ConversationPanel", () => {
AgentServerConversationService,
"updateConversationTitle",
);
- updateConversationTitleSpy.mockResolvedValue(createMockConversation({ id: "1", title: "Updated Title" }));
+ updateConversationTitleSpy.mockResolvedValue(
+ createMockConversation({ id: "1", title: "Updated Title" }),
+ );
renderConversationPanel();
@@ -707,7 +859,9 @@ describe("ConversationPanel", () => {
AgentServerConversationService,
"updateConversationTitle",
);
- updateConversationTitleSpy.mockResolvedValue(createMockConversation({ id: "1", title: "Updated Title" }));
+ updateConversationTitleSpy.mockResolvedValue(
+ createMockConversation({ id: "1", title: "Updated Title" }),
+ );
renderConversationPanel();
@@ -727,7 +881,10 @@ describe("ConversationPanel", () => {
await user.tab();
// Verify API call was made with special characters
- expect(updateConversationTitleSpy).toHaveBeenCalledWith("1", "Special @#$%^&*()_+ Characters");
+ expect(updateConversationTitleSpy).toHaveBeenCalledWith(
+ "1",
+ "Special @#$%^&*()_+ Characters",
+ );
});
it("should close delete modal when clicking backdrop", async () => {
@@ -763,12 +920,27 @@ describe("ConversationPanel", () => {
// Create mock data with a RUNNING conversation
const mockRunningConversations: AppConversation[] = [
- createMockConversation({ id: "1", title: "Running Conversation", execution_status: ExecutionStatus.RUNNING }),
- createMockConversation({ id: "2", title: "Starting Conversation", execution_status: ExecutionStatus.RUNNING }),
- createMockConversation({ id: "3", title: "Stopped Conversation", execution_status: ExecutionStatus.PAUSED }),
+ createMockConversation({
+ id: "1",
+ title: "Running Conversation",
+ execution_status: ExecutionStatus.RUNNING,
+ }),
+ createMockConversation({
+ id: "2",
+ title: "Starting Conversation",
+ execution_status: ExecutionStatus.RUNNING,
+ }),
+ createMockConversation({
+ id: "3",
+ title: "Stopped Conversation",
+ execution_status: ExecutionStatus.PAUSED,
+ }),
];
- vi.spyOn(AgentServerConversationService, "searchConversations").mockResolvedValue({
+ vi.spyOn(
+ AgentServerConversationService,
+ "searchConversations",
+ ).mockResolvedValue({
items: mockRunningConversations,
next_page_id: null,
});
@@ -798,4 +970,419 @@ describe("ConversationPanel", () => {
screen.queryByRole("button", { name: /confirm/i }),
).not.toBeInTheDocument();
});
+
+ describe("older conversations cutoff", () => {
+ const recentIso = () => new Date().toISOString();
+ const olderIso = () =>
+ new Date(Date.now() - 2 * 60 * 60 * 1000).toISOString();
+
+ it("hides conversations older than 1h behind a summary line", async () => {
+ vi.spyOn(
+ AgentServerConversationService,
+ "searchConversations",
+ ).mockResolvedValue({
+ items: [
+ createMockConversation({
+ id: "recent",
+ title: "Recent",
+ updated_at: recentIso(),
+ }),
+ createMockConversation({
+ id: "old1",
+ title: "Old 1",
+ updated_at: olderIso(),
+ }),
+ createMockConversation({
+ id: "old2",
+ title: "Old 2",
+ updated_at: olderIso(),
+ }),
+ ],
+ next_page_id: null,
+ });
+
+ renderConversationPanel();
+
+ const cards = await screen.findAllByTestId("conversation-card");
+ expect(cards).toHaveLength(1);
+ expect(within(cards[0]).getByText("Recent")).toBeInTheDocument();
+
+ const summary = screen.getByTestId("older-conversations-summary");
+ expect(summary).toHaveTextContent("2");
+ expect(summary).toHaveTextContent("CONVERSATION$N_OLDER_CONVERSATIONS");
+ expect(
+ within(summary).getByTestId("toggle-older-conversations"),
+ ).toHaveTextContent("CONVERSATION$SHOW_ALL");
+ expect(
+ within(summary).getByTestId("delete-older-conversations"),
+ ).toHaveTextContent("CONVERSATION$DELETE_ALL");
+ });
+
+ it("does not render the summary when no conversations are older than 1h", async () => {
+ vi.spyOn(
+ AgentServerConversationService,
+ "searchConversations",
+ ).mockResolvedValue({
+ items: [
+ createMockConversation({
+ id: "recent1",
+ title: "Recent 1",
+ updated_at: recentIso(),
+ }),
+ createMockConversation({
+ id: "recent2",
+ title: "Recent 2",
+ updated_at: recentIso(),
+ }),
+ ],
+ next_page_id: null,
+ });
+
+ renderConversationPanel();
+
+ await screen.findAllByTestId("conversation-card");
+ expect(
+ screen.queryByTestId("older-conversations-summary"),
+ ).not.toBeInTheDocument();
+ });
+
+ it("toggles older conversations visibility via the show-all link", async () => {
+ const user = userEvent.setup();
+ vi.spyOn(
+ AgentServerConversationService,
+ "searchConversations",
+ ).mockResolvedValue({
+ items: [
+ createMockConversation({
+ id: "recent",
+ title: "Recent",
+ updated_at: recentIso(),
+ }),
+ createMockConversation({
+ id: "old1",
+ title: "Old 1",
+ updated_at: olderIso(),
+ }),
+ ],
+ next_page_id: null,
+ });
+
+ renderConversationPanel();
+
+ let cards = await screen.findAllByTestId("conversation-card");
+ expect(cards).toHaveLength(1);
+
+ const toggle = screen.getByTestId("toggle-older-conversations");
+ expect(toggle).toHaveTextContent("CONVERSATION$SHOW_ALL");
+ await user.click(toggle);
+
+ cards = await screen.findAllByTestId("conversation-card");
+ expect(cards).toHaveLength(2);
+ expect(toggle).toHaveTextContent("CONVERSATION$HIDE");
+
+ await user.click(toggle);
+ cards = await screen.findAllByTestId("conversation-card");
+ expect(cards).toHaveLength(1);
+ });
+
+ it("delete-all confirms then deletes every older conversation", async () => {
+ const user = userEvent.setup();
+ const deleteSpy = vi
+ .spyOn(AgentServerConversationService, "deleteConversation")
+ .mockResolvedValue();
+
+ vi.spyOn(
+ AgentServerConversationService,
+ "searchConversations",
+ ).mockResolvedValue({
+ items: [
+ createMockConversation({
+ id: "recent",
+ title: "Recent",
+ updated_at: recentIso(),
+ }),
+ createMockConversation({
+ id: "old1",
+ title: "Old 1",
+ updated_at: olderIso(),
+ }),
+ createMockConversation({
+ id: "old2",
+ title: "Old 2",
+ updated_at: olderIso(),
+ }),
+ ],
+ next_page_id: null,
+ });
+
+ renderConversationPanel();
+ await screen.findAllByTestId("conversation-card");
+
+ await user.click(screen.getByTestId("delete-older-conversations"));
+
+ const confirmButton = await screen.findByRole("button", {
+ name: /confirm/i,
+ });
+ expect(confirmButton).toBeInTheDocument();
+
+ await user.click(confirmButton);
+
+ await waitFor(() => {
+ expect(deleteSpy).toHaveBeenCalledTimes(2);
+ });
+ expect(deleteSpy).toHaveBeenCalledWith("old1");
+ expect(deleteSpy).toHaveBeenCalledWith("old2");
+ });
+
+ it("shows an error toast and still navigates away when the active older conversation was deleted successfully", async () => {
+ const user = userEvent.setup();
+ const navigate = vi.fn();
+ const deleteSpy = vi
+ .spyOn(AgentServerConversationService, "deleteConversation")
+ .mockResolvedValueOnce(undefined)
+ .mockRejectedValueOnce(new Error("delete failed"));
+
+ vi.spyOn(
+ AgentServerConversationService,
+ "searchConversations",
+ ).mockResolvedValue({
+ items: [
+ createMockConversation({
+ id: "recent",
+ title: "Recent",
+ updated_at: recentIso(),
+ }),
+ createMockConversation({
+ id: "old1",
+ title: "Old 1",
+ updated_at: olderIso(),
+ }),
+ createMockConversation({
+ id: "old2",
+ title: "Old 2",
+ updated_at: olderIso(),
+ }),
+ ],
+ next_page_id: null,
+ });
+
+ renderConversationPanel({
+ navigation: { conversationId: "old1", navigate },
+ });
+ await screen.findAllByTestId("conversation-card");
+
+ await user.click(screen.getByTestId("delete-older-conversations"));
+ await user.click(await screen.findByRole("button", { name: /confirm/i }));
+
+ await waitFor(() => {
+ expect(deleteSpy).toHaveBeenCalledTimes(2);
+ });
+ expect(deleteSpy).toHaveBeenNthCalledWith(1, "old1");
+ expect(deleteSpy).toHaveBeenNthCalledWith(2, "old2");
+ expect(displayErrorToast).toHaveBeenCalledWith(
+ "1 conversation could not be deleted.",
+ );
+ expect(navigate).toHaveBeenCalledWith("/conversations");
+ });
+
+ it("does not navigate away when the active older conversation fails to delete", async () => {
+ const user = userEvent.setup();
+ const navigate = vi.fn();
+ const deleteSpy = vi
+ .spyOn(AgentServerConversationService, "deleteConversation")
+ .mockResolvedValueOnce(undefined)
+ .mockRejectedValueOnce(new Error("delete failed"));
+
+ vi.spyOn(
+ AgentServerConversationService,
+ "searchConversations",
+ ).mockResolvedValue({
+ items: [
+ createMockConversation({
+ id: "recent",
+ title: "Recent",
+ updated_at: recentIso(),
+ }),
+ createMockConversation({
+ id: "old1",
+ title: "Old 1",
+ updated_at: olderIso(),
+ }),
+ createMockConversation({
+ id: "old2",
+ title: "Old 2",
+ updated_at: olderIso(),
+ }),
+ ],
+ next_page_id: null,
+ });
+
+ renderConversationPanel({
+ navigation: { conversationId: "old2", navigate },
+ });
+ await screen.findAllByTestId("conversation-card");
+
+ await user.click(screen.getByTestId("delete-older-conversations"));
+ await user.click(await screen.findByRole("button", { name: /confirm/i }));
+
+ await waitFor(() => {
+ expect(deleteSpy).toHaveBeenCalledTimes(2);
+ });
+ expect(deleteSpy).toHaveBeenNthCalledWith(1, "old1");
+ expect(deleteSpy).toHaveBeenNthCalledWith(2, "old2");
+ expect(displayErrorToast).toHaveBeenCalledWith(
+ "1 conversation could not be deleted.",
+ );
+ expect(navigate).not.toHaveBeenCalled();
+ });
+ });
+
+ describe("active conversation highlight", () => {
+ it("marks the currently active conversation with data-active=true", async () => {
+ vi.spyOn(
+ AgentServerConversationService,
+ "searchConversations",
+ ).mockResolvedValue({
+ items: [
+ createMockConversation({ id: "1", title: "Conversation 1" }),
+ createMockConversation({ id: "2", title: "Conversation 2" }),
+ createMockConversation({ id: "3", title: "Conversation 3" }),
+ ],
+ next_page_id: null,
+ });
+
+ renderWithProviders(<RouterStub />, {
+ navigation: { conversationId: "2", currentPath: "/conversations/2" },
+ });
+
+ const cards = await screen.findAllByTestId("conversation-card");
+ expect(cards).toHaveLength(3);
+ expect(cards[0]).toHaveAttribute("data-active", "false");
+ expect(cards[1]).toHaveAttribute("data-active", "true");
+ expect(cards[2]).toHaveAttribute("data-active", "false");
+ });
+
+ it("renders no active card when no conversation is selected", async () => {
+ vi.spyOn(
+ AgentServerConversationService,
+ "searchConversations",
+ ).mockResolvedValue({
+ items: [createMockConversation({ id: "1", title: "Conversation 1" })],
+ next_page_id: null,
+ });
+
+ renderWithProviders(<RouterStub />, {
+ navigation: { conversationId: null, currentPath: "/" },
+ });
+
+ const cards = await screen.findAllByTestId("conversation-card");
+ expect(cards[0]).toHaveAttribute("data-active", "false");
+ });
+ });
+
+ describe("load-more link", () => {
+ const recentIso = () => new Date().toISOString();
+ const olderIso = () =>
+ new Date(Date.now() - 2 * 60 * 60 * 1000).toISOString();
+
+ it("shows a load-more link when there is a next page and no older conversations are hidden", async () => {
+ vi.spyOn(
+ AgentServerConversationService,
+ "searchConversations",
+ ).mockResolvedValue({
+ items: [
+ createMockConversation({
+ id: "recent",
+ title: "Recent",
+ updated_at: recentIso(),
+ }),
+ ],
+ next_page_id: "page-2",
+ });
+
+ renderConversationPanel();
+
+ await screen.findAllByTestId("conversation-card");
+ const loadMore = await screen.findByTestId("load-more-conversations");
+ expect(loadMore).toHaveTextContent("CONVERSATION$LOAD_MORE");
+ });
+
+ it("hides the load-more link while older conversations are hidden", async () => {
+ vi.spyOn(
+ AgentServerConversationService,
+ "searchConversations",
+ ).mockResolvedValue({
+ items: [
+ createMockConversation({
+ id: "recent",
+ title: "Recent",
+ updated_at: recentIso(),
+ }),
+ createMockConversation({
+ id: "old1",
+ title: "Old 1",
+ updated_at: olderIso(),
+ }),
+ ],
+ next_page_id: "page-2",
+ });
+
+ renderConversationPanel();
+
+ await screen.findAllByTestId("conversation-card");
+ // Older conversations are present and collapsed → no load-more.
+ expect(
+ screen.queryByTestId("load-more-conversations"),
+ ).not.toBeInTheDocument();
+
+ // After expanding "show all", the link reappears.
+ const user = userEvent.setup();
+ await user.click(screen.getByTestId("toggle-older-conversations"));
+ expect(
+ await screen.findByTestId("load-more-conversations"),
+ ).toBeInTheDocument();
+ });
+
+ it("fetches the next page when the load-more link is clicked", async () => {
+ const user = userEvent.setup();
+ const searchSpy = vi
+ .spyOn(AgentServerConversationService, "searchConversations")
+ .mockResolvedValueOnce({
+ items: [
+ createMockConversation({
+ id: "recent",
+ title: "Recent",
+ updated_at: recentIso(),
+ }),
+ ],
+ next_page_id: "page-2",
+ })
+ .mockResolvedValueOnce({
+ items: [
+ createMockConversation({
+ id: "page2-1",
+ title: "Page 2 Conversation",
+ updated_at: recentIso(),
+ }),
+ ],
+ next_page_id: null,
+ });
+
+ renderConversationPanel();
+
+ const loadMore = await screen.findByTestId("load-more-conversations");
+ await user.click(loadMore);
+
+ await waitFor(() => {
+ expect(searchSpy).toHaveBeenCalledTimes(2);
+ });
+
+ // After the second page resolves, the link disappears (no more pages).
+ await waitFor(() => {
+ expect(
+ screen.queryByTestId("load-more-conversations"),
+ ).not.toBeInTheDocument();
+ });
+ });
+ });
});
diff --git a/__tests__/components/features/conversation-panel/new-conversation-button.test.tsx b/__tests__/components/features/conversation-panel/new-conversation-button.test.tsx
new file mode 100644
index 0000000000..0d41206364
--- /dev/null
+++ b/__tests__/components/features/conversation-panel/new-conversation-button.test.tsx
@@ -0,0 +1,215 @@
+import { screen, waitFor } from "@testing-library/react";
+import userEvent from "@testing-library/user-event";
+import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
+
+import { renderWithProviders } from "test-utils";
+import AgentServerConversationService from "#/api/conversation-service/agent-server-conversation-service.api";
+import { NewConversationButton } from "#/components/features/conversation-panel/new-conversation-button";
+import { useWorkspacesStore } from "#/stores/workspaces-store";
+
+vi.mock("#/hooks/use-tracking", () => ({
+ useTracking: () => ({
+ trackConversationCreated: vi.fn(),
+ }),
+}));
+
+vi.mock(
+ "#/components/features/home/workspace-dropdown/folder-browser-modal",
+ () => ({
+ FolderBrowserModal: ({ isOpen }: { isOpen: boolean }) =>
+ isOpen ? <div data-testid="folder-browser-modal" /> : null,
+ }),
+);
+
+vi.mock(
+ "#/components/features/home/workspace-dropdown/manage-workspaces-modal",
+ () => ({
+ ManageWorkspacesModal: ({ isOpen }: { isOpen: boolean }) =>
+ isOpen ? <div data-testid="manage-workspaces-modal" /> : null,
+ }),
+);
+
+const makeStartTask = (conversationId: string) => ({
+ id: "task-id",
+ created_by_user_id: null,
+ status: "READY" as const,
+ detail: null,
+ app_conversation_id: conversationId,
+ agent_server_url: "http://agent-server.local",
+ request: {
+ initial_message: null,
+ processors: [],
+ llm_model: null,
+ selected_repository: null,
+ selected_branch: null,
+ git_provider: "github" as const,
+ suggested_task: null,
+ title: null,
+ trigger: null,
+ pr_number: [],
+ parent_conversation_id: null,
+ agent_type: "default" as const,
+ },
+ created_at: new Date().toISOString(),
+ updated_at: new Date().toISOString(),
+});
+
+describe("NewConversationButton", () => {
+ beforeEach(() => {
+ window.localStorage.clear();
+ useWorkspacesStore.getState().clearAll();
+ });
+
+ afterEach(() => {
+ vi.restoreAllMocks();
+ window.localStorage.clear();
+ useWorkspacesStore.getState().clearAll();
+ });
+
+ it("toggles the popover and dismisses it on outside click", async () => {
+ const user = userEvent.setup();
+ renderWithProviders(<NewConversationButton />);
+
+ await user.click(screen.getByTestId("new-conversation-button"));
+ expect(screen.getByTestId("new-conversation-popover")).toBeInTheDocument();
+
+ await user.click(document.body);
+ await waitFor(() => {
+ expect(
+ screen.queryByTestId("new-conversation-popover"),
+ ).not.toBeInTheDocument();
+ });
+ });
+
+ it("dismisses the popover on Escape", async () => {
+ const user = userEvent.setup();
+ renderWithProviders(<NewConversationButton />);
+
+ await user.click(screen.getByTestId("new-conversation-button"));
+ expect(screen.getByTestId("new-conversation-popover")).toBeInTheDocument();
+
+ await user.keyboard("{Escape}");
+ await waitFor(() => {
+ expect(
+ screen.queryByTestId("new-conversation-popover"),
+ ).not.toBeInTheDocument();
+ });
+ });
+
+ it("launches a conversation for the selected workspace", async () => {
+ useWorkspacesStore.getState().addWorkspaces([
+ {
+ id: "/workspace/project/repo1",
+ name: "repo1",
+ path: "/workspace/project/repo1",
+ },
+ ]);
+ const navigate = vi.fn();
+ const createSpy = vi
+ .spyOn(AgentServerConversationService, "createConversation")
+ .mockResolvedValue(makeStartTask("conv-123"));
+
+ const user = userEvent.setup();
+ renderWithProviders(<NewConversationButton />, {
+ navigation: { navigate, currentPath: "/conversations" },
+ });
+
+ await user.click(screen.getByTestId("new-conversation-button"));
+ await user.click(screen.getByRole("button", { name: "repo1" }));
+
+ await waitFor(() => {
+ expect(createSpy).toHaveBeenCalledWith(
+ undefined,
+ undefined,
+ undefined,
+ null,
+ "/workspace/project/repo1",
+ undefined,
+ undefined,
+ );
+ });
+ await waitFor(() => {
+ expect(navigate).toHaveBeenCalledWith("/conversations/conv-123");
+ });
+ });
+
+ it("disables launch actions while a conversation is being created", async () => {
+ useWorkspacesStore.getState().addWorkspaces([
+ {
+ id: "/workspace/project/repo1",
+ name: "repo1",
+ path: "/workspace/project/repo1",
+ },
+ ]);
+ vi.spyOn(AgentServerConversationService, "createConversation").mockImplementation(
+ () => new Promise(() => {}),
+ );
+
+ const user = userEvent.setup();
+ renderWithProviders(<NewConversationButton />);
+
+ await user.click(screen.getByTestId("new-conversation-button"));
+ await user.click(screen.getByTestId("launch-no-workspace"));
+
+ await waitFor(() => {
+ expect(screen.getByTestId("launch-no-workspace")).toBeDisabled();
+ expect(screen.getByTestId("launch-workspace")).toBeDisabled();
+ });
+ });
+
+ it("keeps the popover open while the add workspace modal is open", async () => {
+ const user = userEvent.setup();
+ renderWithProviders(<NewConversationButton />);
+
+ await user.click(screen.getByTestId("new-conversation-button"));
+ await user.click(screen.getByTestId("add-workspaces-button"));
+
+ expect(screen.getByTestId("folder-browser-modal")).toBeInTheDocument();
+ await user.click(document.body);
+ expect(screen.getByTestId("new-conversation-popover")).toBeInTheDocument();
+ });
+
+ it("keeps the popover open while the manage workspaces modal is open", async () => {
+ useWorkspacesStore.getState().addWorkspaces([
+ {
+ id: "/workspace/project/repo1",
+ name: "repo1",
+ path: "/workspace/project/repo1",
+ },
+ ]);
+ const user = userEvent.setup();
+ renderWithProviders(<NewConversationButton />);
+
+ await user.click(screen.getByTestId("new-conversation-button"));
+ await user.click(screen.getByTestId("manage-workspaces-button"));
+
+ expect(screen.getByTestId("manage-workspaces-modal")).toBeInTheDocument();
+ await user.click(document.body);
+ expect(screen.getByTestId("new-conversation-popover")).toBeInTheDocument();
+ });
+
+ it("keeps the popover open when conversation creation fails", async () => {
+ const navigate = vi.fn();
+ const createSpy = vi
+ .spyOn(AgentServerConversationService, "createConversation")
+ .mockRejectedValue(new Error("create failed"));
+
+ const user = userEvent.setup();
+ renderWithProviders(<NewConversationButton />, {
+ navigation: { navigate, currentPath: "/conversations" },
+ });
+
+ await user.click(screen.getByTestId("new-conversation-button"));
+ await user.click(screen.getByTestId("launch-no-workspace"));
+
+ await waitFor(() => {
+ expect(createSpy).toHaveBeenCalledTimes(1);
+ });
+ await waitFor(() => {
+ expect(screen.getByTestId("launch-no-workspace")).not.toBeDisabled();
+ });
+
+ expect(navigate).not.toHaveBeenCalled();
+ expect(screen.getByTestId("new-conversation-popover")).toBeInTheDocument();
+ });
+});
diff --git a/__tests__/components/features/conversation/conversation-main.test.tsx b/__tests__/components/features/conversation/conversation-main.test.tsx
index f025e8ff8b..7d502ee206 100644
--- a/__tests__/components/features/conversation/conversation-main.test.tsx
+++ b/__tests__/components/features/conversation/conversation-main.test.tsx
@@ -48,6 +48,25 @@ vi.mock(
}),
);
+// ConversationMain now renders the conversation name and tabs inline as the
+// pane headers; both reach into route/store state we don't set up here, so
+// stub them out for layout-stability tests.
+vi.mock(
+ "#/components/features/conversation/conversation-name-with-status",
+ () => ({
+ ConversationNameWithStatus: () => (
+ <div data-testid="conversation-name-with-status" />
+ ),
+ }),
+);
+
+vi.mock(
+ "#/components/features/conversation/conversation-tabs/conversation-tabs",
+ () => ({
+ ConversationTabs: () => <div data-testid="conversation-tabs" />,
+ }),
+);
+
import { ConversationMain } from "#/components/features/conversation/conversation-main/conversation-main";
describe("ConversationMain - Layout Transition Stability", () => {
diff --git a/__tests__/components/features/conversation/conversation-name-context-menu.test.tsx b/__tests__/components/features/conversation/conversation-name-context-menu.test.tsx
new file mode 100644
index 0000000000..d5ef6db16b
--- /dev/null
+++ b/__tests__/components/features/conversation/conversation-name-context-menu.test.tsx
@@ -0,0 +1,184 @@
+import React from "react";
+import { screen } from "@testing-library/react";
+import { renderToStaticMarkup } from "react-dom/server";
+import { afterEach, describe, expect, it, vi } from "vitest";
+
+import { renderWithProviders } from "test-utils";
+import { ConversationNameContextMenu } from "#/components/features/conversation/conversation-name-context-menu";
+
+vi.mock("#/hooks/use-breakpoint", () => ({
+ useBreakpoint: () => false,
+}));
+
+vi.mock("#/contexts/active-backend-context", () => ({
+ useActiveBackend: () => ({
+ backend: {
+ id: "bundled",
+ name: "Bundled",
+ host: "http://localhost:3000",
+ apiKey: "",
+ kind: "local",
+ },
+ orgId: null,
+ }),
+}));
+
+vi.mock("#/hooks/query/use-active-conversation", () => ({
+ useActiveConversation: () => ({
+ data: {
+ public: false,
+ },
+ }),
+}));
+
+function createAnchor(rect: Partial<DOMRect> = {}) {
+ const anchor = document.createElement("button");
+ anchor.dataset.testAnchor = "true";
+ Object.defineProperty(anchor, "getBoundingClientRect", {
+ value: () => ({
+ x: 12,
+ y: 20,
+ top: 20,
+ right: 112,
+ bottom: 48,
+ left: 12,
+ width: 100,
+ height: 28,
+ toJSON: () => ({}),
+ ...rect,
+ }),
+ });
+ document.body.appendChild(anchor);
+ return anchor;
+}
+
+describe("ConversationNameContextMenu portal rendering", () => {
+ afterEach(() => {
+ document
+ .querySelectorAll('[data-test-anchor="true"]')
+ .forEach((anchor) => anchor.remove());
+ vi.restoreAllMocks();
+ });
+
+ it("renders inline when no anchor ref is provided", () => {
+ const { container } = renderWithProviders(
+ <ConversationNameContextMenu onClose={vi.fn()} onRename={vi.fn()} />,
+ );
+
+ expect(
+ container.contains(screen.getByTestId("conversation-name-context-menu")),
+ ).toBe(true);
+ });
+
+ it("renders in a portal and positions below the anchor when provided", () => {
+ const anchor = createAnchor();
+ const { container } = renderWithProviders(
+ <ConversationNameContextMenu
+ onClose={vi.fn()}
+ onRename={vi.fn()}
+ anchorRef={{ current: anchor }}
+ />,
+ );
+
+ const menu = screen.getByTestId("conversation-name-context-menu");
+ expect(container.contains(menu)).toBe(false);
+
+ const wrapper = menu.parentElement as HTMLDivElement;
+ expect(wrapper.style.left).toBe("12px");
+ expect(wrapper.style.top).toBe("56px");
+ });
+
+ it("positions above the anchor for top-aligned menus", () => {
+ const anchor = createAnchor({ top: 120, bottom: 148 });
+ Object.defineProperty(window, "innerHeight", {
+ configurable: true,
+ value: 800,
+ });
+
+ renderWithProviders(
+ <ConversationNameContextMenu
+ onClose={vi.fn()}
+ onRename={vi.fn()}
+ position="top"
+ anchorRef={{ current: anchor }}
+ />,
+ );
+
+ const wrapper = screen.getByTestId("conversation-name-context-menu")
+ .parentElement as HTMLDivElement;
+ expect(wrapper.style.bottom).toBe("688px");
+ });
+
+ it("repositions when the anchored element changes between renders", () => {
+ const firstAnchor = createAnchor({ left: 12, top: 20, bottom: 48 });
+ const secondAnchor = createAnchor({ left: 64, top: 80, bottom: 112 });
+ const { rerender } = renderWithProviders(
+ <ConversationNameContextMenu
+ onClose={vi.fn()}
+ onRename={vi.fn()}
+ anchorRef={{ current: firstAnchor }}
+ />,
+ );
+
+ rerender(
+ <ConversationNameContextMenu
+ onClose={vi.fn()}
+ onRename={vi.fn()}
+ anchorRef={{ current: secondAnchor }}
+ />,
+ );
+
+ const wrapper = screen.getByTestId("conversation-name-context-menu")
+ .parentElement as HTMLDivElement;
+ expect(wrapper.style.left).toBe("64px");
+ expect(wrapper.style.top).toBe("120px");
+ });
+
+ it("registers and cleans up resize/scroll listeners for anchored menus", () => {
+ const addEventListenerSpy = vi.spyOn(window, "addEventListener");
+ const removeEventListenerSpy = vi.spyOn(window, "removeEventListener");
+ const anchor = createAnchor();
+
+ const { unmount } = renderWithProviders(
+ <ConversationNameContextMenu
+ onClose={vi.fn()}
+ onRename={vi.fn()}
+ anchorRef={{ current: anchor }}
+ />,
+ );
+
+ expect(addEventListenerSpy).toHaveBeenCalledWith(
+ "resize",
+ expect.any(Function),
+ );
+ expect(addEventListenerSpy).toHaveBeenCalledWith(
+ "scroll",
+ expect.any(Function),
+ true,
+ );
+
+ unmount();
+
+ expect(removeEventListenerSpy).toHaveBeenCalledWith(
+ "resize",
+ expect.any(Function),
+ );
+ expect(removeEventListenerSpy).toHaveBeenCalledWith(
+ "scroll",
+ expect.any(Function),
+ true,
+ );
+ });
+
+ it("returns null during static rendering before portal coordinates exist", () => {
+ const html = renderToStaticMarkup(
+ <ConversationNameContextMenu
+ onClose={vi.fn()}
+ onRename={vi.fn()}
+ anchorRef={{ current: {} as HTMLElement }}
+ />,
+ );
+
+ expect(html).toBe("");
+ });
+});
diff --git a/__tests__/components/features/conversation/conversation-name.test.tsx b/__tests__/components/features/conversation/conversation-name.test.tsx
index 153f0404b5..8e9d122a06 100644
--- a/__tests__/components/features/conversation/conversation-name.test.tsx
+++ b/__tests__/components/features/conversation/conversation-name.test.tsx
@@ -327,7 +327,7 @@ describe("ConversationName", () => {
).not.toBeInTheDocument();
});
- it("should render the llm model when available", () => {
+ it("should not render the llm model in the title bar", () => {
useActiveConversationMock.mockReturnValue({
data: {
conversation_id: "test-conversation-id",
@@ -339,33 +339,6 @@ describe("ConversationName", () => {
renderConversationNameWithRouter();
- const model = screen.getByTestId("conversation-name-llm-model");
- expect(model).toBeInTheDocument();
- expect(model).toHaveTextContent("openai/gpt-4o");
- expect(model).toHaveAttribute("title", "openai/gpt-4o");
- expect(model.querySelector("svg")).toBeInTheDocument();
-
- // Verify the model name is rendered in full (no truncation)
- const textSpan = model.querySelector("span");
- expect(textSpan).toBeInTheDocument();
- expect(textSpan).toHaveTextContent("openai/gpt-4o");
- expect(textSpan).not.toHaveClass("truncate");
- expect(model).not.toHaveClass("max-w-[150px]");
- expect(model).not.toHaveClass("overflow-hidden");
- expect(model).toHaveClass("whitespace-nowrap");
- });
-
- it("should not render the llm model when not available", () => {
- useActiveConversationMock.mockReturnValue({
- data: {
- conversation_id: "test-conversation-id",
- title: "Test Conversation",
- status: "RUNNING",
- },
- });
-
- renderConversationNameWithRouter();
-
expect(
screen.queryByTestId("conversation-name-llm-model"),
).not.toBeInTheDocument();
diff --git a/__tests__/components/features/home/conversation-status-dot.test.tsx b/__tests__/components/features/home/conversation-status-dot.test.tsx
new file mode 100644
index 0000000000..8e9430daf2
--- /dev/null
+++ b/__tests__/components/features/home/conversation-status-dot.test.tsx
@@ -0,0 +1,55 @@
+import type { ReactNode } from "react";
+import { screen } from "@testing-library/react";
+import { describe, expect, it, vi } from "vitest";
+
+import { renderWithProviders } from "test-utils";
+import { ConversationStatusDot } from "#/components/features/home/recent-conversations/conversation-status-dot";
+import { ExecutionStatus } from "#/types/agent-server/core/base/common";
+
+vi.mock("#/components/shared/buttons/styled-tooltip", () => ({
+ StyledTooltip: ({
+ children,
+ content,
+ }: {
+ children: ReactNode;
+ content: string;
+ }) => (
+ <div data-testid="styled-tooltip" data-content={content}>
+ {children}
+ </div>
+ ),
+}));
+
+describe("ConversationStatusDot", () => {
+ it.each([
+ [ExecutionStatus.FINISHED, "conversation-status-check", "COMMON$FINISHED"],
+ [ExecutionStatus.RUNNING, "conversation-status-working", "COMMON$WORKING"],
+ [ExecutionStatus.PAUSED, "conversation-status-paused", "COMMON$PAUSED"],
+ [ExecutionStatus.IDLE, "conversation-status-paused", "COMMON$PAUSED"],
+ [
+ ExecutionStatus.WAITING_FOR_CONFIRMATION,
+ "conversation-status-paused",
+ "COMMON$PAUSED",
+ ],
+ [ExecutionStatus.ERROR, "conversation-status-error", "COMMON$ERROR"],
+ [ExecutionStatus.STUCK, "conversation-status-error", "COMMON$ERROR"],
+ ])("renders %s as %s", (status, testId, tooltipLabel) => {
+ renderWithProviders(<ConversationStatusDot executionStatus={status} />);
+
+ expect(screen.getByTestId(testId)).toBeInTheDocument();
+ expect(screen.getByTestId("styled-tooltip")).toHaveAttribute(
+ "data-content",
+ tooltipLabel,
+ );
+ });
+
+ it("renders the unknown state for missing execution status", () => {
+ renderWithProviders(<ConversationStatusDot executionStatus={undefined} />);
+
+ expect(screen.getByTestId("conversation-status-unknown")).toBeInTheDocument();
+ expect(screen.getByTestId("styled-tooltip")).toHaveAttribute(
+ "data-content",
+ "COMMON$STOPPED",
+ );
+ });
+});
diff --git a/__tests__/components/features/home/recent-conversation.test.tsx b/__tests__/components/features/home/recent-conversation.test.tsx
index fdeba1b06a..204383d21a 100644
--- a/__tests__/components/features/home/recent-conversation.test.tsx
+++ b/__tests__/components/features/home/recent-conversation.test.tsx
@@ -48,30 +48,12 @@ const renderRecentConversation = (conversation: AppConversation) =>
renderWithProviders(<RecentConversation conversation={conversation} />);
describe("RecentConversation - llm_model", () => {
- it("should render the llm model when provided", () => {
+ it("should not render the llm model even when provided", () => {
renderRecentConversation({
...baseConversation,
llm_model: "anthropic/claude-sonnet-4-20250514",
});
- const model = screen.getByTestId("recent-conversation-llm-model");
- expect(model).toBeInTheDocument();
- expect(model).toHaveTextContent("anthropic/claude-sonnet-4-20250514");
- expect(model).toHaveAttribute(
- "title",
- "anthropic/claude-sonnet-4-20250514",
- );
- expect(model.querySelector("svg")).toBeInTheDocument();
-
- // Verify truncation structure: text is wrapped in a span with truncate class
- const textSpan = model.querySelector("span.truncate");
- expect(textSpan).toBeInTheDocument();
- expect(textSpan).toHaveTextContent("anthropic/claude-sonnet-4-20250514");
- });
-
- it("should not render the llm model when not provided", () => {
- renderRecentConversation(baseConversation);
-
expect(
screen.queryByTestId("recent-conversation-llm-model"),
).not.toBeInTheDocument();
diff --git a/__tests__/components/features/home/repo-connector.test.tsx b/__tests__/components/features/home/repo-connector.test.tsx
index 204469cc51..356818b416 100644
--- a/__tests__/components/features/home/repo-connector.test.tsx
+++ b/__tests__/components/features/home/repo-connector.test.tsx
@@ -1,13 +1,6 @@
import { render, screen } from "@testing-library/react";
-import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
+import { beforeEach, describe, expect, it, vi } from "vitest";
-import {
- __resetActiveStoreForTests,
- setActiveSelection,
- setRegisteredBackends,
-} from "#/api/backend-registry/active-store";
-import type { Backend } from "#/api/backend-registry/types";
-import { ActiveBackendProvider } from "#/contexts/active-backend-context";
import { RepoConnector } from "#/components/features/home/repo-connector";
const mockUseUserProviders = vi.fn();
@@ -16,77 +9,21 @@ vi.mock("#/hooks/use-user-providers", () => ({
useUserProviders: () => mockUseUserProviders(),
}));
-vi.mock("#/components/features/home/repo-selection-form", () => ({
- RepositorySelectionForm: () => <div data-testid="stub-repo-form" />,
-}));
-
vi.mock("#/components/features/home/workspace-selection-form", () => ({
WorkspaceSelectionForm: () => <div data-testid="stub-workspace-form" />,
}));
-const cloudBackend: Backend = {
- id: "prod",
- name: "Production",
- host: "https://app.all-hands.dev",
- apiKey: "k",
- kind: "cloud",
-};
-
-function renderRepoConnector() {
- return render(
- <ActiveBackendProvider>
- <RepoConnector onRepoSelection={() => {}} />
- </ActiveBackendProvider>,
- );
-}
-
-beforeEach(() => {
- window.localStorage.clear();
- __resetActiveStoreForTests();
- mockUseUserProviders.mockReturnValue({
- isLoadingSettings: false,
- providers: ["github"],
- });
-});
-
-afterEach(() => {
- window.localStorage.clear();
- __resetActiveStoreForTests();
-});
-
describe("RepoConnector", () => {
- it("shows the workspace launcher for local backends", () => {
- renderRepoConnector();
-
- expect(screen.getByTestId("stub-workspace-form")).toBeInTheDocument();
- expect(screen.queryByTestId("stub-repo-form")).not.toBeInTheDocument();
- });
-
- it("shows the repository launcher for cloud backends with providers", () => {
- setRegisteredBackends([cloudBackend]);
- setActiveSelection({ backendId: cloudBackend.id });
-
- renderRepoConnector();
-
- expect(screen.getByTestId("stub-repo-form")).toBeInTheDocument();
- expect(
- screen.queryByTestId("stub-workspace-form"),
- ).not.toBeInTheDocument();
- });
-
- it("does not render the repository launcher for cloud backends without providers", () => {
- setRegisteredBackends([cloudBackend]);
- setActiveSelection({ backendId: cloudBackend.id });
+ beforeEach(() => {
mockUseUserProviders.mockReturnValue({
isLoadingSettings: false,
- providers: [],
+ providers: ["github"],
});
+ });
- renderRepoConnector();
+ it("always shows the workspace launcher for the agent-server build", () => {
+ render(<RepoConnector />);
- expect(screen.queryByTestId("stub-repo-form")).not.toBeInTheDocument();
- expect(
- screen.queryByTestId("stub-workspace-form"),
- ).not.toBeInTheDocument();
+ expect(screen.getByTestId("stub-workspace-form")).toBeInTheDocument();
});
});
diff --git a/__tests__/components/features/settings/webhook-status-badge.test.tsx b/__tests__/components/features/settings/webhook-status-badge.test.tsx
new file mode 100644
index 0000000000..361c0d2590
--- /dev/null
+++ b/__tests__/components/features/settings/webhook-status-badge.test.tsx
@@ -0,0 +1,97 @@
+import { render, screen } from "@testing-library/react";
+import { describe, expect, it, vi } from "vitest";
+import { WebhookStatusBadge } from "#/components/features/settings/git-settings/webhook-status-badge";
+
+// Mock react-i18next
+vi.mock("react-i18next", () => ({
+ useTranslation: () => ({
+ t: (key: string) => key,
+ }),
+}));
+
+describe("WebhookStatusBadge", () => {
+ it("should display installed status when webhook is installed", () => {
+ // Arrange
+ const props = {
+ webhookInstalled: true,
+ };
+
+ // Act
+ render(<WebhookStatusBadge {...props} />);
+
+ // Assert
+ const badge = screen.getByText("GITLAB$WEBHOOK_STATUS_INSTALLED");
+ expect(badge).toBeInTheDocument();
+ });
+
+ it("should display not installed status when webhook is not installed", () => {
+ // Arrange
+ const props = {
+ webhookInstalled: false,
+ };
+
+ // Act
+ render(<WebhookStatusBadge {...props} />);
+
+ // Assert
+ const badge = screen.getByText("GITLAB$WEBHOOK_STATUS_NOT_INSTALLED");
+ expect(badge).toBeInTheDocument();
+ });
+
+ it("should display installed status when installation result is successful", () => {
+ // Arrange
+ const props = {
+ webhookInstalled: false,
+ installationResult: {
+ success: true,
+ error: null,
+ },
+ };
+
+ // Act
+ render(<WebhookStatusBadge {...props} />);
+
+ // Assert
+ const badge = screen.getByText("GITLAB$WEBHOOK_STATUS_INSTALLED");
+ expect(badge).toBeInTheDocument();
+ });
+
+ it("should display failed status when installation result has error", () => {
+ // Arrange
+ const props = {
+ webhookInstalled: false,
+ installationResult: {
+ success: false,
+ error: "Installation failed",
+ },
+ };
+
+ // Act
+ render(<WebhookStatusBadge {...props} />);
+
+ // Assert
+ const badge = screen.getByText("GITLAB$WEBHOOK_STATUS_FAILED");
+ expect(badge).toBeInTheDocument();
+ });
+
+ it("should show error message when installation fails", () => {
+ // Arrange
+ const errorMessage = "Permission denied";
+ const props = {
+ webhookInstalled: false,
+ installationResult: {
+ success: false,
+ error: errorMessage,
+ },
+ };
+
+ // Act
+ render(<WebhookStatusBadge {...props} />);
+
+ // Assert
+ const badgeContainer = screen.getByText(
+ "GITLAB$WEBHOOK_STATUS_FAILED",
+ ).parentElement;
+ expect(badgeContainer).toHaveAttribute("title", errorMessage);
+ });
+});
diff --git a/__tests__/components/features/sidebar/sidebar.test.tsx b/__tests__/components/features/sidebar/sidebar.test.tsx
index 8ffef996f0..a7ec2814ac 100644
--- a/__tests__/components/features/sidebar/sidebar.test.tsx
+++ b/__tests__/components/features/sidebar/sidebar.test.tsx
@@ -66,6 +66,19 @@ vi.mock("#/components/shared/modals/settings/settings-modal", () => ({
SettingsModal: () => null,
}));
+vi.mock("#/components/features/backends/backend-selector", () => ({
+ BackendSelector: () => <div data-testid="backend-selector" />,
+}));
+
+vi.mock("#/components/features/sidebar/sidebar-conversation-list", () => ({
+ SidebarConversationList: () => <div data-testid="sidebar-conversation-list" />,
+}));
+
+vi.mock("#/hooks/use-settings-nav-items", () => ({
+ useSettingsNavItems: () => [],
+}));
+
+
function renderSidebar(currentPath: string) {
const value: NavigationContextValue = {
currentPath,
diff --git a/__tests__/components/user-actions.test.tsx b/__tests__/components/user-actions.test.tsx
deleted file mode 100644
index 98fe13e69e..0000000000
--- a/__tests__/components/user-actions.test.tsx
+++ /dev/null
@@ -1,84 +0,0 @@
-import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
-import { render, screen } from "@testing-library/react";
-import userEvent from "@testing-library/user-event";
-import { describe, expect, it, vi } from "vitest";
-import { MemoryRouter } from "react-router";
-import { UserActions } from "#/components/features/sidebar/user-actions";
-import { OSS_NAV_ITEMS } from "#/constants/settings-nav";
-import { ActiveBackendProvider } from "#/contexts/active-backend-context";
-
-vi.mock("#/hooks/use-settings-nav-items", () => ({
- useSettingsNavItems: () => [
- { type: "item", item: OSS_NAV_ITEMS[0] },
- { type: "item", item: OSS_NAV_ITEMS[5] },
- ],
-}));
-
-function renderUserActions() {
- return render(
- <MemoryRouter>
- <QueryClientProvider client={new QueryClient()}>
- <ActiveBackendProvider>
- <UserActions
- user={{ avatar_url: "https://example.com/avatar.png" }}
- />
- </ActiveBackendProvider>
- </QueryClientProvider>
- </MemoryRouter>,
- );
-}
-
-describe("UserActions", () => {
- it("shows the OSS user menu on hover without hosted-only actions", async () => {
- const user = userEvent.setup();
- renderUserActions();
-
- await user.hover(screen.getByTestId("user-actions"));
-
- expect(screen.getByTestId("user-context-menu")).toBeVisible();
- expect(screen.getByTestId("backend-selector")).toBeInTheDocument();
- expect(screen.getByTestId("add-backend-menu-item")).toBeInTheDocument();
- expect(screen.getByText("SETTINGS$NAV_LLM")).toBeInTheDocument();
- expect(screen.getByText("SETTINGS$NAV_APPLICATION")).toBeInTheDocument();
- expect(screen.getByText("SIDEBAR$DOCS")).toBeInTheDocument();
- expect(
- screen.queryByText("ACCOUNT_SETTINGS$LOGOUT"),
- ).not.toBeInTheDocument();
- expect(screen.queryByTestId("context-menu-cta")).not.toBeInTheDocument();
- });
-
- it("opens the Add Backend modal and hides the context menu when 'Add Backend' is clicked", async () => {
- const user = userEvent.setup();
- renderUserActions();
-
- await user.hover(screen.getByTestId("user-actions"));
- await user.click(screen.getByTestId("add-backend-menu-item"));
-
- expect(screen.getByTestId("add-backend-modal")).toBeInTheDocument();
-
- // While the modal is open, the menu wrapper must lose BOTH the
- // explicit visibility classes AND the `group-hover:*` classes — the
- // latter is what was keeping the menu visible even after the menu
- // state was closed.
- const wrapper = screen.getByTestId("user-context-menu-wrapper");
- expect(wrapper.className).not.toMatch(/(?:^|\s)opacity-100(?:\s|$)/);
- expect(wrapper.className).not.toMatch(
- /(?:^|\s)pointer-events-auto(?:\s|$)/,
- );
- expect(wrapper.className).not.toContain("group-hover:opacity-100");
- expect(wrapper.className).not.toContain("group-hover:pointer-events-auto");
- });
-
- it("survives extraneous keypresses while the modal is open (Escape does not close it)", async () => {
- const user = userEvent.setup();
- renderUserActions();
-
- await user.hover(screen.getByTestId("user-actions"));
- await user.click(screen.getByTestId("add-backend-menu-item"));
-
- expect(screen.getByTestId("add-backend-modal")).toBeInTheDocument();
-
- await user.keyboard("{Escape}");
- expect(screen.getByTestId("add-backend-modal")).toBeInTheDocument();
- });
-});
diff --git a/__tests__/hooks/mutation/use-add-git-providers.test.tsx b/__tests__/hooks/mutation/use-add-git-providers.test.tsx
new file mode 100644
index 0000000000..6e8c88d9de
--- /dev/null
+++ b/__tests__/hooks/mutation/use-add-git-providers.test.tsx
@@ -0,0 +1,70 @@
+import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
+import { renderHook } from "@testing-library/react";
+import React from "react";
+import { beforeEach, describe, expect, it, vi } from "vitest";
+import { SecretsService } from "#/api/secrets-service";
+import { useAddGitProviders } from "#/hooks/mutation/use-add-git-providers";
+import { Provider, ProviderToken } from "#/types/settings";
+
+const mockTrackGitProviderConnected = vi.fn();
+
+vi.mock("#/hooks/use-tracking", () => ({
+ useTracking: () => ({
+ trackGitProviderConnected: mockTrackGitProviderConnected,
+ }),
+}));
+
+const buildProviders = (
+ overrides: Partial<Record<Provider, ProviderToken>> = {},
+): Record<Provider, ProviderToken> => ({
+ github: { token: "", host: null },
+ gitlab: { token: "", host: null },
+ bitbucket: { token: "", host: null },
+ bitbucket_data_center: { token: "", host: null },
+ azure_devops: { token: "", host: null },
+ forgejo: { token: "", host: null },
+ ...overrides,
+});
+
+describe("useAddGitProviders", () => {
+ let queryClient: QueryClient;
+
+ beforeEach(() => {
+ vi.restoreAllMocks();
+ mockTrackGitProviderConnected.mockReset();
+ queryClient = new QueryClient({
+ defaultOptions: {
+ queries: { retry: false },
+ mutations: { retry: false },
+ },
+ });
+ });
+
+ it("invalidates personal settings queries after saving providers", async () => {
+ vi.spyOn(SecretsService, "addGitProvider").mockResolvedValue(undefined);
+
+ const personalSettingsQueryKey = ["settings", "personal"] as const;
+ queryClient.setQueryData(personalSettingsQueryKey, {
+ provider_tokens_set: {},
+ });
+
+ const invalidateSpy = vi.spyOn(queryClient, "invalidateQueries");
+
+ const wrapper = ({ children }: { children: React.ReactNode }) => (
+ <QueryClientProvider client={queryClient}>{children}</QueryClientProvider>
+ );
+
+ const { result } = renderHook(() => useAddGitProviders(), { wrapper });
+
+ await result.current.mutateAsync({
+ providers: buildProviders({
+ github: { token: "ghp_test_123", host: null },
+ }),
+ });
+
+ expect(invalidateSpy).toHaveBeenCalled();
+ expect(
+ queryClient.getQueryState(personalSettingsQueryKey)?.isInvalidated,
+ ).toBe(true);
+ });
+});
diff --git a/__tests__/hooks/use-settings-nav-items.test.tsx b/__tests__/hooks/use-settings-nav-items.test.tsx
index 98f0acbf10..b48979da48 100644
--- a/__tests__/hooks/use-settings-nav-items.test.tsx
+++ b/__tests__/hooks/use-settings-nav-items.test.tsx
@@ -57,7 +57,7 @@ describe("useSettingsNavItems", () => {
expect(paths).toContain("/settings/secrets");
});
- it("never lists the removed /settings/integrations entry", () => {
+ it("never lists removed settings sub-pages", () => {
useConfigMock.mockReturnValue({ data: createConfig() });
const { result } = renderHook(() => useSettingsNavItems());
@@ -65,6 +65,8 @@ describe("useSettingsNavItems", () => {
.filter((item) => item.type === "item")
.map((item) => (item.type === "item" ? item.item.to : null));
+ expect(paths).not.toContain("/settings/agent-server");
expect(paths).not.toContain("/settings/integrations");
+ expect(paths).not.toContain("/settings/skills");
});
});
diff --git a/__tests__/routes/git-settings.test.tsx b/__tests__/routes/git-settings.test.tsx
new file mode 100644
index 0000000000..1c8fa7fce2
--- /dev/null
+++ b/__tests__/routes/git-settings.test.tsx
@@ -0,0 +1,87 @@
+import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
+import { render, screen, waitFor } from "@testing-library/react";
+import userEvent from "@testing-library/user-event";
+import { beforeEach, describe, expect, it, vi } from "vitest";
+import SettingsService from "#/api/settings-service/settings-service.api";
+import { MOCK_DEFAULT_USER_SETTINGS } from "#/mocks/handlers";
+import { GitSettingsScreen } from "#/routes/git-settings";
+import { Settings } from "#/types/settings";
+
+function buildSettings(overrides: Partial<Settings> = {}): Settings {
+ return {
+ ...MOCK_DEFAULT_USER_SETTINGS,
+ ...overrides,
+ provider_tokens_set: {
+ ...MOCK_DEFAULT_USER_SETTINGS.provider_tokens_set,
+ ...overrides.provider_tokens_set,
+ },
+ agent_settings: {
+ ...MOCK_DEFAULT_USER_SETTINGS.agent_settings,
+ ...overrides.agent_settings,
+ },
+ };
+}
+
+function renderGitSettingsScreen() {
+ return render(<GitSettingsScreen />, {
+ wrapper: ({ children }) => (
+ <QueryClientProvider
+ client={new QueryClient({
+ defaultOptions: { queries: { retry: false } },
+ })}
+ >
+ {children}
+ </QueryClientProvider>
+ ),
+ });
+}
+
+describe("GitSettingsScreen", () => {
+ beforeEach(() => {
+ vi.restoreAllMocks();
+ });
+
+ it("renders OSS git provider token inputs", async () => {
+ vi.spyOn(SettingsService, "getSettings").mockResolvedValue(buildSettings());
+
+ renderGitSettingsScreen();
+
+ const githubTokenInput = await screen.findByTestId("github-token-input");
+
+ expect(githubTokenInput).toBeInTheDocument();
+ expect(screen.getByTestId("gitlab-token-input")).toBeInTheDocument();
+ expect(screen.getByTestId("submit-button")).toBeDisabled();
+ });
+
+ it("enables saving after a provider token changes", async () => {
+ vi.spyOn(SettingsService, "getSettings").mockResolvedValue(buildSettings());
+
+ renderGitSettingsScreen();
+
+ const user = userEvent.setup();
+ const githubTokenInput = await screen.findByTestId("github-token-input");
+ const submitButton = screen.getByTestId("submit-button");
+
+ expect(submitButton).toBeDisabled();
+
+ await user.type(githubTokenInput, "ghp_test_token");
+
+ expect(submitButton).toBeEnabled();
+ });
+
+ it("enables disconnecting when a provider is already configured", async () => {
+ vi.spyOn(SettingsService, "getSettings").mockResolvedValue(
+ buildSettings({
+ provider_tokens_set: {
+ github: "github.com",
+ },
+ }),
+ );
+
+ renderGitSettingsScreen();
+
+ await waitFor(() => {
+ expect(screen.getByTestId("disconnect-tokens-button")).toBeEnabled();
+ });
+ });
+});
\ No newline at end of file
diff --git a/__tests__/routes/launch.test.tsx b/__tests__/routes/launch.test.tsx
index ed9cc413c8..23ded2c635 100644
--- a/__tests__/routes/launch.test.tsx
+++ b/__tests__/routes/launch.test.tsx
@@ -332,7 +332,7 @@ describe("LaunchRoute", () => {
await user.click(screen.getByTestId("close-button"));
- expect(mockNavigate).toHaveBeenCalledWith("/");
+ expect(mockNavigate).toHaveBeenCalledWith("/conversations");
});
it("should show plugins section for plugins without parameters", () => {
@@ -533,7 +533,7 @@ describe("LaunchRoute", () => {
await user.click(screen.getByTestId("go-home-button"));
- expect(mockNavigate).toHaveBeenCalledWith("/");
+ expect(mockNavigate).toHaveBeenCalledWith("/conversations");
});
it("should show creation failed error when API call fails", async () => {
diff --git a/__tests__/routes/settings.test.tsx b/__tests__/routes/settings.test.tsx
index 61b915e98d..fc0baa272b 100644
--- a/__tests__/routes/settings.test.tsx
+++ b/__tests__/routes/settings.test.tsx
@@ -4,7 +4,12 @@ import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
import { createRoutesStub } from "react-router";
import SettingsScreen, { clientLoader } from "#/routes/settings";
import OptionService from "#/api/option-service/option-service.api";
-import { __resetActiveStoreForTests } from "#/api/backend-registry/active-store";
+import {
+ __resetActiveStoreForTests,
+ setActiveSelection,
+ setRegisteredBackends,
+} from "#/api/backend-registry/active-store";
+import type { Backend } from "#/api/backend-registry/types";
import { getFirstAvailablePath } from "#/utils/settings-utils";
import { OSS_NAV_ITEMS } from "#/constants/settings-nav";
import { ActiveBackendProvider } from "#/contexts/active-backend-context";
@@ -12,10 +17,18 @@ import { ActiveBackendProvider } from "#/contexts/active-backend-context";
vi.mock("#/hooks/use-settings-nav-items", () => ({
useSettingsNavItems: () => [
{ type: "item", item: OSS_NAV_ITEMS[0] },
- { type: "item", item: OSS_NAV_ITEMS[5] },
+ { type: "item", item: OSS_NAV_ITEMS[4] },
],
}));
+const cloudBackend: Backend = {
+ id: "prod",
+ name: "Production",
+ host: "https://app.all-hands.dev",
+ apiKey: "bearer-token",
+ kind: "cloud",
+};
+
describe("settings route", () => {
beforeEach(() => {
vi.restoreAllMocks();
@@ -62,7 +75,21 @@ describe("settings route", () => {
expect(response.headers.get("Location")).toBe("/settings/mcp");
});
- it("no longer treats /settings/integrations as a redirect target", async () => {
+ it("redirects /integrations to /conversations when the active backend is cloud", async () => {
+ setRegisteredBackends([cloudBackend]);
+ setActiveSelection({ backendId: cloudBackend.id });
+
+ const { clientLoader: integrationsLoader } = await import(
+ "#/routes/git-settings"
+ );
+
+ const response = integrationsLoader() as Response;
+
+ expect(response.status).toBe(302);
+ expect(response.headers.get("Location")).toBe("/conversations");
+ });
+
+ it("does not redirect unrelated removed nested paths through the settings loader", async () => {
vi.spyOn(OptionService, "getConfig").mockResolvedValue({
posthog_client_key: null,
feature_flags: {
diff --git a/__tests__/utils/path-utils.test.ts b/__tests__/utils/path-utils.test.ts
new file mode 100644
index 0000000000..390adb7ca3
--- /dev/null
+++ b/__tests__/utils/path-utils.test.ts
@@ -0,0 +1,56 @@
+import { describe, expect, it } from "vitest";
+
+import { getPathBasename, stripWorkspacePrefix } from "#/utils/path-utils";
+
+describe("getPathBasename", () => {
+ it("returns an empty string for empty or whitespace-only input", () => {
+ expect(getPathBasename("")).toBe("");
+ expect(getPathBasename(" ")).toBe("");
+ });
+
+ it("handles POSIX paths with and without trailing slashes", () => {
+ expect(getPathBasename("/workspace/project/agent-canvas")).toBe(
+ "agent-canvas",
+ );
+ expect(getPathBasename("/workspace/project/agent-canvas/")).toBe(
+ "agent-canvas",
+ );
+ });
+
+ it("handles Windows-style paths", () => {
+ expect(getPathBasename("C:\\Users\\me\\repo")).toBe("repo");
+ expect(getPathBasename("C:\\Users\\me\\repo\\")).toBe("repo");
+ });
+
+ it("returns an empty string for root paths", () => {
+ expect(getPathBasename("/")).toBe("");
+ expect(getPathBasename("C:\\")).toBe("");
+ });
+
+ it("preserves relative basenames", () => {
+ expect(getPathBasename("repo")).toBe("repo");
+ expect(getPathBasename("./repo")).toBe("repo");
+ });
+});
+
+describe("stripWorkspacePrefix", () => {
+ it("removes the /workspace/<name>/ prefix when present", () => {
+ expect(stripWorkspacePrefix("/workspace/repo/src/file.py")).toBe(
+ "src/file.py",
+ );
+ expect(
+ stripWorkspacePrefix("/workspace/my-project/components/Button.tsx"),
+ ).toBe("components/Button.tsx");
+ });
+
+ it("returns an empty string when only the workspace root has a trailing slash", () => {
+ expect(stripWorkspacePrefix("/workspace/repo/")).toBe("");
+ });
+
+ it("leaves non-workspace or incomplete paths unchanged", () => {
+ expect(stripWorkspacePrefix("/workspace")).toBe("/workspace");
+ expect(stripWorkspacePrefix("/workspace/repo")).toBe("/workspace/repo");
+ expect(stripWorkspacePrefix("relative/path.ts")).toBe("relative/path.ts");
+ expect(stripWorkspacePrefix("")).toBe("");
+ });
+});
diff --git a/public/mockServiceWorker.js b/public/mockServiceWorker.js
index c278e2b1bb..a1e52b4778 100644
--- a/public/mockServiceWorker.js
+++ b/public/mockServiceWorker.js
@@ -12,104 +12,104 @@ const INTEGRITY_CHECKSUM = '4db4a41e972cec1b64cc569c66952d82'
const IS_MOCKED_RESPONSE = Symbol('isMockedResponse')
const activeClientIds = new Set()
-addEventListener("install", function () {
- self.skipWaiting();
-});
+addEventListener('install', function () {
+ self.skipWaiting()
+})
-addEventListener("activate", function (event) {
- event.waitUntil(self.clients.claim());
-});
+addEventListener('activate', function (event) {
+ event.waitUntil(self.clients.claim())
+})
-addEventListener("message", async function (event) {
- const clientId = Reflect.get(event.source || {}, "id");
+addEventListener('message', async function (event) {
+ const clientId = Reflect.get(event.source || {}, 'id')
if (!clientId || !self.clients) {
- return;
+ return
}
- const client = await self.clients.get(clientId);
+ const client = await self.clients.get(clientId)
if (!client) {
- return;
+ return
}
const allClients = await self.clients.matchAll({
- type: "window",
- });
+ type: 'window',
+ })
switch (event.data) {
- case "KEEPALIVE_REQUEST": {
+ case 'KEEPALIVE_REQUEST': {
sendToClient(client, {
- type: "KEEPALIVE_RESPONSE",
- });
- break;
+ type: 'KEEPALIVE_RESPONSE',
+ })
+ break
}
- case "INTEGRITY_CHECK_REQUEST": {
+ case 'INTEGRITY_CHECK_REQUEST': {
sendToClient(client, {
- type: "INTEGRITY_CHECK_RESPONSE",
+ type: 'INTEGRITY_CHECK_RESPONSE',
payload: {
packageVersion: PACKAGE_VERSION,
checksum: INTEGRITY_CHECKSUM,
},
- });
- break;
+ })
+ break
}
- case "MOCK_ACTIVATE": {
- activeClientIds.add(clientId);
+ case 'MOCK_ACTIVATE': {
+ activeClientIds.add(clientId)
sendToClient(client, {
- type: "MOCKING_ENABLED",
+ type: 'MOCKING_ENABLED',
payload: {
client: {
id: client.id,
frameType: client.frameType,
},
},
- });
- break;
+ })
+ break
}
- case "CLIENT_CLOSED": {
- activeClientIds.delete(clientId);
+ case 'CLIENT_CLOSED': {
+ activeClientIds.delete(clientId)
const remainingClients = allClients.filter((client) => {
- return client.id !== clientId;
- });
+ return client.id !== clientId
+ })
// Unregister itself when there are no more clients
if (remainingClients.length === 0) {
- self.registration.unregister();
+ self.registration.unregister()
}
- break;
+ break
}
}
-});
+})
-addEventListener("fetch", function (event) {
- const requestInterceptedAt = Date.now();
+addEventListener('fetch', function (event) {
+ const requestInterceptedAt = Date.now()
// Bypass navigation requests.
- if (event.request.mode === "navigate") {
- return;
+ if (event.request.mode === 'navigate') {
+ return
}
// Opening the DevTools triggers the "only-if-cached" request
// that cannot be handled by the worker. Bypass such requests.
if (
- event.request.cache === "only-if-cached" &&
- event.request.mode !== "same-origin"
+ event.request.cache === 'only-if-cached' &&
+ event.request.mode !== 'same-origin'
) {
- return;
+ return
}
// Bypass all requests when there are no active clients.
// Prevents the self-unregistered worked from handling requests
// after it's been terminated (still remains active until the next reload).
if (activeClientIds.size === 0) {
- return;
+ return
}
const requestId = crypto.randomUUID()
@@ -122,28 +122,28 @@ addEventListener("fetch", function (event) {
* @param {number} requestInterceptedAt
*/
async function handleRequest(event, requestId, requestInterceptedAt) {
- const client = await resolveMainClient(event);
- const requestCloneForEvents = event.request.clone();
+ const client = await resolveMainClient(event)
+ const requestCloneForEvents = event.request.clone()
const response = await getResponse(
event,
client,
requestId,
requestInterceptedAt,
- );
+ )
// Send back the response clone for the "response:*" life-cycle events.
// Ensure MSW is active and ready to handle the message, otherwise
// this message will pend indefinitely.
if (client && activeClientIds.has(client.id)) {
- const serializedRequest = await serializeRequest(requestCloneForEvents);
+ const serializedRequest = await serializeRequest(requestCloneForEvents)
// Clone the response so both the client and the library could consume it.
- const responseClone = response.clone();
+ const responseClone = response.clone()
sendToClient(
client,
{
- type: "RESPONSE",
+ type: 'RESPONSE',
payload: {
isMockedResponse: IS_MOCKED_RESPONSE in response,
request: {
@@ -160,10 +160,10 @@ async function handleRequest(event, requestId, requestInterceptedAt) {
},
},
responseClone.body ? [serializedRequest.body, responseClone.body] : [],
- );
+ )
}
- return response;
+ return response
}
/**
@@ -175,30 +175,30 @@ async function handleRequest(event, requestId, requestInterceptedAt) {
* @returns {Promise<Client | undefined>}
*/
async function resolveMainClient(event) {
- const client = await self.clients.get(event.clientId);
+ const client = await self.clients.get(event.clientId)
if (activeClientIds.has(event.clientId)) {
- return client;
+ return client
}
- if (client?.frameType === "top-level") {
- return client;
+ if (client?.frameType === 'top-level') {
+ return client
}
const allClients = await self.clients.matchAll({
- type: "window",
- });
+ type: 'window',
+ })
return allClients
.filter((client) => {
// Get only those clients that are currently visible.
- return client.visibilityState === "visible";
+ return client.visibilityState === 'visible'
})
.find((client) => {
// Find the client ID that's recorded in the
// set of clients that have registered the worker.
- return activeClientIds.has(client.id);
- });
+ return activeClientIds.has(client.id)
+ })
}
/**
@@ -211,36 +211,36 @@ async function resolveMainClient(event) {
async function getResponse(event, client, requestId, requestInterceptedAt) {
// Clone the request because it might've been already used
// (i.e. its body has been read and sent to the client).
- const requestClone = event.request.clone();
+ const requestClone = event.request.clone()
function passthrough() {
// Cast the request headers to a new Headers instance
// so the headers can be manipulated with.
- const headers = new Headers(requestClone.headers);
+ const headers = new Headers(requestClone.headers)
// Remove the "accept" header value that marked this request as passthrough.
// This prevents request alteration and also keeps it compliant with the
// user-defined CORS policies.
- const acceptHeader = headers.get("accept");
+ const acceptHeader = headers.get('accept')
if (acceptHeader) {
- const values = acceptHeader.split(",").map((value) => value.trim());
+ const values = acceptHeader.split(',').map((value) => value.trim())
const filteredValues = values.filter(
- (value) => value !== "msw/passthrough",
- );
+ (value) => value !== 'msw/passthrough',
+ )
if (filteredValues.length > 0) {
- headers.set("accept", filteredValues.join(", "));
+ headers.set('accept', filteredValues.join(', '))
} else {
- headers.delete("accept");
+ headers.delete('accept')
}
}
- return fetch(requestClone, { headers });
+ return fetch(requestClone, { headers })
}
// Bypass mocking when the client is not active.
if (!client) {
- return passthrough();
+ return passthrough()
}
// Bypass initial page load requests (i.e. static assets).
@@ -248,15 +248,15 @@ async function getResponse(event, client, requestId, requestInterceptedAt) {
// means that MSW hasn't dispatched the "MOCK_ACTIVATE" event yet
// and is not ready to handle requests.
if (!activeClientIds.has(client.id)) {
- return passthrough();
+ return passthrough()
}
// Notify the client that a request has been intercepted.
- const serializedRequest = await serializeRequest(event.request);
+ const serializedRequest = await serializeRequest(event.request)
const clientMessage = await sendToClient(
client,
{
- type: "REQUEST",
+ type: 'REQUEST',
payload: {
id: requestId,
interceptedAt: requestInterceptedAt,
@@ -264,19 +264,19 @@ async function getResponse(event, client, requestId, requestInterceptedAt) {
},
},
[serializedRequest.body],
- );
+ )
switch (clientMessage.type) {
- case "MOCK_RESPONSE": {
- return respondWithMock(clientMessage.data);
+ case 'MOCK_RESPONSE': {
+ return respondWithMock(clientMessage.data)
}
- case "PASSTHROUGH": {
- return passthrough();
+ case 'PASSTHROUGH': {
+ return passthrough()
}
}
- return passthrough();
+ return passthrough()
}
/**
@@ -287,21 +287,21 @@ async function getResponse(event, client, requestId, requestInterceptedAt) {
*/
function sendToClient(client, message, transferrables = []) {
return new Promise((resolve, reject) => {
- const channel = new MessageChannel();
+ const channel = new MessageChannel()
channel.port1.onmessage = (event) => {
if (event.data && event.data.error) {
- return reject(event.data.error);
+ return reject(event.data.error)
}
- resolve(event.data);
- };
+ resolve(event.data)
+ }
client.postMessage(message, [
channel.port2,
...transferrables.filter(Boolean),
- ]);
- });
+ ])
+ })
}
/**
@@ -314,17 +314,17 @@ function respondWithMock(response) {
// instance will have status code set to 0. Since it's not possible to create
// a Response instance with status code 0, handle that use-case separately.
if (response.status === 0) {
- return Response.error();
+ return Response.error()
}
- const mockedResponse = new Response(response.body, response);
+ const mockedResponse = new Response(response.body, response)
Reflect.defineProperty(mockedResponse, IS_MOCKED_RESPONSE, {
value: true,
enumerable: true,
- });
+ })
- return mockedResponse;
+ return mockedResponse
}
/**
@@ -345,5 +345,5 @@ async function serializeRequest(request) {
referrerPolicy: request.referrerPolicy,
body: await request.arrayBuffer(),
keepalive: request.keepalive,
- };
+ }
}
diff --git a/src/components/features/backends/add-backend-menu-item.tsx b/src/components/features/backends/add-backend-menu-item.tsx
deleted file mode 100644
index 34a628ca92..0000000000
--- a/src/components/features/backends/add-backend-menu-item.tsx
+++ /dev/null
@@ -1,23 +0,0 @@
-import { useTranslation } from "react-i18next";
-import { Plus } from "lucide-react";
-import { I18nKey } from "#/i18n/declaration";
-
-interface AddBackendMenuItemProps {
- onOpen: () => void;
-}
-
-export function AddBackendMenuItem({ onOpen }: AddBackendMenuItemProps) {
- const { t } = useTranslation("openhands");
-
- return (
- <button
- type="button"
- data-testid="add-backend-menu-item"
- onClick={onOpen}
- className="flex w-full items-center gap-2 p-2 rounded text-xs cursor-pointer hover:bg-white/10 hover:text-white"
- >
- <Plus width={16} height={16} className="text-white shrink-0" />
- {t(I18nKey.BACKEND$ADD)}
- </button>
- );
-}
diff --git a/src/components/features/backends/backend-selector.tsx b/src/components/features/backends/backend-selector.tsx
index bb11ca4240..ff6c21781c 100644
--- a/src/components/features/backends/backend-selector.tsx
+++ b/src/components/features/backends/backend-selector.tsx
@@ -1,6 +1,8 @@
import React from "react";
+import axios from "axios";
import { useTranslation } from "react-i18next";
import { useMatch, useNavigate } from "react-router";
+import { Plus, Settings } from "lucide-react";
import { Dropdown } from "#/ui/dropdown/dropdown";
import { DropdownOption } from "#/ui/dropdown/types";
import { useActiveBackendContext } from "#/contexts/active-backend-context";
@@ -10,9 +12,14 @@ import { useSwitchCloudOrganization } from "#/hooks/mutation/use-switch-cloud-or
import { I18nKey } from "#/i18n/declaration";
import type { Backend } from "#/api/backend-registry/types";
import {
+ dismissEnvironmentSwitch,
ENVIRONMENT_SWITCH_SETACTIVE_DELAY_MS,
triggerEnvironmentSwitch,
} from "#/components/features/backends/environment-switch-overlay";
+import { displayErrorToast } from "#/utils/custom-toast-handlers";
+import { retrieveAxiosErrorMessage } from "#/utils/retrieve-axios-error-message";
+import { AddBackendModal } from "./add-backend-modal";
+import { ManageBackendsModal } from "./manage-backends-modal";
const VALUE_SEPARATOR = "::";
@@ -72,7 +79,14 @@ function buildOptions(
return options;
}
-export function BackendSelector() {
+interface BackendSelectorProps {
+ /** Render the menu above the trigger (e.g. when pinned to bottom of sidebar). */
+ openUpward?: boolean;
+}
+
+export function BackendSelector({
+ openUpward = false,
+}: BackendSelectorProps = {}) {
const { t } = useTranslation("openhands");
const { backends, bundledBackend, active, setActive } =
useActiveBackendContext();
@@ -83,6 +97,9 @@ export function BackendSelector() {
const navigate = useNavigate();
const conversationMatch = useMatch("/conversations/:conversationId");
const automationDetailMatch = useMatch("/automations/:automationId");
+ const [addBackendModalOpen, setAddBackendModalOpen] = React.useState(false);
+ const [manageBackendsModalOpen, setManageBackendsModalOpen] =
+ React.useState(false);
const bundledLabel = t(I18nKey.BACKEND$LOCAL_ROW);
const personalWorkspaceLabel = t(I18nKey.BACKEND$PERSONAL_WORKSPACE);
@@ -123,85 +140,152 @@ export function BackendSelector() {
// touching active state so queries refetch (via key change) only
// once and against the correct org context.
React.useEffect(() => {
- if (active.backend.kind !== "cloud" || active.orgId) return;
- const { backend } = active;
- const entry = cloudOrgs[backend.id];
- if (!entry || entry.orgs.length === 0) return;
- const userId = currentUserIds[backend.id]?.userId ?? null;
- const personal = userId
- ? entry.orgs.find((o) => o.id === userId)
- : undefined;
- const target = personal ?? entry.orgs[0];
- if (!target) return;
- switchOrg({ orgId: target.id, backend })
- .then(() => setActive(backend.id, target.id))
- .catch(() => {
- // Error is surfaced by the mutation cache's global handler.
- });
- }, [active, cloudOrgs, currentUserIds, setActive, switchOrg]);
+ let cancelled = false;
+
+ if (active.backend.kind === "cloud" && !active.orgId) {
+ const { backend } = active;
+ const entry = cloudOrgs[backend.id];
+
+ if (entry && entry.orgs.length > 0) {
+ const userId = currentUserIds[backend.id]?.userId ?? null;
+ const personal = userId
+ ? entry.orgs.find((o) => o.id === userId)
+ : undefined;
+ const target = personal ?? entry.orgs[0];
+
+ if (target) {
+ const syncActiveOrg = async () => {
+ try {
+ await switchOrg({ orgId: target.id, backend });
+ if (!cancelled) {
+ setActive(backend.id, target.id);
+ }
+ } catch {
+ if (!cancelled) {
+ setActive(bundledBackend.id, null);
+ }
+ }
+ };
+
+ syncActiveOrg();
+ }
+ }
+ }
+
+ return () => {
+ cancelled = true;
+ };
+ }, [
+ active,
+ bundledBackend.id,
+ cloudOrgs,
+ currentUserIds,
+ setActive,
+ switchOrg,
+ ]);
+
+ const openAddBackendModal = React.useCallback(() => {
+ setAddBackendModalOpen(true);
+ }, []);
+
+ const openManageBackendsModal = React.useCallback(() => {
+ setManageBackendsModalOpen(true);
+ }, []);
+
+ const preventDropdownMenuClose = React.useCallback(
+ (event: React.MouseEvent<HTMLButtonElement>) => {
+ event.preventDefault();
+ event.stopPropagation();
+ },
+ [],
+ );
+
+ const addBackendFooter = (
+ <div className="flex flex-col gap-1">
+ <button
+ type="button"
+ data-testid="add-backend-menu-item"
+ onMouseDown={preventDropdownMenuClose}
+ onClick={openAddBackendModal}
+ className="flex w-full items-center gap-2 px-2 py-2 rounded-md text-sm cursor-pointer text-white hover:bg-[#5C5D62]"
+ >
+ <Plus width={16} height={16} className="text-white shrink-0" />
+ {t(I18nKey.BACKEND$ADD)}
+ </button>
+ <button
+ type="button"
+ data-testid="manage-backends-menu-item"
+ onMouseDown={preventDropdownMenuClose}
+ onClick={openManageBackendsModal}
+ className="flex w-full items-center gap-2 px-2 py-2 rounded-md text-sm cursor-pointer text-white hover:bg-[#5C5D62]"
+ >
+ <Settings width={16} height={16} className="text-white shrink-0" />
+ {t(I18nKey.BACKEND$MANAGE)}
+ </button>
+ </div>
+ );
return (
- <Dropdown
- testId="backend-selector"
- key={`${activeValue}-${activeOption?.label ?? ""}`}
- defaultValue={activeOption ?? { value: activeValue, label: bundledLabel }}
- onChange={async (item) => {
- if (!item || item.value === activeValue) return;
- const { backendId, orgId } = parseOptionValue(item.value);
- const target = backends.find((b) => b.id === backendId);
-
- // Show the environment-switch overlay immediately so the user
- // gets feedback before any /switch network call. The overlay
- // auto-dismisses on its own 980ms timer regardless of whether
- // the switch succeeds or fails.
- triggerEnvironmentSwitch(item.label);
-
- // Hold the active swap for ~400ms — placing it in the middle
- // of the content-fade-to-black window so React Query refetches
- // happen while the layout is invisible behind the overlay,
- // rather than thrashing visibly before the fade.
- await new Promise<void>((resolve) => {
- setTimeout(resolve, ENVIRONMENT_SWITCH_SETACTIVE_DELAY_MS);
- });
+ <>
+ <Dropdown
+ testId="backend-selector"
+ key={`${activeValue}-${activeOption?.label ?? ""}`}
+ defaultValue={
+ activeOption ?? { value: activeValue, label: bundledLabel }
+ }
+ footer={addBackendFooter}
+ openUpward={openUpward}
+ onChange={async (item) => {
+ if (!item || item.value === activeValue) return;
+ const { backendId, orgId } = parseOptionValue(item.value);
+ const target =
+ backendId === bundledBackend.id
+ ? bundledBackend
+ : backends.find((b) => b.id === backendId);
+ if (!target) return;
- // Cloud + org pick: fire `/switch` FIRST against the explicit
- // target backend, then update the active selection after it
- // resolves. This ensures the SaaS-side `current_org_id` is
- // already in place before any of our backend-keyed queries
- // refetch — they fire exactly once, with the correct context.
- //
- // We use `mutateAsync` + `await` (rather than `mutate(... ,
- // { onSuccess })`) because per-call onSuccess callbacks were
- // observed not to run reliably for this hook in practice; the
- // promise-based shape is unambiguous.
- if (orgId && target?.kind === "cloud") {
- try {
- await switchOrg({ orgId, backend: target });
- } catch {
- // Error is surfaced by the mutation cache's global handler.
- return;
+ triggerEnvironmentSwitch(item.label);
+ await new Promise<void>((resolve) => {
+ setTimeout(resolve, ENVIRONMENT_SWITCH_SETACTIVE_DELAY_MS);
+ });
+
+ if (orgId && target.kind === "cloud") {
+ try {
+ await switchOrg({ orgId, backend: target });
+ } catch (error) {
+ dismissEnvironmentSwitch();
+
+ if (!axios.isAxiosError(error)) {
+ console.error("Unexpected error during org switch:", error);
+ displayErrorToast(t(I18nKey.ERROR$GENERIC));
+ return;
+ }
+
+ displayErrorToast(
+ retrieveAxiosErrorMessage(error) || t(I18nKey.ERROR$GENERIC),
+ );
+ return;
+ }
}
- }
- // The current conversation/automation belongs to the previous
- // backend and is no longer reachable under the new one — redirect
- // BEFORE flipping the active selection so the route change and
- // backend change land in the same render batch. Otherwise the
- // detail page re-renders once with the new backend (its query
- // key includes `active.backend.id`) and react-query fires a
- // fetch for the previous backend's id against the new backend.
- if (conversationMatch) navigate("/");
- else if (automationDetailMatch) navigate("/automations");
-
- // Pure backend swap (local-↔-bundled or backend-only cloud
- // selection without an org) skips `/switch` and updates active
- // directly; cloud-with-org falls through here after `/switch`.
- setActive(backendId, orgId);
- }}
- placeholder={bundledLabel}
- loading={someCloudLoading || isSwitching}
- options={options}
- className="bg-[#1F1F1F66] border-[#242424]"
- />
+ if (conversationMatch) navigate("/conversations");
+ else if (automationDetailMatch) navigate("/automations");
+
+ setActive(target.id, orgId);
+ }}
+ placeholder={bundledLabel}
+ loading={someCloudLoading || isSwitching}
+ options={options}
+ className="bg-[#1F1F1F66] border-[#242424]"
+ />
+ {addBackendModalOpen ? (
+ <AddBackendModal onClose={() => setAddBackendModalOpen(false)} />
+ ) : null}
+ {manageBackendsModalOpen ? (
+ <ManageBackendsModal
+ onClose={() => setManageBackendsModalOpen(false)}
+ />
+ ) : null}
+ </>
);
}
diff --git a/src/components/features/backends/environment-switch-overlay.tsx b/src/components/features/backends/environment-switch-overlay.tsx
index ff4daaff4d..53604190fc 100644
--- a/src/components/features/backends/environment-switch-overlay.tsx
+++ b/src/components/features/backends/environment-switch-overlay.tsx
@@ -43,6 +43,14 @@ export function triggerEnvironmentSwitch(target: string) {
}, ENVIRONMENT_SWITCH_DURATION_MS);
}
+export function dismissEnvironmentSwitch() {
+ if (hideTimeoutId) {
+ clearTimeout(hideTimeoutId);
+ hideTimeoutId = null;
+ }
+ setSnapshot({ visible: false, target: "" });
+}
+
function subscribe(listener: () => void) {
listeners.add(listener);
return () => {
diff --git a/src/components/features/backends/manage-backends-modal.tsx b/src/components/features/backends/manage-backends-modal.tsx
new file mode 100644
index 0000000000..c480f2a7c1
--- /dev/null
+++ b/src/components/features/backends/manage-backends-modal.tsx
@@ -0,0 +1,126 @@
+import React from "react";
+import { useTranslation } from "react-i18next";
+
+import { BrandButton } from "#/components/features/settings/brand-button";
+import { ConfirmationModal } from "#/components/shared/modals/confirmation-modal";
+import { ModalBackdrop } from "#/components/shared/modals/modal-backdrop";
+import { useActiveBackendContext } from "#/contexts/active-backend-context";
+import CloseIcon from "#/icons/close.svg?react";
+import { I18nKey } from "#/i18n/declaration";
+import { cn } from "#/utils/utils";
+
+interface ManageBackendsModalProps {
+ onClose: () => void;
+}
+
+interface PendingRemoval {
+ id: string;
+ name: string;
+}
+
+export function ManageBackendsModal({ onClose }: ManageBackendsModalProps) {
+ const { t } = useTranslation("openhands");
+ const { backends, removeBackend } = useActiveBackendContext();
+ const [pendingRemoval, setPendingRemoval] =
+ React.useState<PendingRemoval | null>(null);
+
+ const handleConfirmRemoval = () => {
+ if (!pendingRemoval) return;
+ removeBackend(pendingRemoval.id);
+ setPendingRemoval(null);
+ };
+
+ return (
+ <>
+ <ModalBackdrop
+ onClose={onClose}
+ aria-label={t(I18nKey.BACKEND$MANAGE_TITLE)}
+ >
+ <div
+ data-testid="manage-backends-modal"
+ className={cn(
+ "flex flex-col bg-[#26282D] border border-[#727987] rounded-xl",
+ "w-[560px] max-w-[90vw] max-h-[70vh]",
+ )}
+ >
+ <div className="flex items-center justify-between px-5 py-3 border-b border-[#727987]">
+ <span className="text-sm font-semibold text-white">
+ {t(I18nKey.BACKEND$MANAGE_TITLE)}
+ </span>
+ </div>
+
+ <div
+ className="flex-1 overflow-auto custom-scrollbar-always"
+ data-testid="manage-backends-list"
+ >
+ {backends.length === 0 ? (
+ <p className="px-5 py-6 text-sm text-[#B7BDC2] text-center">
+ {t(I18nKey.BACKEND$MANAGE_EMPTY)}
+ </p>
+ ) : (
+ <ul>
+ {backends.map((backend) => (
+ <li
+ key={backend.id}
+ className="flex items-center gap-3 px-5 py-3 border-b border-[#363840] last:border-b-0"
+ data-testid={`manage-backends-row-${backend.name}`}
+ >
+ <div className="flex flex-col min-w-0 flex-1">
+ <span className="text-sm text-white truncate">
+ {backend.name}
+ </span>
+ <span className="text-xs text-[#A3A3A3] truncate">
+ {backend.host}
+ </span>
+ </div>
+ <span className="px-2 py-1 rounded-full text-[11px] uppercase tracking-wide text-[#D6D6D6] bg-[#1F1F1F] border border-[#4B4E57]">
+ {backend.kind === "cloud"
+ ? t(I18nKey.BACKEND$KIND_CLOUD)
+ : t(I18nKey.BACKEND$KIND_LOCAL)}
+ </span>
+ <button
+ type="button"
+ onClick={() =>
+ setPendingRemoval({
+ id: backend.id,
+ name: backend.name,
+ })
+ }
+ aria-label={t(I18nKey.BACKEND$REMOVE)}
+ data-testid={`manage-backends-remove-${backend.name}`}
+ className="flex items-center gap-1 px-2 py-1 rounded text-xs text-[#D6D6D6] hover:bg-[#5C5D62] hover:text-white cursor-pointer"
+ >
+ <CloseIcon width={12} height={12} />
+ <span>{t(I18nKey.BACKEND$REMOVE)}</span>
+ </button>
+ </li>
+ ))}
+ </ul>
+ )}
+ </div>
+
+ <div className="flex justify-end gap-2 px-5 py-3 border-t border-[#727987]">
+ <BrandButton
+ type="button"
+ variant="primary"
+ onClick={onClose}
+ testId="manage-backends-done"
+ >
+ {t(I18nKey.HOME$DONE)}
+ </BrandButton>
+ </div>
+ </div>
+ </ModalBackdrop>
+
+ {pendingRemoval ? (
+ <ConfirmationModal
+ text={t(I18nKey.BACKEND$REMOVE_CONFIRMATION, {
+ name: pendingRemoval.name,
+ })}
+ onConfirm={handleConfirmRemoval}
+ onCancel={() => setPendingRemoval(null)}
+ />
+ ) : null}
+ </>
+ );
+}
diff --git a/src/components/features/chat/components/chat-input-actions.tsx b/src/components/features/chat/components/chat-input-actions.tsx
index 3323742b27..4292c689f5 100644
--- a/src/components/features/chat/components/chat-input-actions.tsx
+++ b/src/components/features/chat/components/chat-input-actions.tsx
@@ -1,6 +1,7 @@
import { AgentStatus } from "#/components/features/controls/agent-status";
import { Tools } from "../../controls/tools";
import { ChangeAgentButton } from "../change-agent-button";
+import { ChatInputModel } from "./chat-input-model";
import { useUnifiedPauseConversation } from "#/hooks/mutation/use-unified-stop-conversation";
import { useConversationId } from "#/hooks/use-conversation-id";
import { usePauseConversation } from "#/hooks/mutation/use-pause-conversation";
@@ -36,6 +37,7 @@ export function ChatInputActions({ disabled }: ChatInputActionsProps) {
<div className="flex items-center gap-1">
<div className="flex items-center gap-4">
<Tools />
+ <ChatInputModel />
{isCloud && <ChangeAgentButton />}
</div>
</div>
diff --git a/src/components/features/chat/components/chat-input-model.tsx b/src/components/features/chat/components/chat-input-model.tsx
new file mode 100644
index 0000000000..eafd14319a
--- /dev/null
+++ b/src/components/features/chat/components/chat-input-model.tsx
@@ -0,0 +1,21 @@
+import { useActiveConversation } from "#/hooks/query/use-active-conversation";
+import CircuitIcon from "#/icons/u-circuit.svg?react";
+
+export function ChatInputModel() {
+ const { data: conversation } = useActiveConversation();
+
+ if (!conversation?.llm_model) {
+ return null;
+ }
+
+ return (
+ <span
+ className="text-sm font-normal leading-5 text-[#A3A3A3] inline-flex items-center gap-1 whitespace-nowrap max-w-[220px] min-w-0"
+ title={conversation.llm_model}
+ data-testid="chat-input-llm-model"
+ >
+ <CircuitIcon width={14} height={14} className="shrink-0" />
+ <span className="truncate">{conversation.llm_model}</span>
+ </span>
+ );
+}
diff --git a/src/components/features/conversation-panel/confirm-delete-modal.tsx b/src/components/features/conversation-panel/confirm-delete-modal.tsx
index 8845b0fb93..ef68d65b31 100644
--- a/src/components/features/conversation-panel/confirm-delete-modal.tsx
+++ b/src/components/features/conversation-panel/confirm-delete-modal.tsx
@@ -1,3 +1,4 @@
+import React from "react";
import { Trans, useTranslation } from "react-i18next";
import {
BaseModalDescription,
@@ -12,31 +13,42 @@ interface ConfirmDeleteModalProps {
onConfirm: () => void;
onCancel: () => void;
conversationTitle?: string;
+ title?: string;
+ description?: React.ReactNode;
}
export function ConfirmDeleteModal({
onConfirm,
onCancel,
conversationTitle,
+ title,
+ description,
}: ConfirmDeleteModalProps) {
const { t } = useTranslation("openhands");
- const confirmationMessage = conversationTitle ? (
- <Trans
- ns="openhands"
- i18nKey={I18nKey.CONVERSATION$DELETE_WARNING_WITH_TITLE}
- values={{ title: conversationTitle }}
- components={{ title: <span className="text-white" /> }}
- />
- ) : (
- t(I18nKey.CONVERSATION$DELETE_WARNING)
- );
+ let confirmationMessage: React.ReactNode;
+ if (description != null) {
+ confirmationMessage = description;
+ } else if (conversationTitle) {
+ confirmationMessage = (
+ <Trans
+ ns="openhands"
+ i18nKey={I18nKey.CONVERSATION$DELETE_WARNING_WITH_TITLE}
+ values={{ title: conversationTitle }}
+ components={{ title: <span className="text-white" /> }}
+ />
+ );
+ } else {
+ confirmationMessage = t(I18nKey.CONVERSATION$DELETE_WARNING);
+ }
return (
<ModalBackdrop onClose={onCancel}>
<ModalBody className="items-start border border-tertiary">
<div className="flex flex-col gap-2">
- <BaseModalTitle title={t(I18nKey.CONVERSATION$CONFIRM_DELETE)} />
+ <BaseModalTitle
+ title={title ?? t(I18nKey.CONVERSATION$CONFIRM_DELETE)}
+ />
<BaseModalDescription>{confirmationMessage}</BaseModalDescription>
</div>
<div
diff --git a/src/components/features/conversation-panel/conversation-card/conversation-card-footer.tsx b/src/components/features/conversation-panel/conversation-card/conversation-card-footer.tsx
index 49796759c1..39c0c97645 100644
--- a/src/components/features/conversation-panel/conversation-card/conversation-card-footer.tsx
+++ b/src/components/features/conversation-panel/conversation-card/conversation-card-footer.tsx
@@ -7,14 +7,13 @@ import { ExecutionStatus } from "#/types/agent-server/core/base/common";
import { isExecutionPaused } from "#/utils/status";
import { ConversationRepoLink } from "./conversation-repo-link";
import { NoRepository } from "./no-repository";
-import CircuitIcon from "#/icons/u-circuit.svg?react";
interface ConversationCardFooterProps {
selectedRepository: RepositorySelection | null;
lastUpdatedAt: string;
createdAt?: string;
executionStatus?: ExecutionStatus | null;
- llmModel?: string | null;
+ workspaceWorkingDir?: string | null;
}
export function ConversationCardFooter({
@@ -22,7 +21,7 @@ export function ConversationCardFooter({
lastUpdatedAt,
createdAt,
executionStatus,
- llmModel,
+ workspaceWorkingDir,
}: ConversationCardFooterProps) {
const { t } = useTranslation("openhands");
@@ -31,26 +30,18 @@ export function ConversationCardFooter({
return (
<div
className={cn(
- "flex flex-row justify-between items-center mt-1",
+ // Left padding aligns the repo/workspace icon with the title text in
+ // the header (status dot 10px + gap-2 8px = 18px).
+ "flex flex-row justify-between items-center mt-1 pl-[18px]",
isPaused && "opacity-60",
)}
>
{selectedRepository?.selected_repository ? (
<ConversationRepoLink selectedRepository={selectedRepository} />
) : (
- <NoRepository />
+ <NoRepository workspaceWorkingDir={workspaceWorkingDir} />
)}
<div className="flex items-center gap-2 flex-1 justify-end">
- {llmModel && (
- <span
- className="text-xs text-[#A3A3A3] max-w-[120px] flex items-center gap-1 overflow-hidden"
- title={llmModel}
- data-testid="conversation-card-llm-model"
- >
- <CircuitIcon width={12} height={12} className="shrink-0" />
- <span className="truncate">{llmModel}</span>
- </span>
- )}
{(createdAt ?? lastUpdatedAt) && (
<p className="text-xs text-[#A3A3A3] text-right">
<time>
diff --git a/src/components/features/conversation-panel/conversation-card/conversation-card-skeleton.tsx b/src/components/features/conversation-panel/conversation-card/conversation-card-skeleton.tsx
index 4cd6fd1bdd..a516581183 100644
--- a/src/components/features/conversation-panel/conversation-card/conversation-card-skeleton.tsx
+++ b/src/components/features/conversation-panel/conversation-card/conversation-card-skeleton.tsx
@@ -4,7 +4,7 @@ export function ConversationCardSkeleton() {
return (
<div
data-testid="conversation-card-skeleton"
- className="relative h-auto w-full p-3.5 border-b border-neutral-600"
+ className="relative h-auto w-full px-3 py-2 border-b border-[#1f2228]"
>
<div className="flex items-center justify-between w-full">
<div className="flex items-center gap-2 w-full">
diff --git a/src/components/features/conversation-panel/conversation-card/conversation-card.tsx b/src/components/features/conversation-panel/conversation-card/conversation-card.tsx
index 8bcaeb75da..41b9d11c31 100644
--- a/src/components/features/conversation-panel/conversation-card/conversation-card.tsx
+++ b/src/components/features/conversation-panel/conversation-card/conversation-card.tsx
@@ -24,7 +24,8 @@ interface ConversationCardProps {
conversationId?: string;
contextMenuOpen?: boolean;
onContextMenuToggle?: (isOpen: boolean) => void;
- llmModel?: string | null;
+ isActive?: boolean;
+ workspaceWorkingDir?: string | null;
}
export function ConversationCard({
@@ -35,15 +36,14 @@ export function ConversationCard({
showOptions,
title,
selectedRepository,
- // lastUpdatedAt is kept in props for backward compatibility
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
lastUpdatedAt,
createdAt,
conversationId,
executionStatus,
contextMenuOpen = false,
onContextMenuToggle,
- llmModel,
+ isActive = false,
+ workspaceWorkingDir,
}: ConversationCardProps) {
const posthog = usePostHog();
const [titleMode, setTitleMode] = React.useState<"view" | "edit">("view");
@@ -121,10 +121,12 @@ export function ConversationCard({
<div
data-testid="conversation-card"
data-context-menu-open={contextMenuOpen.toString()}
+ data-active={isActive ? "true" : "false"}
onClick={onClick}
className={cn(
- "relative h-auto w-full p-3.5 border-b border-neutral-600 cursor-pointer",
- "data-[context-menu-open=false]:hover:bg-[#454545]",
+ "relative h-auto w-full px-3 py-2 border-b border-[#1f2228] cursor-pointer",
+ "data-[context-menu-open=false]:hover:bg-[#1f2228]",
+ "data-[active=true]:bg-[#25272D]",
)}
>
<div className="flex items-center justify-between w-full">
@@ -158,7 +160,7 @@ export function ConversationCard({
lastUpdatedAt={lastUpdatedAt}
createdAt={createdAt}
executionStatus={executionStatus}
- llmModel={llmModel}
+ workspaceWorkingDir={workspaceWorkingDir}
/>
</div>
);
diff --git a/src/components/features/conversation-panel/conversation-card/no-repository.tsx b/src/components/features/conversation-panel/conversation-card/no-repository.tsx
index be20018de4..6fb6ed0e9d 100644
--- a/src/components/features/conversation-panel/conversation-card/no-repository.tsx
+++ b/src/components/features/conversation-panel/conversation-card/no-repository.tsx
@@ -1,10 +1,34 @@
import { useTranslation } from "react-i18next";
+import { FaFolder } from "react-icons/fa6";
import { I18nKey } from "#/i18n/declaration";
import RepoForkedIcon from "#/icons/repo-forked.svg?react";
+import { getPathBasename } from "#/utils/path-utils";
-export function NoRepository() {
+interface NoRepositoryProps {
+ workspaceWorkingDir?: string | null;
+}
+
+export function NoRepository({ workspaceWorkingDir }: NoRepositoryProps) {
const { t } = useTranslation("openhands");
+ const folderName = workspaceWorkingDir
+ ? getPathBasename(workspaceWorkingDir).trim()
+ : "";
+
+ if (folderName) {
+ return (
+ <div
+ className="flex items-center gap-1 text-xs text-[#A3A3A3]"
+ title={workspaceWorkingDir ?? undefined}
+ >
+ <FaFolder size={12} className="text-[#A3A3A3]" />
+ <span className="whitespace-nowrap overflow-hidden text-ellipsis max-w-44">
+ {folderName}
+ </span>
+ </div>
+ );
+ }
+
return (
<div className="flex items-center gap-1 text-xs text-[#A3A3A3]">
<RepoForkedIcon width={14} height={14} className="text-[#A3A3A3]" />
diff --git a/src/components/features/conversation-panel/conversation-panel.tsx b/src/components/features/conversation-panel/conversation-panel.tsx
index c2883037d5..0fc7e54629 100644
--- a/src/components/features/conversation-panel/conversation-panel.tsx
+++ b/src/components/features/conversation-panel/conversation-panel.tsx
@@ -4,7 +4,6 @@ import { I18nKey } from "#/i18n/declaration";
import { useNavigation } from "#/context/navigation-context";
import { usePaginatedConversations } from "#/hooks/query/use-paginated-conversations";
import { useStartTasks } from "#/hooks/query/use-start-tasks";
-import { useInfiniteScroll } from "#/hooks/use-infinite-scroll";
import { useDeleteConversation } from "#/hooks/mutation/use-delete-conversation";
import { useUnifiedPauseConversation } from "#/hooks/mutation/use-unified-stop-conversation";
import { ConfirmDeleteModal } from "./confirm-delete-modal";
@@ -15,19 +14,52 @@ import { ExitConversationModal } from "./exit-conversation-modal";
import { useClickOutsideElement } from "#/hooks/use-click-outside-element";
import { Provider } from "#/types/settings";
import { useUpdateConversation } from "#/hooks/mutation/use-update-conversation";
-import { displaySuccessToast } from "#/utils/custom-toast-handlers";
+import {
+ displayErrorToast,
+ displaySuccessToast,
+} from "#/utils/custom-toast-handlers";
import { ConversationCard } from "./conversation-card/conversation-card";
import { StartTaskCard } from "./start-task-card/start-task-card";
import { ConversationCardSkeleton } from "./conversation-card/conversation-card-skeleton";
interface ConversationPanelProps {
- onClose: () => void;
+ onClose?: () => void;
}
+const noop = () => {};
+
+const ONE_HOUR_MS = 60 * 60 * 1000;
+
+const partitionByCutoff = <T extends { updated_at: string }>(
+ items: readonly T[],
+): { recent: T[]; older: T[] } => {
+ // The cutoff is intentionally relative to "now" each time the list is
+ // recomputed, so conversations naturally age into the older bucket as the
+ // conversations query refreshes.
+ const cutoff = Date.now() - ONE_HOUR_MS;
+ const recent: T[] = [];
+ const older: T[] = [];
+ for (const item of items) {
+ const updatedAt = item.updated_at ? Date.parse(item.updated_at) : NaN;
+ // Missing or unparseable timestamps stay in the "recent" bucket so we
+ // do not accidentally hide them behind the older-conversations toggle.
+ if (Number.isFinite(updatedAt) && updatedAt < cutoff) {
+ older.push(item);
+ } else {
+ recent.push(item);
+ }
+ }
+ return { recent, older };
+};
+
export function ConversationPanel({ onClose }: ConversationPanelProps) {
const { t } = useTranslation("openhands");
const { conversationId: currentConversationId, navigate } = useNavigation();
- const ref = useClickOutsideElement<HTMLDivElement>(onClose);
+ // Click-outside is only relevant in the legacy drawer mode where an
+ // onClose handler is provided. When the panel is rendered inline (e.g.
+ // as the always-visible conversation list pane), clicking outside should
+ // not dismiss the list, so we pass a no-op callback in that case.
+ const ref = useClickOutsideElement<HTMLDivElement>(onClose ?? noop);
const [confirmDeleteModalVisible, setConfirmDeleteModalVisible] =
React.useState(false);
@@ -37,6 +69,10 @@ export function ConversationPanel({ onClose }: ConversationPanelProps) {
confirmExitConversationModalVisible,
setConfirmExitConversationModalVisible,
] = React.useState(false);
+ const [confirmDeleteOlderVisible, setConfirmDeleteOlderVisible] =
+ React.useState(false);
+ const [showOlderConversations, setShowOlderConversations] =
+ React.useState(false);
const [selectedConversationId, setSelectedConversationId] = React.useState<
string | null
>(null);
@@ -58,45 +94,53 @@ export function ConversationPanel({ onClose }: ConversationPanelProps) {
// Fetch in-progress start tasks
const { data: startTasks } = useStartTasks();
- // Flatten all pages into a single array of conversations (V1 uses 'items' instead of 'results')
- const conversations = data?.pages.flatMap((page) => page.items) ?? [];
+ const conversations = React.useMemo(
+ () => data?.pages.flatMap((page) => page.items) ?? [],
+ [data],
+ );
+
+ const { recent: recentConversations, older: olderConversations } =
+ React.useMemo(() => partitionByCutoff(conversations), [conversations]);
- const { mutate: deleteConversation } = useDeleteConversation();
+ const { mutate: deleteConversation, mutateAsync: deleteConversationAsync } =
+ useDeleteConversation();
const { mutate: pauseConversation } = useUnifiedPauseConversation();
const { mutate: updateConversation } = useUpdateConversation();
- // Set up infinite scroll
- const scrollContainerRef = useInfiniteScroll({
- hasNextPage: !!hasNextPage,
- isFetchingNextPage,
- fetchNextPage,
- threshold: 200, // Load more when 200px from bottom
- });
+ // The next page of conversations is loaded only via the explicit "Load
+ // more" link rendered at the end of the list — there is no scroll-driven
+ // pagination, which previously caused the panel to feel like it had stray
+ // scrollable space at the bottom.
+ const olderHidden = olderConversations.length > 0 && !showOlderConversations;
+ const showLoadMore = !!hasNextPage && !olderHidden;
- const handleDeleteProject = (conversationId: string, title: string) => {
- setConfirmDeleteModalVisible(true);
- setSelectedConversationId(conversationId);
- setSelectedConversationTitle(title);
- };
+ const handleDeleteProject = React.useCallback(
+ (conversationId: string, title: string) => {
+ setConfirmDeleteModalVisible(true);
+ setSelectedConversationId(conversationId);
+ setSelectedConversationTitle(title);
+ },
+ [],
+ );
- const handleStopConversation = (conversationId: string) => {
+ const handleStopConversation = React.useCallback((conversationId: string) => {
setConfirmStopModalVisible(true);
setSelectedConversationId(conversationId);
- };
+ }, []);
- const handleConversationTitleChange = async (
- conversationId: string,
- newTitle: string,
- ) => {
- updateConversation(
- { conversationId, newTitle },
- {
- onSuccess: () => {
- displaySuccessToast(t(I18nKey.CONVERSATION$TITLE_UPDATED));
+ const handleConversationTitleChange = React.useCallback(
+ (conversationId: string, newTitle: string) => {
+ updateConversation(
+ { conversationId, newTitle },
+ {
+ onSuccess: () => {
+ displaySuccessToast(t(I18nKey.CONVERSATION$TITLE_UPDATED));
+ },
},
- },
- );
- };
+ );
+ },
+ [t, updateConversation],
+ );
const handleConfirmDelete = () => {
if (selectedConversationId) {
@@ -105,7 +149,7 @@ export function ConversationPanel({ onClose }: ConversationPanelProps) {
{
onSuccess: () => {
if (selectedConversationId === currentConversationId) {
- navigate("/");
+ navigate("/conversations");
}
},
},
@@ -121,87 +165,185 @@ export function ConversationPanel({ onClose }: ConversationPanelProps) {
}
};
+ const handleConfirmDeleteOlder = async () => {
+ const idsToDelete = olderConversations.map((c) => c.id);
+ const results = await Promise.allSettled(
+ idsToDelete.map((conversationId) =>
+ deleteConversationAsync({ conversationId }),
+ ),
+ );
+
+ const deletedIds = results.flatMap((result, index) =>
+ result.status === "fulfilled" ? [idsToDelete[index]] : [],
+ );
+ const failedCount = results.length - deletedIds.length;
+
+ if (
+ currentConversationId !== null &&
+ deletedIds.includes(currentConversationId)
+ ) {
+ navigate("/conversations");
+ }
+
+ if (failedCount > 0) {
+ displayErrorToast(
+ `${failedCount} conversation${failedCount === 1 ? "" : "s"} could not be deleted.`,
+ );
+ }
+ };
+
+ const renderConversationCard = React.useCallback(
+ (conversation: (typeof conversations)[number]) => (
+ <NavigationLink
+ key={conversation.id}
+ to={`/conversations/${conversation.id}`}
+ onClick={onClose}
+ className="block"
+ >
+ <ConversationCard
+ onDelete={() =>
+ handleDeleteProject(conversation.id, conversation.title ?? "")
+ }
+ onStop={() => handleStopConversation(conversation.id)}
+ onChangeTitle={(title) =>
+ handleConversationTitleChange(conversation.id, title)
+ }
+ title={conversation.title ?? ""}
+ selectedRepository={{
+ selected_repository: conversation.selected_repository,
+ selected_branch: conversation.selected_branch,
+ git_provider: conversation.git_provider as Provider,
+ }}
+ lastUpdatedAt={conversation.updated_at}
+ createdAt={conversation.created_at}
+ executionStatus={conversation.execution_status}
+ conversationId={conversation.id}
+ contextMenuOpen={openContextMenuId === conversation.id}
+ onContextMenuToggle={(isOpen) =>
+ setOpenContextMenuId(isOpen ? conversation.id : null)
+ }
+ isActive={conversation.id === currentConversationId}
+ workspaceWorkingDir={conversation.workspace?.working_dir}
+ />
+ </NavigationLink>
+ ),
+ [
+ currentConversationId,
+ handleConversationTitleChange,
+ handleDeleteProject,
+ handleStopConversation,
+ onClose,
+ openContextMenuId,
+ ],
+ );
+
+ // Standard layout: panel fills its slot in the sidebar; the inner scroll
+ // child fills the panel and scrolls when its content overflows. Modals are
+ // siblings of the scroll element and are `position: fixed`, so they don't
+ // participate in the panel's scroll geometry.
+ const showInitialSkeleton = isFetching && conversations.length === 0;
+ const showEmptyState =
+ !isFetching && conversations.length === 0 && !startTasks?.length;
+
return (
<div
- ref={(node) => {
- // TODO: Combine both refs somehow
- if (ref.current !== node) ref.current = node;
- if (scrollContainerRef.current !== node)
- scrollContainerRef.current = node;
- }}
+ ref={ref}
data-testid="conversation-panel"
- className="w-full md:w-[400px] h-full border border-[#525252] bg-[#25272D] rounded-lg overflow-y-auto absolute custom-scrollbar-always"
+ className="w-full h-full flex flex-col"
>
- {isFetching && conversations.length === 0 && (
- <div className="space-y-2">
- {Array.from({ length: 5 }).map((_, index) => (
- <ConversationCardSkeleton key={index} />
- ))}
- </div>
- )}
+ <div className="flex-1 min-h-0 overflow-y-auto overscroll-contain custom-scrollbar-always">
+ {showInitialSkeleton && (
+ <div className="space-y-2">
+ {Array.from({ length: 5 }).map((_, index) => (
+ <ConversationCardSkeleton key={index} />
+ ))}
+ </div>
+ )}
- {error && (
- <div className="flex flex-col items-center justify-center h-full">
- <p className="text-danger">{error.message}</p>
- </div>
- )}
- {!isFetching && conversations?.length === 0 && !startTasks?.length && (
- <div className="flex flex-col items-center justify-center h-full">
- <p className="text-neutral-400">
- {t(I18nKey.CONVERSATION$NO_CONVERSATIONS)}
- </p>
- </div>
- )}
- {/* Render in-progress start tasks first */}
- {startTasks?.map((task) => (
- <NavigationLink
- key={task.id}
- to={`/conversations/task-${task.id}`}
- onClick={onClose}
- >
- <StartTaskCard task={task} />
- </NavigationLink>
- ))}
- {/* Then render completed conversations */}
- {conversations?.map((conversation) => (
- <NavigationLink
- key={conversation.id}
- to={`/conversations/${conversation.id}`}
- onClick={onClose}
- >
- <ConversationCard
- onDelete={() =>
- handleDeleteProject(conversation.id, conversation.title ?? "")
- }
- onStop={() => handleStopConversation(conversation.id)}
- onChangeTitle={(title) =>
- handleConversationTitleChange(conversation.id, title)
- }
- title={conversation.title ?? ""}
- selectedRepository={{
- selected_repository: conversation.selected_repository,
- selected_branch: conversation.selected_branch,
- git_provider: conversation.git_provider as Provider,
- }}
- lastUpdatedAt={conversation.updated_at}
- createdAt={conversation.created_at}
- executionStatus={conversation.execution_status}
- conversationId={conversation.id}
- contextMenuOpen={openContextMenuId === conversation.id}
- onContextMenuToggle={(isOpen) =>
- setOpenContextMenuId(isOpen ? conversation.id : null)
- }
- llmModel={conversation.llm_model}
- />
- </NavigationLink>
- ))}
-
- {/* Loading indicator for fetching more conversations */}
- {isFetchingNextPage && (
- <div className="flex justify-center py-4">
- <LoadingSpinner size="small" />
- </div>
- )}
+ {error && (
+ <div className="flex flex-col items-center justify-center h-full">
+ <p className="text-danger">{error.message}</p>
+ </div>
+ )}
+
+ {showEmptyState && (
+ <div className="flex flex-col items-center justify-center h-full">
+ <p className="text-neutral-400">
+ {t(I18nKey.CONVERSATION$NO_CONVERSATIONS)}
+ </p>
+ </div>
+ )}
+
+ {/* Render in-progress start tasks first */}
+ {startTasks?.map((task) => (
+ <NavigationLink
+ key={task.id}
+ to={`/conversations/task-${task.id}`}
+ onClick={onClose}
+ className="block"
+ >
+ <StartTaskCard task={task} />
+ </NavigationLink>
+ ))}
+
+ {/* Recent conversations (last_updated within the past hour) */}
+ {recentConversations.map(renderConversationCard)}
+
+ {/* Older conversations are hidden by default behind a count + toggle */}
+ {olderConversations.length > 0 && (
+ <div
+ data-testid="older-conversations-summary"
+ className="px-3 py-2 text-xs text-neutral-400 flex flex-wrap items-center gap-x-2 gap-y-1 border-b border-[#1f2228]"
+ >
+ <span>
+ {olderConversations.length}{" "}
+ {t(I18nKey.CONVERSATION$N_OLDER_CONVERSATIONS)}:
+ </span>
+ <button
+ type="button"
+ data-testid="toggle-older-conversations"
+ onClick={() => setShowOlderConversations((value) => !value)}
+ className="underline hover:text-white"
+ >
+ {showOlderConversations
+ ? t(I18nKey.CONVERSATION$HIDE)
+ : t(I18nKey.CONVERSATION$SHOW_ALL)}
+ </button>
+ <button
+ type="button"
+ data-testid="delete-older-conversations"
+ onClick={() => setConfirmDeleteOlderVisible(true)}
+ className="underline hover:text-danger"
+ >
+ {t(I18nKey.CONVERSATION$DELETE_ALL)}
+ </button>
+ </div>
+ )}
+
+ {showOlderConversations &&
+ olderConversations.map(renderConversationCard)}
+
+ {/* Explicit "Load more" trigger. Only shown when more pages exist
+ *and* the older list is currently visible (or there are no older
+ conversations to begin with) — otherwise the next page would be
+ populated mostly with conversations the user has chosen to hide. */}
+ {showLoadMore && (
+ <div className="flex justify-center py-4">
+ {isFetchingNextPage ? (
+ <LoadingSpinner size="small" />
+ ) : (
+ <button
+ type="button"
+ data-testid="load-more-conversations"
+ onClick={() => fetchNextPage()}
+ className="text-xs text-neutral-400 underline hover:text-white"
+ >
+ {t(I18nKey.CONVERSATION$LOAD_MORE)}
+ </button>
+ )}
+ </div>
+ )}
+ </div>
{confirmDeleteModalVisible && (
<ConfirmDeleteModal
@@ -218,6 +360,20 @@ export function ConversationPanel({ onClose }: ConversationPanelProps) {
/>
)}
+ {confirmDeleteOlderVisible && (
+ <ConfirmDeleteModal
+ title={t(I18nKey.CONVERSATION$CONFIRM_DELETE_OLDER_TITLE)}
+ description={t(I18nKey.CONVERSATION$CONFIRM_DELETE_OLDER_DESC, {
+ count: olderConversations.length,
+ })}
+ onConfirm={async () => {
+ await handleConfirmDeleteOlder();
+ setConfirmDeleteOlderVisible(false);
+ }}
+ onCancel={() => setConfirmDeleteOlderVisible(false)}
+ />
+ )}
+
{confirmStopModalVisible && (
<ConfirmStopModal
onConfirm={() => {
@@ -231,7 +387,7 @@ export function ConversationPanel({ onClose }: ConversationPanelProps) {
{confirmExitConversationModalVisible && (
<ExitConversationModal
onConfirm={() => {
- onClose();
+ onClose?.();
}}
onClose={() => setConfirmExitConversationModalVisible(false)}
onCancel={() => setConfirmExitConversationModalVisible(false)}
diff --git a/src/components/features/conversation-panel/new-conversation-button.tsx b/src/components/features/conversation-panel/new-conversation-button.tsx
new file mode 100644
index 0000000000..0cceeb7477
--- /dev/null
+++ b/src/components/features/conversation-panel/new-conversation-button.tsx
@@ -0,0 +1,211 @@
+import React from "react";
+import { useTranslation } from "react-i18next";
+import { Plus } from "lucide-react";
+
+import { useCreateConversation } from "#/hooks/mutation/use-create-conversation";
+import { useNavigation } from "#/context/navigation-context";
+import { useIsCreatingConversation } from "#/hooks/use-is-creating-conversation";
+import { useWorkspacesStore } from "#/stores/workspaces-store";
+import { useResolvedWorkspaces } from "#/hooks/query/use-resolved-workspaces";
+import { I18nKey } from "#/i18n/declaration";
+import { cn } from "#/utils/utils";
+import RepoIcon from "#/icons/repo.svg?react";
+
+import { FolderBrowserModal } from "#/components/features/home/workspace-dropdown/folder-browser-modal";
+import { ManageWorkspacesModal } from "#/components/features/home/workspace-dropdown/manage-workspaces-modal";
+
+/**
+ * "+ New Conversation" trigger that opens an inline popover on top of the
+ * conversation list. The popover is a flat list: each entry (including a
+ * leading "No workspace" option) immediately starts a conversation when
+ * clicked. The sticky footer still exposes "+ Add Workspace" / "Manage
+ * Workspaces" entries.
+ */
+export function NewConversationButton() {
+ const { t } = useTranslation("openhands");
+ const { navigate } = useNavigation();
+
+ const [open, setOpen] = React.useState(false);
+ const popoverRef = React.useRef<HTMLDivElement>(null);
+
+ const {
+ workspaceParents,
+ addWorkspaces,
+ removeWorkspace,
+ addWorkspaceParents,
+ removeWorkspaceParent,
+ } = useWorkspacesStore();
+ const { workspaces } = useResolvedWorkspaces();
+ const [browserOpen, setBrowserOpen] = React.useState(false);
+ const [manageOpen, setManageOpen] = React.useState(false);
+
+ const { mutate: createConversation, isPending } = useCreateConversation();
+ const isCreatingElsewhere = useIsCreatingConversation();
+ // `isCreatingElsewhere` already covers in-flight mutations and the
+ // post-submit navigation window (`isNavigating`). We deliberately do not
+ // include `isSuccess` here: this component stays mounted across navigation,
+ // so a sticky `isSuccess` would lock the button as disabled forever.
+ const isCreating = isPending || isCreatingElsewhere;
+
+ // Close the popover on outside click. Modal-based children portal out of
+ // the popover, so we ignore clicks while a modal is showing.
+ React.useEffect(() => {
+ if (!open || browserOpen || manageOpen) return undefined;
+ const onDown = (e: MouseEvent) => {
+ if (
+ popoverRef.current &&
+ !popoverRef.current.contains(e.target as Node)
+ ) {
+ setOpen(false);
+ }
+ };
+ document.addEventListener("mousedown", onDown);
+ return () => document.removeEventListener("mousedown", onDown);
+ }, [open, browserOpen, manageOpen]);
+
+ React.useEffect(() => {
+ if (!open || browserOpen || manageOpen) return undefined;
+ const onKeyDown = (event: KeyboardEvent) => {
+ if (event.key === "Escape") {
+ setOpen(false);
+ }
+ };
+ window.addEventListener("keydown", onKeyDown);
+ return () => window.removeEventListener("keydown", onKeyDown);
+ }, [open, browserOpen, manageOpen]);
+
+ const launch = (workingDir?: string) => {
+ if (isCreating) return;
+ createConversation(
+ { workingDir },
+ {
+ onSuccess: (data) => {
+ setOpen(false);
+ navigate(`/conversations/${data.conversation_id}`);
+ },
+ },
+ );
+ };
+
+ const itemClass = cn(
+ "flex items-center gap-2 w-full px-2 py-2 text-sm text-white text-left",
+ "hover:bg-[#5C5D62] rounded-md transition-colors duration-150 font-normal",
+ "disabled:opacity-60 disabled:cursor-not-allowed",
+ );
+
+ const keepPopoverOpenOnMouseDown = React.useCallback(
+ (event: React.MouseEvent<HTMLButtonElement>) => {
+ event.preventDefault();
+ event.stopPropagation();
+ },
+ [],
+ );
+
+ return (
+ <div className="relative" ref={popoverRef}>
+ <button
+ type="button"
+ data-testid="new-conversation-button"
+ onClick={() => setOpen((o) => !o)}
+ aria-expanded={open}
+ className={cn(
+ "flex items-center gap-1.5 w-full px-3 py-2 rounded-md",
+ "text-sm font-medium text-white bg-[#1f1f1f99] hover:bg-[#2a2a2a]",
+ "border border-[#525252] cursor-pointer transition-colors",
+ )}
+ >
+ <Plus width={16} height={16} className="shrink-0" />
+ {t(I18nKey.SIDEBAR$NEW_CONVERSATION)}
+ </button>
+
+ {open && (
+ <div
+ data-testid="new-conversation-popover"
+ className={cn(
+ "absolute z-30 left-0 right-0 top-full mt-2 p-1",
+ "bg-[#26282D] border border-[#727987] rounded-lg shadow-xl",
+ "flex flex-col",
+ )}
+ >
+ <ul className="flex flex-col max-h-[40vh] sm:max-h-[280px] overflow-y-auto">
+ <li>
+ <button
+ type="button"
+ disabled={isCreating}
+ data-testid="launch-no-workspace"
+ onClick={() => launch()}
+ className={itemClass}
+ >
+ <span className="italic text-[#A3A3A3]">
+ {t(I18nKey.HOME$NO_WORKSPACE_OPTION)}
+ </span>
+ </button>
+ </li>
+ {workspaces.map((w) => (
+ <li key={w.id}>
+ <button
+ type="button"
+ disabled={isCreating}
+ data-testid="launch-workspace"
+ data-workspace-path={w.path}
+ onClick={() => launch(w.path)}
+ className={itemClass}
+ >
+ <RepoIcon width={14} height={14} className="shrink-0" />
+ <span className="truncate">{w.name}</span>
+ </button>
+ </li>
+ ))}
+ </ul>
+
+ <div className="flex flex-col border-t border-[#525252] mt-1 pt-1">
+ <button
+ type="button"
+ data-testid="add-workspaces-button"
+ onMouseDown={keepPopoverOpenOnMouseDown}
+ onClick={(event) => {
+ event.preventDefault();
+ event.stopPropagation();
+ setBrowserOpen(true);
+ }}
+ className={itemClass}
+ >
+ {t(I18nKey.HOME$ADD_WORKSPACES)}
+ </button>
+ {(workspaces.length > 0 || workspaceParents.length > 0) && (
+ <button
+ type="button"
+ data-testid="manage-workspaces-button"
+ onMouseDown={keepPopoverOpenOnMouseDown}
+ onClick={(event) => {
+ event.preventDefault();
+ event.stopPropagation();
+ setManageOpen(true);
+ }}
+ className={itemClass}
+ >
+ {t(I18nKey.HOME$MANAGE_WORKSPACES)}
+ </button>
+ )}
+ </div>
+ </div>
+ )}
+
+ <FolderBrowserModal
+ isOpen={browserOpen}
+ onClose={() => setBrowserOpen(false)}
+ onAdd={(items) => addWorkspaces(items)}
+ onAddParent={(items) => addWorkspaceParents(items)}
+ />
+
+ <ManageWorkspacesModal
+ isOpen={manageOpen}
+ workspaces={workspaces}
+ workspaceParents={workspaceParents}
+ onClose={() => setManageOpen(false)}
+ onRemove={(path) => removeWorkspace(path)}
+ onRemoveParent={(path) => removeWorkspaceParent(path)}
+ />
+ </div>
+ );
+}
diff --git a/src/components/features/conversation/conversation-main/conversation-main.tsx b/src/components/features/conversation/conversation-main/conversation-main.tsx
index 0684a06631..d5391f4980 100644
--- a/src/components/features/conversation/conversation-main/conversation-main.tsx
+++ b/src/components/features/conversation/conversation-main/conversation-main.tsx
@@ -1,6 +1,8 @@
import { cn } from "#/utils/utils";
import { ChatInterfaceWrapper } from "./chat-interface-wrapper";
import { ConversationTabContent } from "../conversation-tabs/conversation-tab-content/conversation-tab-content";
+import { ConversationNameWithStatus } from "../conversation-name-with-status";
+import { ConversationTabs } from "../conversation-tabs/conversation-tabs";
import { ResizeHandle } from "../../../ui/resize-handle";
import { useResizablePanels } from "#/hooks/use-resizable-panels";
import { useConversationStore } from "#/stores/conversation-store";
@@ -33,7 +35,7 @@ export function ConversationMain() {
className={cn(
isMobile
? "relative flex-1 flex flex-col"
- : "h-full flex flex-col overflow-hidden",
+ : "h-full flex flex-col overflow-hidden md:pt-3",
)}
>
<div
@@ -48,13 +50,15 @@ export function ConversationMain() {
: undefined
}
>
- {/* Chat Panel - always mounted, styled differently for mobile/desktop */}
+ {/* Chat Panel - always mounted, styled differently for mobile/desktop.
+ Owns its own header (name + status) and gets bottom padding so the
+ chat input doesn't slam the floor. */}
<div
className={cn(
"flex flex-col bg-base overflow-hidden",
isMobile
? getMobileChatPanelClass(isRightPanelShown)
- : "transition-all duration-300 ease-in-out",
+ : "transition-all duration-300 ease-in-out md:pb-3",
)}
style={
!isMobile
@@ -65,9 +69,17 @@ export function ConversationMain() {
: undefined
}
>
- <ChatInterfaceWrapper
- isRightPanelShown={!isMobile && isRightPanelShown}
- />
+ <div
+ data-testid="chat-pane-header"
+ className="flex items-center min-h-9 mb-3 pt-2 lg:pt-0"
+ >
+ <ConversationNameWithStatus />
+ </div>
+ <div className="flex-1 min-h-0 flex flex-col">
+ <ChatInterfaceWrapper
+ isRightPanelShown={!isMobile && isRightPanelShown}
+ />
+ </div>
</div>
{/* Resize Handle - only shown on desktop when right panel is visible */}
@@ -75,7 +87,9 @@ export function ConversationMain() {
<ResizeHandle onMouseDown={handleMouseDown} />
)}
- {/* Tab Content Panel - always mounted, styled as bottom sheet (mobile) or side panel (desktop) */}
+ {/* Tab Content Panel - always mounted, styled as bottom sheet (mobile)
+ or side panel (desktop). Owns the tabs header and extends all the
+ way to the bottom of the viewport (no bottom padding). */}
<div
className={cn(
"transition-all duration-300 ease-in-out overflow-hidden",
@@ -104,7 +118,15 @@ export function ConversationMain() {
: "flex flex-col flex-1 gap-3 min-w-max h-full",
)}
>
- <ConversationTabContent />
+ <div
+ data-testid="tabs-pane-header"
+ className="flex items-center min-h-9"
+ >
+ <ConversationTabs />
+ </div>
+ <div className="flex-1 min-h-0 flex flex-col">
+ <ConversationTabContent />
+ </div>
</div>
</div>
</div>
diff --git a/src/components/features/conversation/conversation-name-context-menu.tsx b/src/components/features/conversation/conversation-name-context-menu.tsx
index 26f74ac33e..3e6f0fa42b 100644
--- a/src/components/features/conversation/conversation-name-context-menu.tsx
+++ b/src/components/features/conversation/conversation-name-context-menu.tsx
@@ -1,3 +1,5 @@
+import React from "react";
+import ReactDOM from "react-dom";
import { useTranslation } from "react-i18next";
import { useActiveBackend } from "#/contexts/active-backend-context";
import { useActiveConversation } from "#/hooks/query/use-active-conversation";
@@ -40,6 +42,13 @@ interface ConversationNameContextMenuProps {
onDownloadConversation?: (event: React.MouseEvent<HTMLButtonElement>) => void;
shareUrl?: string;
position?: "top" | "bottom";
+ /**
+ * Element the menu should anchor against. When provided, the menu renders
+ * into a portal at the document body using fixed positioning so it cannot be
+ * clipped by ancestors with `overflow: hidden` (e.g. the chat panel that
+ * sits next to the right-side tabs panel).
+ */
+ anchorRef?: React.RefObject<HTMLElement | null>;
}
export function ConversationNameContextMenu({
@@ -56,6 +65,7 @@ export function ConversationNameContextMenu({
onDownloadConversation,
shareUrl,
position = "bottom",
+ anchorRef,
}: ConversationNameContextMenuProps) {
const isMobile = useBreakpoint();
@@ -63,6 +73,41 @@ export function ConversationNameContextMenu({
const { backend } = useActiveBackend();
const { data: conversation } = useActiveConversation();
const ref = useClickOutsideElement<HTMLUListElement>(onClose);
+
+ // When anchored, render via a portal with fixed positioning computed from
+ // the anchor's bounding rect. This avoids being clipped by ancestors with
+ // `overflow: hidden`.
+ const anchorElement = anchorRef?.current ?? null;
+ const [portalStyle, setPortalStyle] = React.useState<React.CSSProperties>();
+ React.useLayoutEffect(() => {
+ if (!anchorElement) return undefined;
+
+ const updatePosition = () => {
+ const rect = anchorElement.getBoundingClientRect();
+ if (!rect) return;
+ // 8px gap roughly matching the previous `mt-2` spacing.
+ const gap = 8;
+ const style: React.CSSProperties = {
+ position: "fixed",
+ zIndex: 9999,
+ };
+ if (position === "top") {
+ style.bottom = window.innerHeight - rect.top + gap;
+ } else {
+ style.top = rect.bottom + gap;
+ }
+ style.left = rect.left;
+ setPortalStyle(style);
+ };
+
+ updatePosition();
+ window.addEventListener("resize", updatePosition);
+ window.addEventListener("scroll", updatePosition, true);
+ return () => {
+ window.removeEventListener("resize", updatePosition);
+ window.removeEventListener("scroll", updatePosition, true);
+ };
+ }, [anchorElement, position]);
const hasTools = Boolean(onShowAgentTools || onShowSkills || onShowHooks);
const hasInfo = Boolean(onDisplayCost);
const hasControl = Boolean(onStop || onDelete);
@@ -74,13 +119,24 @@ export function ConversationNameContextMenu({
const shouldShowPublicSharing =
backend.kind === "cloud" && Boolean(onTogglePublic);
- return (
+ const isPortaled = Boolean(anchorElement);
+ // When portaled the menu is positioned via inline `style` (fixed coords from
+ // the anchor rect), so we must drop the variant-driven absolute positioning
+ // that would otherwise pin it to its now-irrelevant offset parent.
+ const portalClassName = isPortaled
+ ? "!static !top-auto !bottom-auto !left-auto !right-auto !mt-0"
+ : "";
+
+ const menu = (
<ContextMenu
ref={ref}
testId="conversation-name-context-menu"
position={position}
alignment="left"
- className={isMobile ? "right-0 translate-x-[34%] left-auto" : ""}
+ className={cn(
+ isMobile ? "right-0 translate-x-[34%] left-auto" : "",
+ portalClassName,
+ )}
>
{onRename && (
<ContextMenuListItem
@@ -242,4 +298,16 @@ export function ConversationNameContextMenu({
)}
</ContextMenu>
);
+
+ if (isPortaled) {
+ if (typeof document === "undefined" || !portalStyle) {
+ return null;
+ }
+ return ReactDOM.createPortal(
+ <div style={portalStyle}>{menu}</div>,
+ document.body,
+ );
+ }
+
+ return menu;
}
diff --git a/src/components/features/conversation/conversation-name.tsx b/src/components/features/conversation/conversation-name.tsx
index e9a8cab298..004bdcc4ab 100644
--- a/src/components/features/conversation/conversation-name.tsx
+++ b/src/components/features/conversation/conversation-name.tsx
@@ -14,7 +14,6 @@ import { HooksModal } from "../conversation-panel/hooks-modal";
import { ConfirmDeleteModal } from "../conversation-panel/confirm-delete-modal";
import { ConfirmStopModal } from "../conversation-panel/confirm-stop-modal";
import { MetricsModal } from "./metrics-modal/metrics-modal";
-import CircuitIcon from "#/icons/u-circuit.svg?react";
export function ConversationName() {
const { t } = useTranslation("openhands");
@@ -25,6 +24,7 @@ export function ConversationName() {
const [titleMode, setTitleMode] = React.useState<"view" | "edit">("view");
const [contextMenuOpen, setContextMenuOpen] = React.useState(false);
const inputRef = React.useRef<HTMLInputElement>(null);
+ const ellipsisAnchorRef = React.useRef<HTMLDivElement>(null);
// Use the custom hook for context menu handlers
const {
@@ -159,19 +159,8 @@ export function ConversationName() {
</div>
)}
- {titleMode !== "edit" && conversation.llm_model && (
- <span
- className="text-xs text-[#A3A3A3] flex items-center gap-1 whitespace-nowrap"
- title={conversation.llm_model}
- data-testid="conversation-name-llm-model"
- >
- <CircuitIcon width={12} height={12} className="shrink-0" />
- <span>{conversation.llm_model}</span>
- </span>
- )}
-
{titleMode !== "edit" && (
- <div className="relative flex items-center">
+ <div ref={ellipsisAnchorRef} className="relative flex items-center">
<EllipsisButton fill="#B1B9D3" onClick={handleEllipsisClick} />
{contextMenuOpen && (
<ConversationNameContextMenu
@@ -196,6 +185,7 @@ export function ConversationName() {
: undefined
}
position="bottom"
+ anchorRef={ellipsisAnchorRef}
/>
)}
</div>
diff --git a/src/components/features/home/recent-conversations/conversation-status-dot.tsx b/src/components/features/home/recent-conversations/conversation-status-dot.tsx
index 6d2ad93911..da1253450e 100644
--- a/src/components/features/home/recent-conversations/conversation-status-dot.tsx
+++ b/src/components/features/home/recent-conversations/conversation-status-dot.tsx
@@ -1,53 +1,112 @@
-import { useMemo } from "react";
import { useTranslation } from "react-i18next";
import { ExecutionStatus } from "#/types/agent-server/core/base/common";
-import { cn } from "#/utils/utils";
import { StyledTooltip } from "#/components/shared/buttons/styled-tooltip";
interface ConversationStatusDotProps {
executionStatus: ExecutionStatus | null | undefined;
}
-const labelKeyFor = (status: ExecutionStatus | null | undefined): string => {
+type Visual = "check" | "working" | "paused" | "error" | "unknown";
+
+const SUCCESS_GREEN = "#1FBD53";
+const PAUSED_GRAY = "#A3A3A3";
+const ERROR_RED = "#FF684E";
+const UNKNOWN_GRAY = "#3C3C49";
+
+const visualFor = (status: ExecutionStatus | null | undefined): Visual => {
switch (status) {
+ case ExecutionStatus.FINISHED:
+ return "check";
case ExecutionStatus.RUNNING:
+ return "working";
+ case ExecutionStatus.PAUSED:
case ExecutionStatus.IDLE:
case ExecutionStatus.WAITING_FOR_CONFIRMATION:
- case ExecutionStatus.FINISHED:
- return "COMMON$RUNNING";
- case ExecutionStatus.PAUSED:
- return "COMMON$PAUSED";
+ return "paused";
case ExecutionStatus.ERROR:
case ExecutionStatus.STUCK:
- return "COMMON$STOPPED";
+ return "error";
+ default:
+ return "unknown";
+ }
+};
+
+const labelKeyFor = (visual: Visual): string => {
+ switch (visual) {
+ case "check":
+ return "COMMON$FINISHED";
+ case "working":
+ return "COMMON$WORKING";
+ case "paused":
+ return "COMMON$PAUSED";
+ case "error":
+ return "COMMON$ERROR";
default:
return "COMMON$STOPPED";
}
};
+function renderIndicator(visual: Visual) {
+ switch (visual) {
+ case "check":
+ return (
+ <svg
+ data-testid="conversation-status-check"
+ viewBox="0 0 12 12"
+ className="w-2.5 h-2.5"
+ fill="none"
+ stroke={SUCCESS_GREEN}
+ strokeWidth={2.25}
+ strokeLinecap="round"
+ strokeLinejoin="round"
+ aria-hidden="true"
+ >
+ <path d="M2.5 6.5 5 9l4.5-5.5" />
+ </svg>
+ );
+ case "working":
+ return (
+ <span
+ data-testid="conversation-status-working"
+ className="w-1.5 h-1.5 rounded-full animate-pulse"
+ style={{ backgroundColor: SUCCESS_GREEN }}
+ />
+ );
+ case "paused":
+ return (
+ <span
+ data-testid="conversation-status-paused"
+ className="w-1.5 h-1.5 rounded-full"
+ style={{ backgroundColor: PAUSED_GRAY }}
+ />
+ );
+ case "error":
+ return (
+ <span
+ data-testid="conversation-status-error"
+ className="w-1.5 h-1.5 rounded-full"
+ style={{ backgroundColor: ERROR_RED }}
+ />
+ );
+ default:
+ return (
+ <span
+ data-testid="conversation-status-unknown"
+ className="w-1.5 h-1.5 rounded-full"
+ style={{ backgroundColor: UNKNOWN_GRAY }}
+ />
+ );
+ }
+}
+
export function ConversationStatusDot({
executionStatus,
}: ConversationStatusDotProps) {
const { t } = useTranslation("openhands");
- const backgroundColor = useMemo(() => {
- switch (executionStatus) {
- case ExecutionStatus.RUNNING:
- case ExecutionStatus.IDLE:
- case ExecutionStatus.WAITING_FOR_CONFIRMATION:
- case ExecutionStatus.FINISHED:
- return "bg-[#1FBD53]";
- case ExecutionStatus.PAUSED:
- return "bg-[#A3A3A3]";
- case ExecutionStatus.ERROR:
- case ExecutionStatus.STUCK:
- return "bg-[#A3A3A3]";
- default:
- return "bg-[#3C3C49]";
- }
- }, [executionStatus]);
-
- const label = t(labelKeyFor(executionStatus));
+ const visual = visualFor(executionStatus);
+ const label = t(labelKeyFor(visual));
+ const indicator = renderIndicator(visual);
return (
<StyledTooltip
@@ -56,7 +115,9 @@ export function ConversationStatusDot({
showArrow
tooltipClassName="bg-[#1a1a1a] text-white text-xs shadow-lg"
>
- <div className={cn("w-1.5 h-1.5 rounded-full", backgroundColor)} />
+ <div className="w-2.5 h-2.5 flex items-center justify-center shrink-0">
+ {indicator}
+ </div>
</StyledTooltip>
);
}
diff --git a/src/components/features/home/recent-conversations/recent-conversation.tsx b/src/components/features/home/recent-conversations/recent-conversation.tsx
index 283b1f8834..7997ce87f1 100644
--- a/src/components/features/home/recent-conversations/recent-conversation.tsx
+++ b/src/components/features/home/recent-conversations/recent-conversation.tsx
@@ -8,7 +8,6 @@ import { formatTimeDelta } from "#/utils/format-time-delta";
import { I18nKey } from "#/i18n/declaration";
import { ConversationStatusDot } from "./conversation-status-dot";
import RepoForkedIcon from "#/icons/repo-forked.svg?react";
-import CircuitIcon from "#/icons/u-circuit.svg?react";
interface RecentConversationProps {
conversation: AppConversation;
@@ -68,16 +67,6 @@ export function RecentConversation({ conversation }: RecentConversationProps) {
) : null}
</div>
<div className="flex items-center gap-2">
- {conversation.llm_model && (
- <span
- className="max-w-[120px] flex items-center gap-1 overflow-hidden"
- title={conversation.llm_model}
- data-testid="recent-conversation-llm-model"
- >
- <CircuitIcon width={12} height={12} className="shrink-0" />
- <span className="truncate">{conversation.llm_model}</span>
- </span>
- )}
{(conversation.created_at || conversation.updated_at) && (
<span>
{formatTimeDelta(
diff --git a/src/components/features/home/repo-connector.tsx b/src/components/features/home/repo-connector.tsx
index e6295f3e76..bc5f658303 100644
--- a/src/components/features/home/repo-connector.tsx
+++ b/src/components/features/home/repo-connector.tsx
@@ -1,32 +1,21 @@
-import { useActiveBackend } from "#/contexts/active-backend-context";
import { useUserProviders } from "#/hooks/use-user-providers";
-import { GitRepository } from "#/types/git";
-import { RepositorySelectionForm } from "./repo-selection-form";
import { WorkspaceSelectionForm } from "./workspace-selection-form";
-interface RepoConnectorProps {
- onRepoSelection: (repo: GitRepository | null) => void;
-}
-
-export function RepoConnector({ onRepoSelection }: RepoConnectorProps) {
- const { isLoadingSettings, providers } = useUserProviders();
- const isCloud = useActiveBackend().backend.kind === "cloud";
+export function RepoConnector() {
+ const { isLoadingSettings } = useUserProviders();
+ // Agent-canvas talks directly to an `agent_server` backend (there is no
+ // hosted/cloud backend in this build), so the home screen always shows the
+ // local-workspace launcher rather than a git repository picker. If/when a
+ // cloud backend is supported, this component should branch on the backend
+ // mode and render <RepositorySelectionForm /> instead.
return (
<section
data-testid="repo-connector"
className="w-full flex flex-col gap-6 rounded-[12px] p-[20px] border border-[#727987] bg-[#26282D] min-h-[263.5px] relative"
>
- {isCloud && providers.length > 0 && (
- <RepositorySelectionForm
- onRepoSelection={onRepoSelection}
- isLoadingSettings={isLoadingSettings}
- />
- )}
- {!isCloud && (
- <WorkspaceSelectionForm isLoadingSettings={isLoadingSettings} />
- )}
+ <WorkspaceSelectionForm isLoadingSettings={isLoadingSettings} />
</section>
);
}
diff --git a/src/components/features/settings/git-settings/azure-devops-token-help-anchor.tsx b/src/components/features/settings/git-settings/azure-devops-token-help-anchor.tsx
new file mode 100644
index 0000000000..edee1335ea
--- /dev/null
+++ b/src/components/features/settings/git-settings/azure-devops-token-help-anchor.tsx
@@ -0,0 +1,20 @@
+import { useTranslation } from "react-i18next";
+import { I18nKey } from "#/i18n/declaration";
+
+export function AzureDevOpsTokenHelpAnchor() {
+ const { t } = useTranslation("openhands");
+
+ return (
+ <p data-testid="azure-devops-token-help-anchor" className="text-xs">
+ <a
+ href="https://learn.microsoft.com/en-us/azure/devops/organizations/accounts/use-personal-access-tokens-to-authenticate"
+ target="_blank"
+ className="underline underline-offset-2"
+ rel="noopener noreferrer"
+ aria-label={t(I18nKey.GIT$AZURE_DEVOPS_TOKEN_HELP)}
+ >
+ {t(I18nKey.GIT$AZURE_DEVOPS_TOKEN_HELP)}
+ </a>
+ </p>
+ );
+}
diff --git a/src/components/features/settings/git-settings/azure-devops-token-input.tsx b/src/components/features/settings/git-settings/azure-devops-token-input.tsx
new file mode 100644
index 0000000000..df451e7854
--- /dev/null
+++ b/src/components/features/settings/git-settings/azure-devops-token-input.tsx
@@ -0,0 +1,64 @@
+import { useTranslation } from "react-i18next";
+import { I18nKey } from "#/i18n/declaration";
+import { SettingsInput } from "../settings-input";
+import { AzureDevOpsTokenHelpAnchor } from "./azure-devops-token-help-anchor";
+import { KeyStatusIcon } from "../key-status-icon";
+
+interface AzureDevOpsTokenInputProps {
+ onChange: (value: string) => void;
+ onAzureDevOpsHostChange: (value: string) => void;
+ isAzureDevOpsTokenSet: boolean;
+ name: string;
+ azureDevOpsHostSet: string | null | undefined;
+}
+
+export function AzureDevOpsTokenInput({
+ onChange,
+ onAzureDevOpsHostChange,
+ isAzureDevOpsTokenSet,
+ name,
+ azureDevOpsHostSet,
+}: AzureDevOpsTokenInputProps) {
+ const { t } = useTranslation("openhands");
+
+ return (
+ <div className="flex flex-col gap-6">
+ <SettingsInput
+ testId={name}
+ name={name}
+ onChange={onChange}
+ label={t(I18nKey.GIT$AZURE_DEVOPS_TOKEN)}
+ type="password"
+ className="w-full max-w-[680px]"
+ placeholder={isAzureDevOpsTokenSet ? "<hidden>" : ""}
+ startContent={
+ isAzureDevOpsTokenSet && (
+ <KeyStatusIcon
+ testId="azure-devops-set-token-indicator"
+ isSet={isAzureDevOpsTokenSet}
+ />
+ )
+ }
+ />
+
+ <SettingsInput
+ onChange={onAzureDevOpsHostChange || (() => {})}
+ name="azure-devops-host-input"
+ testId="azure-devops-host-input"
+ label={t(I18nKey.GIT$AZURE_DEVOPS_HOST)}
+ type="text"
+ className="w-full max-w-[680px]"
+ placeholder={t(I18nKey.GIT$AZURE_DEVOPS_HOST_PLACEHOLDER)}
+ defaultValue={azureDevOpsHostSet || undefined}
+ startContent={
+ azureDevOpsHostSet &&
+ azureDevOpsHostSet.trim() !== "" && (
+ <KeyStatusIcon testId="azure-devops-set-host-indicator" isSet />
+ )
+ }
+ />
+
+ <AzureDevOpsTokenHelpAnchor />
+ </div>
+ );
+}
diff --git a/src/components/features/settings/git-settings/bitbucket-dc-token-help-anchor.tsx b/src/components/features/settings/git-settings/bitbucket-dc-token-help-anchor.tsx
new file mode 100644
index 0000000000..46935f9d71
--- /dev/null
+++ b/src/components/features/settings/git-settings/bitbucket-dc-token-help-anchor.tsx
@@ -0,0 +1,28 @@
+import { Trans, useTranslation } from "react-i18next";
+import { I18nKey } from "#/i18n/declaration";
+
+export function BitbucketDCTokenHelpAnchor() {
+ const { t } = useTranslation("openhands");
+
+ return (
+ <p
+ data-testid="bitbucket-dc-token-help-anchor"
+ className="text-xs max-w-[680px]"
+ >
+ <Trans
+ ns="openhands"
+ i18nKey={I18nKey.BITBUCKET_DATA_CENTER$TOKEN_HELP_TEXT}
+ components={[
+ <a
+ key="bitbucket-dc-token-help-anchor-link"
+ aria-label={t(I18nKey.GIT$BITBUCKET_DC_TOKEN_HELP_LINK)}
+ href="https://confluence.atlassian.com/bitbucketserver/http-access-tokens-939515499.html"
+ target="_blank"
+ className="underline underline-offset-2"
+ rel="noopener noreferrer"
+ />,
+ ]}
+ />
+ </p>
+ );
+}
diff --git a/src/components/features/settings/git-settings/bitbucket-dc-token-help-input.tsx b/src/components/features/settings/git-settings/bitbucket-dc-token-help-input.tsx
new file mode 100644
index 0000000000..c0043bd494
--- /dev/null
+++ b/src/components/features/settings/git-settings/bitbucket-dc-token-help-input.tsx
@@ -0,0 +1,67 @@
+import { useTranslation } from "react-i18next";
+import { I18nKey } from "#/i18n/declaration";
+import { SettingsInput } from "../settings-input";
+import { BitbucketDCTokenHelpAnchor } from "./bitbucket-dc-token-help-anchor";
+import { KeyStatusIcon } from "../key-status-icon";
+import { cn } from "#/utils/utils";
+
+interface BitbucketDCTokenInputProps {
+ onChange: (value: string) => void;
+ onBitbucketDCHostChange: (value: string) => void;
+ isBitbucketDCTokenSet: boolean;
+ name: string;
+ bitbucketDCHostSet: string | null | undefined;
+ className?: string;
+}
+
+export function BitbucketDCTokenInput({
+ onChange,
+ onBitbucketDCHostChange,
+ isBitbucketDCTokenSet,
+ name,
+ bitbucketDCHostSet,
+ className,
+}: BitbucketDCTokenInputProps) {
+ const { t } = useTranslation("openhands");
+
+ return (
+ <div className={cn("flex flex-col gap-6", className)}>
+ <SettingsInput
+ testId={name}
+ name={name}
+ onChange={onChange}
+ label={t(I18nKey.BITBUCKET_DATA_CENTER$TOKEN_LABEL)}
+ type="password"
+ className="w-full max-w-[680px]"
+ placeholder={isBitbucketDCTokenSet ? "<hidden>" : "username:token"}
+ startContent={
+ isBitbucketDCTokenSet && (
+ <KeyStatusIcon
+ testId="bb-dc-set-token-indicator"
+ isSet={isBitbucketDCTokenSet}
+ />
+ )
+ }
+ />
+
+ <SettingsInput
+ onChange={onBitbucketDCHostChange || (() => {})}
+ name="bitbucket-dc-host-input"
+ testId="bitbucket-dc-host-input"
+ label={t(I18nKey.BITBUCKET_DATA_CENTER$HOST_LABEL)}
+ type="text"
+ className="w-full max-w-[680px]"
+ placeholder="bitbucket.your-company.com"
+ defaultValue={bitbucketDCHostSet || undefined}
+ startContent={
+ bitbucketDCHostSet &&
+ bitbucketDCHostSet.trim() !== "" && (
+ <KeyStatusIcon testId="bb-dc-set-host-indicator" isSet />
+ )
+ }
+ />
+
+ <BitbucketDCTokenHelpAnchor />
+ </div>
+ );
+}
diff --git a/src/components/features/settings/git-settings/bitbucket-token-help-anchor.tsx b/src/components/features/settings/git-settings/bitbucket-token-help-anchor.tsx
new file mode 100644
index 0000000000..9c70f3874d
--- /dev/null
+++ b/src/components/features/settings/git-settings/bitbucket-token-help-anchor.tsx
@@ -0,0 +1,33 @@
+import { Trans, useTranslation } from "react-i18next";
+import { I18nKey } from "#/i18n/declaration";
+
+export function BitbucketTokenHelpAnchor() {
+ const { t } = useTranslation("openhands");
+
+ return (
+ <p data-testid="bitbucket-token-help-anchor" className="text-xs">
+ <Trans
+ ns="openhands"
+ i18nKey={I18nKey.BITBUCKET$TOKEN_HELP_TEXT}
+ components={[
+ <a
+ key="bitbucket-token-help-anchor-link"
+ aria-label={t(I18nKey.GIT$BITBUCKET_TOKEN_HELP_LINK)}
+ href="https://bitbucket.org/account/settings/app-passwords/new?scopes=repository:write,pullrequest:write,issue:write"
+ target="_blank"
+ className="underline underline-offset-2"
+ rel="noopener noreferrer"
+ />,
+ <a
+ key="bitbucket-token-help-anchor-link-2"
+ aria-label={t(I18nKey.GIT$BITBUCKET_TOKEN_SEE_MORE_LINK)}
+ href="https://support.atlassian.com/bitbucket-cloud/docs/app-passwords/"
+ target="_blank"
+ className="underline underline-offset-2"
+ rel="noopener noreferrer"
+ />,
+ ]}
+ />
+ </p>
+ );
+}
diff --git a/src/components/features/settings/git-settings/bitbucket-token-input.tsx b/src/components/features/settings/git-settings/bitbucket-token-input.tsx
new file mode 100644
index 0000000000..121022fe3a
--- /dev/null
+++ b/src/components/features/settings/git-settings/bitbucket-token-input.tsx
@@ -0,0 +1,67 @@
+import { useTranslation } from "react-i18next";
+import { I18nKey } from "#/i18n/declaration";
+import { SettingsInput } from "../settings-input";
+import { BitbucketTokenHelpAnchor } from "./bitbucket-token-help-anchor";
+import { KeyStatusIcon } from "../key-status-icon";
+import { cn } from "#/utils/utils";
+
+interface BitbucketTokenInputProps {
+ onChange: (value: string) => void;
+ onBitbucketHostChange: (value: string) => void;
+ isBitbucketTokenSet: boolean;
+ name: string;
+ bitbucketHostSet: string | null | undefined;
+ className?: string;
+}
+
+export function BitbucketTokenInput({
+ onChange,
+ onBitbucketHostChange,
+ isBitbucketTokenSet,
+ name,
+ bitbucketHostSet,
+ className,
+}: BitbucketTokenInputProps) {
+ const { t } = useTranslation("openhands");
+
+ return (
+ <div className={cn("flex flex-col gap-6", className)}>
+ <SettingsInput
+ testId={name}
+ name={name}
+ onChange={onChange}
+ label={t(I18nKey.BITBUCKET$TOKEN_LABEL)}
+ type="password"
+ className="w-full max-w-[680px]"
+ placeholder={isBitbucketTokenSet ? "<hidden>" : "username:app_password"}
+ startContent={
+ isBitbucketTokenSet && (
+ <KeyStatusIcon
+ testId="bb-set-token-indicator"
+ isSet={isBitbucketTokenSet}
+ />
+ )
+ }
+ />
+
+ <SettingsInput
+ onChange={onBitbucketHostChange || (() => {})}
+ name="bitbucket-host-input"
+ testId="bitbucket-host-input"
+ label={t(I18nKey.BITBUCKET$HOST_LABEL)}
+ type="text"
+ className="w-full max-w-[680px]"
+ placeholder="bitbucket.org"
+ defaultValue={bitbucketHostSet || undefined}
+ startContent={
+ bitbucketHostSet &&
+ bitbucketHostSet.trim() !== "" && (
+ <KeyStatusIcon testId="bb-set-host-indicator" isSet />
+ )
+ }
+ />
+
+ <BitbucketTokenHelpAnchor />
+ </div>
+ );
+}
diff --git a/src/components/features/settings/git-settings/configure-github-repositories-anchor.tsx b/src/components/features/settings/git-settings/configure-github-repositories-anchor.tsx
new file mode 100644
index 0000000000..14e0b383c2
--- /dev/null
+++ b/src/components/features/settings/git-settings/configure-github-repositories-anchor.tsx
@@ -0,0 +1,32 @@
+import { useTranslation } from "react-i18next";
+import { I18nKey } from "#/i18n/declaration";
+import { BrandButton } from "../brand-button";
+
+interface ConfigureGitHubRepositoriesAnchorProps {
+ slug: string;
+}
+
+export function ConfigureGitHubRepositoriesAnchor({
+ slug,
+}: ConfigureGitHubRepositoriesAnchorProps) {
+ const { t } = useTranslation("openhands");
+
+ return (
+ <div data-testid="configure-github-repositories-button" className="py-9">
+ <BrandButton
+ type="button"
+ variant="primary"
+ className="w-55"
+ onClick={() =>
+ window.open(
+ `https://github.com/apps/${slug}/installations/new`,
+ "_blank",
+ "noreferrer noopener",
+ )
+ }
+ >
+ {t(I18nKey.GITHUB$CONFIGURE_REPOS)}
+ </BrandButton>
+ </div>
+ );
+}
diff --git a/src/components/features/settings/git-settings/forgejo-token-input.tsx b/src/components/features/settings/git-settings/forgejo-token-input.tsx
new file mode 100644
index 0000000000..d9df2059dd
--- /dev/null
+++ b/src/components/features/settings/git-settings/forgejo-token-input.tsx
@@ -0,0 +1,64 @@
+import { useTranslation } from "react-i18next";
+import { I18nKey } from "#/i18n/declaration";
+import { SettingsInput } from "../settings-input";
+import { KeyStatusIcon } from "../key-status-icon";
+import { cn } from "#/utils/utils";
+
+interface ForgejoTokenInputProps {
+ onChange: (value: string) => void;
+ onForgejoHostChange: (value: string) => void;
+ isForgejoTokenSet: boolean;
+ name: string;
+ forgejoHostSet: string | null | undefined;
+ className?: string;
+}
+
+export function ForgejoTokenInput({
+ onChange,
+ onForgejoHostChange,
+ isForgejoTokenSet,
+ name,
+ forgejoHostSet,
+ className,
+}: ForgejoTokenInputProps) {
+ const { t } = useTranslation("openhands");
+
+ return (
+ <div className={cn("flex flex-col gap-6", className)}>
+ <SettingsInput
+ testId={name}
+ name={name}
+ onChange={onChange}
+ label={t(I18nKey.FORGEJO$TOKEN_LABEL)}
+ type="password"
+ className="w-full max-w-[680px]"
+ placeholder={isForgejoTokenSet ? "<hidden>" : ""}
+ startContent={
+ isForgejoTokenSet && (
+ <KeyStatusIcon
+ testId="forgejo-set-token-indicator"
+ isSet={isForgejoTokenSet}
+ />
+ )
+ }
+ />
+
+ <SettingsInput
+ onChange={onForgejoHostChange || (() => {})}
+ name="forgejo-host-input"
+ testId="forgejo-host-input"
+ label={t(I18nKey.FORGEJO$HOST_LABEL)}
+ type="text"
+ className="w-full max-w-[680px]"
+ placeholder="codeberg.org"
+ defaultValue={forgejoHostSet || undefined}
+ startContent={
+ forgejoHostSet &&
+ forgejoHostSet.trim() !== "" && (
+ <KeyStatusIcon testId="forgejo-set-host-indicator" isSet />
+ )
+ }
+ />
+ </div>
+ );
+}
diff --git a/src/components/features/settings/git-settings/github-settings-inputs-skeleton.tsx b/src/components/features/settings/git-settings/github-settings-inputs-skeleton.tsx
new file mode 100644
index 0000000000..9885b98cec
--- /dev/null
+++ b/src/components/features/settings/git-settings/github-settings-inputs-skeleton.tsx
@@ -0,0 +1,18 @@
+import { InputSkeleton } from "../input-skeleton";
+import { SubtextSkeleton } from "../subtext-skeleton";
+
+export function GitSettingInputsSkeleton() {
+ return (
+ <div className="px-11 py-9 flex flex-col gap-12">
+ <div className="flex flex-col gap-6">
+ <InputSkeleton />
+ <SubtextSkeleton />
+ </div>
+
+ <div className="flex flex-col gap-6">
+ <InputSkeleton />
+ <SubtextSkeleton />
+ </div>
+ </div>
+ );
+}
diff --git a/src/components/features/settings/git-settings/github-token-help-anchor.tsx b/src/components/features/settings/git-settings/github-token-help-anchor.tsx
new file mode 100644
index 0000000000..3566cd32a0
--- /dev/null
+++ b/src/components/features/settings/git-settings/github-token-help-anchor.tsx
@@ -0,0 +1,33 @@
+import { Trans, useTranslation } from "react-i18next";
+import { I18nKey } from "#/i18n/declaration";
+
+export function GitHubTokenHelpAnchor() {
+ const { t } = useTranslation("openhands");
+
+ return (
+ <p data-testid="github-token-help-anchor" className="text-xs">
+ <Trans
+ ns="openhands"
+ i18nKey={I18nKey.GITHUB$TOKEN_HELP_TEXT}
+ components={[
+ <a
+ key="github-token-help-anchor-link"
+ aria-label={t(I18nKey.GIT$GITHUB_TOKEN_HELP_LINK)}
+ href="https://github.com/settings/tokens/new?description=openhands-app&scopes=repo,user,workflow"
+ target="_blank"
+ className="underline underline-offset-2"
+ rel="noopener noreferrer"
+ />,
+ <a
+ key="github-token-help-anchor-link-2"
+ aria-label={t(I18nKey.GIT$GITHUB_TOKEN_SEE_MORE_LINK)}
+ href="https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/creating-a-personal-access-token"
+ target="_blank"
+ className="underline underline-offset-2"
+ rel="noopener noreferrer"
+ />,
+ ]}
+ />
+ </p>
+ );
+}
diff --git a/src/components/features/settings/git-settings/github-token-input.tsx b/src/components/features/settings/git-settings/github-token-input.tsx
new file mode 100644
index 0000000000..d6d0fa3b1b
--- /dev/null
+++ b/src/components/features/settings/git-settings/github-token-input.tsx
@@ -0,0 +1,67 @@
+import { useTranslation } from "react-i18next";
+import { I18nKey } from "#/i18n/declaration";
+import { SettingsInput } from "../settings-input";
+import { GitHubTokenHelpAnchor } from "./github-token-help-anchor";
+import { KeyStatusIcon } from "../key-status-icon";
+import { cn } from "#/utils/utils";
+
+interface GitHubTokenInputProps {
+ onChange: (value: string) => void;
+ onGitHubHostChange: (value: string) => void;
+ isGitHubTokenSet: boolean;
+ name: string;
+ githubHostSet: string | null | undefined;
+ className?: string;
+}
+
+export function GitHubTokenInput({
+ onChange,
+ onGitHubHostChange,
+ isGitHubTokenSet,
+ name,
+ githubHostSet,
+ className,
+}: GitHubTokenInputProps) {
+ const { t } = useTranslation("openhands");
+
+ return (
+ <div className={cn("flex flex-col gap-6", className)}>
+ <SettingsInput
+ testId={name}
+ name={name}
+ onChange={onChange}
+ label={t(I18nKey.GITHUB$TOKEN_LABEL)}
+ type="password"
+ className="w-full max-w-[680px]"
+ placeholder={isGitHubTokenSet ? "<hidden>" : ""}
+ startContent={
+ isGitHubTokenSet && (
+ <KeyStatusIcon
+ testId="gh-set-token-indicator"
+ isSet={isGitHubTokenSet}
+ />
+ )
+ }
+ />
+
+ <SettingsInput
+ onChange={onGitHubHostChange || (() => {})}
+ name="github-host-input"
+ testId="github-host-input"
+ label={t(I18nKey.GITHUB$HOST_LABEL)}
+ type="text"
+ className="w-full max-w-[680px]"
+ placeholder="github.com"
+ defaultValue={githubHostSet || undefined}
+ startContent={
+ githubHostSet &&
+ githubHostSet.trim() !== "" && (
+ <KeyStatusIcon testId="gh-set-host-indicator" isSet />
+ )
+ }
+ />
+
+ <GitHubTokenHelpAnchor />
+ </div>
+ );
+}
diff --git a/src/components/features/settings/git-settings/gitlab-token-help-anchor.tsx b/src/components/features/settings/git-settings/gitlab-token-help-anchor.tsx
new file mode 100644
index 0000000000..a871d8ee30
--- /dev/null
+++ b/src/components/features/settings/git-settings/gitlab-token-help-anchor.tsx
@@ -0,0 +1,33 @@
+import { Trans, useTranslation } from "react-i18next";
+import { I18nKey } from "#/i18n/declaration";
+
+export function GitLabTokenHelpAnchor() {
+ const { t } = useTranslation("openhands");
+
+ return (
+ <p data-testid="gitlab-token-help-anchor" className="text-xs">
+ <Trans
+ ns="openhands"
+ i18nKey={I18nKey.GITLAB$TOKEN_HELP_TEXT}
+ components={[
+ <a
+ key="gitlab-token-help-anchor-link"
+ aria-label={t(I18nKey.GIT$GITLAB_TOKEN_HELP_LINK)}
+ href="https://gitlab.com/-/user_settings/personal_access_tokens?name=openhands-app&scopes=api,read_user,read_repository,write_repository"
+ target="_blank"
+ className="underline underline-offset-2"
+ rel="noopener noreferrer"
+ />,
+ <a
+ key="gitlab-token-help-anchor-link-2"
+ aria-label={t(I18nKey.GIT$GITLAB_TOKEN_SEE_MORE_LINK)}
+ href="https://docs.gitlab.com/user/profile/personal_access_tokens/"
+ target="_blank"
+ className="underline underline-offset-2"
+ rel="noopener noreferrer"
+ />,
+ ]}
+ />
+ </p>
+ );
+}
diff --git a/src/components/features/settings/git-settings/gitlab-token-input.tsx b/src/components/features/settings/git-settings/gitlab-token-input.tsx
new file mode 100644
index 0000000000..cd9ce6c256
--- /dev/null
+++ b/src/components/features/settings/git-settings/gitlab-token-input.tsx
@@ -0,0 +1,67 @@
+import { useTranslation } from "react-i18next";
+import { I18nKey } from "#/i18n/declaration";
+import { SettingsInput } from "../settings-input";
+import { GitLabTokenHelpAnchor } from "./gitlab-token-help-anchor";
+import { KeyStatusIcon } from "../key-status-icon";
+import { cn } from "#/utils/utils";
+
+interface GitLabTokenInputProps {
+ onChange: (value: string) => void;
+ onGitLabHostChange: (value: string) => void;
+ isGitLabTokenSet: boolean;
+ name: string;
+ gitlabHostSet: string | null | undefined;
+ className?: string;
+}
+
+export function GitLabTokenInput({
+ onChange,
+ onGitLabHostChange,
+ isGitLabTokenSet,
+ name,
+ gitlabHostSet,
+ className,
+}: GitLabTokenInputProps) {
+ const { t } = useTranslation("openhands");
+
+ return (
+ <div className={cn("flex flex-col gap-6", className)}>
+ <SettingsInput
+ testId={name}
+ name={name}
+ onChange={onChange}
+ label={t(I18nKey.GITLAB$TOKEN_LABEL)}
+ type="password"
+ className="w-full max-w-[680px]"
+ placeholder={isGitLabTokenSet ? "<hidden>" : ""}
+ startContent={
+ isGitLabTokenSet && (
+ <KeyStatusIcon
+ testId="gl-set-token-indicator"
+ isSet={isGitLabTokenSet}
+ />
+ )
+ }
+ />
+
+ <SettingsInput
+ onChange={onGitLabHostChange || (() => {})}
+ name="gitlab-host-input"
+ testId="gitlab-host-input"
+ label={t(I18nKey.GITLAB$HOST_LABEL)}
+ type="text"
+ className="w-full max-w-[680px]"
+ placeholder="gitlab.com"
+ defaultValue={gitlabHostSet || undefined}
+ startContent={
+ gitlabHostSet &&
+ gitlabHostSet.trim() !== "" && (
+ <KeyStatusIcon testId="gl-set-host-indicator" isSet />
+ )
+ }
+ />
+
+ <GitLabTokenHelpAnchor />
+ </div>
+ );
+}
diff --git a/src/components/features/settings/git-settings/install-slack-app-anchor.tsx b/src/components/features/settings/git-settings/install-slack-app-anchor.tsx
new file mode 100644
index 0000000000..2edc452b9b
--- /dev/null
+++ b/src/components/features/settings/git-settings/install-slack-app-anchor.tsx
@@ -0,0 +1,26 @@
+import { useTranslation } from "react-i18next";
+import { I18nKey } from "#/i18n/declaration";
+import { BrandButton } from "../brand-button";
+
+export function InstallSlackAppAnchor() {
+ const { t } = useTranslation("openhands");
+
+ return (
+ <div data-testid="install-slack-app-button" className="py-9">
+ <BrandButton
+ type="button"
+ variant="primary"
+ className="w-55"
+ onClick={() =>
+ window.open(
+ "https://slack.com/oauth/v2/authorize?client_id=7477886716822.8729519890534&scope=app_mentions:read,channels:history,chat:write,groups:history,im:history,mpim:history,users:read&user_scope=",
+ "_blank",
+ "noreferrer noopener",
+ )
+ }
+ >
+ {t(I18nKey.SLACK$INSTALL_APP)}
+ </BrandButton>
+ </div>
+ );
+}
diff --git a/src/components/features/settings/git-settings/webhook-status-badge.tsx b/src/components/features/settings/git-settings/webhook-status-badge.tsx
new file mode 100644
index 0000000000..159a0c6275
--- /dev/null
+++ b/src/components/features/settings/git-settings/webhook-status-badge.tsx
@@ -0,0 +1,46 @@
+import { useTranslation } from "react-i18next";
+import { I18nKey } from "#/i18n/declaration";
+import { Typography } from "#/ui/typography";
+
+export interface WebhookStatusBadgeProps {
+ webhookInstalled: boolean;
+ installationResult?: { success: boolean; error: string | null } | null;
+}
+
+export function WebhookStatusBadge({
+ webhookInstalled,
+ installationResult,
+}: WebhookStatusBadgeProps) {
+ const { t } = useTranslation("openhands");
+
+ if (installationResult) {
+ if (installationResult.success) {
+ return (
+ <Typography.Text className="px-2 py-1 text-xs rounded bg-green-500/20 text-green-400">
+ {t(I18nKey.GITLAB$WEBHOOK_STATUS_INSTALLED)}
+ </Typography.Text>
+ );
+ }
+ return (
+ <span title={installationResult.error || undefined}>
+ <Typography.Text className="px-2 py-1 text-xs rounded bg-red-500/20 text-red-400">
+ {t(I18nKey.GITLAB$WEBHOOK_STATUS_FAILED)}
+ </Typography.Text>
+ </span>
+ );
+ }
+
+ if (webhookInstalled) {
+ return (
+ <Typography.Text className="px-2 py-1 text-xs rounded bg-green-500/20 text-green-400">
+ {t(I18nKey.GITLAB$WEBHOOK_STATUS_INSTALLED)}
+ </Typography.Text>
+ );
+ }
+
+ return (
+ <Typography.Text className="px-2 py-1 text-xs rounded bg-gray-500/20 text-gray-400">
+ {t(I18nKey.GITLAB$WEBHOOK_STATUS_NOT_INSTALLED)}
+ </Typography.Text>
+ );
+}
diff --git a/src/components/features/sidebar/sidebar-conversation-list.tsx b/src/components/features/sidebar/sidebar-conversation-list.tsx
new file mode 100644
index 0000000000..560d3dab69
--- /dev/null
+++ b/src/components/features/sidebar/sidebar-conversation-list.tsx
@@ -0,0 +1,20 @@
+import { ConversationPanel } from "#/components/features/conversation-panel/conversation-panel";
+import { NewConversationButton } from "#/components/features/conversation-panel/new-conversation-button";
+
+/**
+ * Conversation list section rendered inside the sidebar nav. The list itself
+ * scrolls independently from the rest of the nav, while the "+ New" trigger
+ * stays pinned above it.
+ */
+export function SidebarConversationList() {
+ return (
+ <div className="hidden md:flex md:flex-col md:flex-1 md:min-h-0 gap-2 -mx-3">
+ <div className="px-3">
+ <NewConversationButton />
+ </div>
+ <div className="flex-1 min-h-0 overflow-hidden">
+ <ConversationPanel />
+ </div>
+ </div>
+ );
+}
diff --git a/src/components/features/sidebar/sidebar-nav-link.tsx b/src/components/features/sidebar/sidebar-nav-link.tsx
new file mode 100644
index 0000000000..71827aa776
--- /dev/null
+++ b/src/components/features/sidebar/sidebar-nav-link.tsx
@@ -0,0 +1,51 @@
+import React from "react";
+import { NavigationLink } from "#/components/shared/navigation-link";
+import { cn } from "#/utils/utils";
+
+interface SidebarNavLinkProps {
+ to: string;
+ label: string;
+ end?: boolean;
+ indent?: boolean;
+ testId?: string;
+ disabled?: boolean;
+ icon?: React.ReactElement;
+}
+
+export function SidebarNavLink({
+ to,
+ label,
+ end = false,
+ indent = false,
+ testId,
+ disabled = false,
+ icon,
+}: SidebarNavLinkProps) {
+ return (
+ <NavigationLink
+ to={to}
+ end={end}
+ data-testid={testId}
+ tabIndex={disabled ? -1 : 0}
+ onClick={(e) => {
+ if (disabled) {
+ e.preventDefault();
+ }
+ }}
+ className={({ isActive }) =>
+ cn(
+ "flex items-center gap-2 w-full rounded-md transition-colors",
+ "text-sm leading-5 truncate",
+ indent ? "pl-7 pr-3 py-1.5" : "px-3 py-2",
+ isActive
+ ? "bg-[#1f1f1f99] text-white font-medium"
+ : "text-[#B1B9D3] hover:text-white hover:bg-[#1f1f1f99]",
+ disabled && "pointer-events-none opacity-50",
+ )
+ }
+ >
+ {icon ? <span className="shrink-0">{icon}</span> : null}
+ <span className="truncate">{label}</span>
+ </NavigationLink>
+ );
+}
diff --git a/src/components/features/sidebar/sidebar.tsx b/src/components/features/sidebar/sidebar.tsx
index ca51e9a5e5..43933d4d4d 100644
--- a/src/components/features/sidebar/sidebar.tsx
+++ b/src/components/features/sidebar/sidebar.tsx
@@ -1,25 +1,26 @@
import React from "react";
import { useTranslation } from "react-i18next";
-import { useGitUser } from "#/hooks/query/use-git-user";
-import { UserActions } from "./user-actions";
import { OpenHandsLogoButton } from "#/components/shared/buttons/openhands-logo-button";
-import { NewProjectButton } from "#/components/shared/buttons/new-project-button";
-import { ConversationPanelButton } from "#/components/shared/buttons/conversation-panel-button";
-import { AutomationsButton } from "#/components/shared/buttons/automations-button";
+import { SidebarNavLink } from "./sidebar-nav-link";
import { SettingsModal } from "#/components/shared/modals/settings/settings-modal";
import { getErrorStatus, useSettings } from "#/hooks/query/use-settings";
-import { ConversationPanel } from "../conversation-panel/conversation-panel";
-import { ConversationPanelWrapper } from "../conversation-panel/conversation-panel-wrapper";
import { useConfig } from "#/hooks/query/use-config";
import { displayErrorToast } from "#/utils/custom-toast-handlers";
import { I18nKey } from "#/i18n/declaration";
import { useNavigation } from "#/context/navigation-context";
import { cn } from "#/utils/utils";
+import { useSettingsNavItems } from "#/hooks/use-settings-nav-items";
+import { BackendSelector } from "#/components/features/backends/backend-selector";
+import { OSS_NAV_ITEMS } from "#/constants/settings-nav";
+import { SidebarConversationList } from "./sidebar-conversation-list";
+
+const SETTINGS_NAV_ICON_BY_PATH = new Map(
+ OSS_NAV_ITEMS.map((item) => [item.to, item.icon] as const),
+);
export function Sidebar() {
const { t } = useTranslation("openhands");
const { currentPath } = useNavigation();
- const user = useGitUser();
const { data: config } = useConfig();
const {
data: settings,
@@ -27,13 +28,22 @@ export function Sidebar() {
isError: settingsIsError,
isFetching: isFetchingSettings,
} = useSettings();
+ const settingsNavItems = useSettingsNavItems();
const [settingsModalIsOpen, setSettingsModalIsOpen] = React.useState(false);
-
- const [conversationPanelIsOpen, setConversationPanelIsOpen] =
- React.useState(false);
const settingsErrorStatus = getErrorStatus(settingsError);
+ const isSettingsActive = currentPath.startsWith("/settings");
+ const [settingsExpanded, setSettingsExpanded] =
+ React.useState<boolean>(isSettingsActive);
+
+ // Auto-expand the settings submenu whenever we navigate into /settings.
+ React.useEffect(() => {
+ if (isSettingsActive) {
+ setSettingsExpanded(true);
+ }
+ }, [isSettingsActive]);
+
React.useEffect(() => {
if (currentPath === "/settings") {
setSettingsModalIsOpen(false);
@@ -61,53 +71,132 @@ export function Sidebar() {
config?.feature_flags?.hide_llm_settings,
]);
+ const linkDisabled = settings?.email_verified === false;
+
return (
<>
<aside
aria-label={t(I18nKey.SIDEBAR$NAVIGATION_LABEL)}
className={cn(
- "h-[54px] p-3 md:p-0 md:h-[40px] md:h-auto flex flex-row md:flex-col gap-1 bg-base md:w-[75px] md:min-w-[75px] sm:pt-0 sm:px-2 md:pt-[14px] md:px-0",
+ "bg-base flex flex-col gap-3",
+ // Mobile: top bar; Desktop: vertical column
+ "h-[54px] md:h-full md:w-[300px] md:min-w-[300px]",
+ "px-3 py-2 md:px-3 md:pt-4",
+ "flex-row md:flex-col",
(currentPath === "/" || currentPath.startsWith("/automations")) &&
"md:pt-6.5 md:pb-3",
)}
>
- <nav className="flex flex-row md:flex-col items-center justify-between w-full h-auto md:w-auto md:h-full">
- <div className="flex flex-row md:flex-col items-center gap-[26px]">
- <div className="flex items-center justify-center">
- <OpenHandsLogoButton />
- </div>
- <div className="flex items-center justify-center">
- <NewProjectButton disabled={settings?.email_verified === false} />
- </div>
- <ConversationPanelButton
- isOpen={conversationPanelIsOpen}
- onClick={() =>
- settings?.email_verified === false
- ? null
- : setConversationPanelIsOpen((prev) => !prev)
- }
- disabled={settings?.email_verified === false}
- />
- <AutomationsButton disabled={settings?.email_verified === false} />
- </div>
+ <div className="flex items-center md:px-2 md:py-1">
+ <OpenHandsLogoButton />
+ </div>
+
+ <div className="hidden md:flex md:flex-col md:items-stretch">
+ <BackendSelector />
+ </div>
- <div className="flex flex-row md:flex-col md:items-center gap-[26px]">
- <UserActions
- user={
- user.data ? { avatar_url: user.data.avatar_url } : undefined
- }
- isLoading={user.isFetching}
+ <nav className="flex flex-row md:flex-col gap-1 md:gap-0.5 items-center md:items-stretch w-full md:shrink-0">
+ <SidebarNavLink
+ to="/conversations"
+ label={t(I18nKey.SIDEBAR$CONVERSATIONS)}
+ testId="sidebar-conversations-link"
+ disabled={linkDisabled}
+ />
+ <SidebarNavLink
+ to="/automations"
+ label={t(I18nKey.SIDEBAR$AUTOMATIONS)}
+ testId="sidebar-automations-link"
+ disabled={linkDisabled}
+ />
+ <SidebarNavLink
+ to="/skills"
+ label={t(I18nKey.SIDEBAR$SKILLS)}
+ testId="sidebar-skills-link"
+ disabled={linkDisabled}
+ />
+ <SidebarNavLink
+ to="/integrations"
+ label={t(I18nKey.SIDEBAR$INTEGRATIONS)}
+ testId="sidebar-integrations-link"
+ disabled={linkDisabled}
+ />
+ <div className="hidden md:flex flex-col gap-0.5">
+ <button
+ type="button"
+ data-testid="sidebar-settings-toggle"
+ aria-expanded={settingsExpanded}
+ onClick={() => setSettingsExpanded((prev) => !prev)}
+ className={cn(
+ "flex items-center justify-between w-full text-sm leading-5 px-3 py-2 rounded-md transition-colors cursor-pointer",
+ isSettingsActive
+ ? "bg-[#1f1f1f99] text-white font-medium"
+ : "text-[#B1B9D3] hover:text-white hover:bg-[#1f1f1f99]",
+ )}
+ >
+ <span>{t(I18nKey.SIDEBAR$SETTINGS)}</span>
+ <svg
+ width="14"
+ height="14"
+ viewBox="0 0 24 24"
+ fill="none"
+ stroke="currentColor"
+ strokeWidth="2"
+ strokeLinecap="round"
+ strokeLinejoin="round"
+ aria-hidden="true"
+ className={cn(
+ "transition-transform duration-150",
+ settingsExpanded ? "rotate-180" : "rotate-0",
+ )}
+ >
+ <polyline points="6 9 12 15 18 9" />
+ </svg>
+ </button>
+ {settingsExpanded && (
+ <div className="flex flex-col gap-0.5 pt-0.5">
+ {settingsNavItems.map((rendered) => {
+ if (rendered.type !== "item") return null;
+ const navIcon = SETTINGS_NAV_ICON_BY_PATH.get(
+ rendered.item.to,
+ );
+ return (
+ <SidebarNavLink
+ key={rendered.item.to}
+ to={rendered.item.to}
+ label={t(rendered.item.text as I18nKey)}
+ end
+ indent
+ testId={`sidebar-settings-${rendered.item.to}`}
+ disabled={linkDisabled}
+ icon={
+ navIcon
+ ? React.cloneElement(
+ navIcon as React.ReactElement<{
+ width?: number;
+ height?: number;
+ }>,
+ { width: 16, height: 16 },
+ )
+ : undefined
+ }
+ />
+ );
+ })}
+ </div>
+ )}
+ </div>
+ {/* Mobile: settings as a flat link, no submenu */}
+ <div className="md:hidden">
+ <SidebarNavLink
+ to="/settings"
+ label={t(I18nKey.SIDEBAR$SETTINGS)}
+ testId="sidebar-settings-link-mobile"
+ disabled={linkDisabled}
/>
</div>
</nav>
- {conversationPanelIsOpen && (
- <ConversationPanelWrapper isOpen={conversationPanelIsOpen}>
- <ConversationPanel
- onClose={() => setConversationPanelIsOpen(false)}
- />
- </ConversationPanelWrapper>
- )}
+ <SidebarConversationList />
</aside>
{settingsModalIsOpen && (
diff --git a/src/components/features/sidebar/user-actions.tsx b/src/components/features/sidebar/user-actions.tsx
deleted file mode 100644
index 0796581fc7..0000000000
--- a/src/components/features/sidebar/user-actions.tsx
+++ /dev/null
@@ -1,96 +0,0 @@
-import React from "react";
-import { UserAvatar } from "./user-avatar";
-import { UserContextMenu } from "../user/user-context-menu";
-import { AddBackendModal } from "../backends/add-backend-modal";
-import { cn } from "#/utils/utils";
-
-interface UserActionsProps {
- user?: { avatar_url: string };
- isLoading?: boolean;
-}
-
-export function UserActions({ user, isLoading }: UserActionsProps) {
- const [accountContextMenuIsVisible, setAccountContextMenuIsVisible] =
- React.useState(false);
- const [menuResetCount, setMenuResetCount] = React.useState(0);
- const [addBackendModalOpen, setAddBackendModalOpen] = React.useState(false);
- const hideTimeoutRef = React.useRef<number | null>(null);
-
- React.useEffect(
- () => () => {
- if (hideTimeoutRef.current) {
- clearTimeout(hideTimeoutRef.current);
- }
- },
- [],
- );
-
- const showAccountMenu = () => {
- if (hideTimeoutRef.current) {
- clearTimeout(hideTimeoutRef.current);
- hideTimeoutRef.current = null;
- }
- setAccountContextMenuIsVisible(true);
- };
-
- const hideAccountMenu = () => {
- // Don't auto-hide while the Add Backend modal is open — the user is
- // interacting with content outside the menu's hover area.
- if (addBackendModalOpen) return;
- hideTimeoutRef.current = window.setTimeout(() => {
- setAccountContextMenuIsVisible(false);
- setMenuResetCount((c) => c + 1);
- }, 500);
- };
-
- const closeAccountMenu = () => {
- if (hideTimeoutRef.current) {
- clearTimeout(hideTimeoutRef.current);
- hideTimeoutRef.current = null;
- }
- if (accountContextMenuIsVisible) {
- setAccountContextMenuIsVisible(false);
- setMenuResetCount((c) => c + 1);
- }
- };
-
- const openAddBackendModal = () => {
- closeAccountMenu();
- setAddBackendModalOpen(true);
- };
-
- return (
- <div
- data-testid="user-actions"
- className="relative cursor-pointer group"
- onMouseEnter={showAccountMenu}
- onMouseLeave={hideAccountMenu}
- >
- <UserAvatar avatarUrl={user?.avatar_url} isLoading={isLoading} />
-
- <div
- data-testid="user-context-menu-wrapper"
- className={cn(
- "opacity-0 pointer-events-none",
- // Suppress hover-visible behavior whenever the Add Backend modal
- // is open so the menu doesn't bleed through behind the dialog.
- !addBackendModalOpen &&
- "group-hover:opacity-100 group-hover:pointer-events-auto",
- accountContextMenuIsVisible &&
- !addBackendModalOpen &&
- "opacity-100 pointer-events-auto",
- )}
- >
- <UserContextMenu
- key={menuResetCount}
- onClose={closeAccountMenu}
- onOpenAddBackend={openAddBackendModal}
- />
- </div>
-
- {addBackendModalOpen ? (
- <AddBackendModal onClose={() => setAddBackendModalOpen(false)} />
- ) : null}
- </div>
- );
-}
diff --git a/src/components/features/user/user-context-menu.tsx b/src/components/features/user/user-context-menu.tsx
deleted file mode 100644
index c866421ade..0000000000
--- a/src/components/features/user/user-context-menu.tsx
+++ /dev/null
@@ -1,89 +0,0 @@
-import React from "react";
-import { useTranslation } from "react-i18next";
-import { cn } from "#/utils/utils";
-import { useSettingsNavItems } from "#/hooks/use-settings-nav-items";
-import DocumentIcon from "#/icons/document.svg?react";
-import { BackendSelector } from "#/components/features/backends/backend-selector";
-import { AddBackendMenuItem } from "#/components/features/backends/add-backend-menu-item";
-import { ContextMenuContainer } from "../context-menu/context-menu-container";
-import { ContextMenuNavLink } from "../context-menu/context-menu-nav-link";
-import { SettingsNavHeader } from "../settings/settings-nav-header";
-import { SettingsNavDivider } from "../settings/settings-nav-divider";
-import { I18nKey } from "#/i18n/declaration";
-
-const contextMenuListItemClassName = cn(
- "flex items-center gap-2 p-2 h-auto hover:bg-white/10 hover:text-white rounded text-xs",
-);
-
-interface UserContextMenuProps {
- onClose: () => void;
- onOpenAddBackend: () => void;
-}
-
-export function UserContextMenu({
- onClose,
- onOpenAddBackend,
-}: UserContextMenuProps) {
- const { t } = useTranslation("openhands");
- const settingsNavItems = useSettingsNavItems();
-
- return (
- <ContextMenuContainer testId="user-context-menu" onClose={onClose}>
- <div className="flex flex-col gap-3 w-[248px]">
- <h3 className="text-lg font-semibold text-white">
- {t(I18nKey.USER$ACCOUNT_SETTINGS)}
- </h3>
-
- <BackendSelector />
-
- <div className="flex flex-col items-start gap-0 w-full">
- <AddBackendMenuItem onOpen={onOpenAddBackend} />
-
- <SettingsNavDivider className="my-1.5" />
-
- {settingsNavItems.map((renderedItem, index) => {
- if (renderedItem.type === "header") {
- return (
- <SettingsNavHeader
- key={`header-${renderedItem.text}`}
- text={renderedItem.text}
- className="px-2 pt-2 pb-1"
- />
- );
- }
-
- if (renderedItem.type === "divider") {
- return (
- <SettingsNavDivider
- key={`divider-${index}`}
- className="my-1.5"
- />
- );
- }
-
- return (
- <ContextMenuNavLink
- key={renderedItem.item.to}
- item={renderedItem.item}
- onClick={onClose}
- />
- );
- })}
-
- <SettingsNavDivider className="my-1.5" />
-
- <a
- href="https://docs.openhands.dev"
- target="_blank"
- rel="noopener noreferrer"
- onClick={onClose}
- className={contextMenuListItemClassName}
- >
- <DocumentIcon className="text-white" width={16} height={16} />
- {t(I18nKey.SIDEBAR$DOCS)}
- </a>
- </div>
- </div>
- </ContextMenuContainer>
- );
-}
diff --git a/src/components/shared/buttons/new-project-button.tsx b/src/components/shared/buttons/new-project-button.tsx
index 7acbe24e10..4fba72cdb1 100644
--- a/src/components/shared/buttons/new-project-button.tsx
+++ b/src/components/shared/buttons/new-project-button.tsx
@@ -17,7 +17,7 @@ export function NewProjectButton({ disabled = false }: NewProjectButtonProps) {
return (
<StyledTooltip content={startNewProject} placement="right">
<NavigationLink
- to="/"
+ to="/conversations"
data-testid="new-project-button"
aria-label={startNewProject}
tabIndex={disabled ? -1 : 0}
diff --git a/src/components/shared/buttons/openhands-logo-button.tsx b/src/components/shared/buttons/openhands-logo-button.tsx
index e6c52900e0..ccfc69b1c7 100644
--- a/src/components/shared/buttons/openhands-logo-button.tsx
+++ b/src/components/shared/buttons/openhands-logo-button.tsx
@@ -12,7 +12,7 @@ export function OpenHandsLogoButton() {
return (
<StyledTooltip content={tooltipText}>
- <NavigationLink to="/" aria-label={ariaLabel}>
+ <NavigationLink to="/conversations" aria-label={ariaLabel}>
<OpenHandsLogo width={46} height={30} />
</NavigationLink>
</StyledTooltip>
diff --git a/src/components/sidebar/index.ts b/src/components/sidebar/index.ts
index 3878fa7a17..2c236ef117 100644
--- a/src/components/sidebar/index.ts
+++ b/src/components/sidebar/index.ts
@@ -1,6 +1,5 @@
export { Sidebar } from "../features/sidebar/sidebar";
export { Avatar } from "../features/sidebar/avatar";
-export { UserActions } from "../features/sidebar/user-actions";
export { UserAvatar } from "../features/sidebar/user-avatar";
export { ConversationPanel } from "../features/conversation-panel/conversation-panel";
export { ConversationPanelWrapper } from "../features/conversation-panel/conversation-panel-wrapper";
diff --git a/src/constants/settings-nav.tsx b/src/constants/settings-nav.tsx
index 2a8d749b8e..5473228a62 100644
--- a/src/constants/settings-nav.tsx
+++ b/src/constants/settings-nav.tsx
@@ -1,5 +1,4 @@
import KeyIcon from "#/icons/key.svg?react";
-import LightbulbIcon from "#/icons/lightbulb.svg?react";
import LockIcon from "#/icons/lock.svg?react";
import MemoryIcon from "#/icons/memory_icon.svg?react";
import ServerProcessIcon from "#/icons/server-process.svg?react";
@@ -33,11 +32,6 @@ export const OSS_NAV_ITEMS: SettingsNavItem[] = [
to: "/settings/mcp",
text: "SETTINGS$NAV_MCP",
},
- {
- icon: <LightbulbIcon width={22} height={22} />,
- to: "/settings/skills",
- text: "SETTINGS$NAV_SKILLS",
- },
{
icon: <SettingsGearIcon width={22} height={22} />,
to: "/settings/app",
diff --git a/src/hooks/mutation/use-add-git-providers.ts b/src/hooks/mutation/use-add-git-providers.ts
new file mode 100644
index 0000000000..d4ce49d348
--- /dev/null
+++ b/src/hooks/mutation/use-add-git-providers.ts
@@ -0,0 +1,36 @@
+import { useMutation, useQueryClient } from "@tanstack/react-query";
+import { SecretsService } from "#/api/secrets-service";
+import { Provider, ProviderToken } from "#/types/settings";
+import { useTracking } from "#/hooks/use-tracking";
+import { SETTINGS_QUERY_KEYS } from "#/hooks/query/query-keys";
+
+export const useAddGitProviders = () => {
+ const queryClient = useQueryClient();
+ const { trackGitProviderConnected } = useTracking();
+
+ return useMutation({
+ mutationFn: ({
+ providers,
+ }: {
+ providers: Partial<Record<Provider, ProviderToken>>;
+ }) => SecretsService.addGitProvider(providers),
+ onSuccess: async (_, { providers }) => {
+ const connectedProviders = Object.entries(providers)
+ .filter(([, value]) => value?.token && value.token.trim() !== "")
+ .map(([key]) => key);
+
+ if (connectedProviders.length > 0) {
+ trackGitProviderConnected({
+ providers: connectedProviders,
+ });
+ }
+
+ await queryClient.invalidateQueries({
+ queryKey: SETTINGS_QUERY_KEYS.personal(),
+ });
+ },
+ meta: {
+ disableToast: true,
+ },
+ });
+};
diff --git a/src/hooks/mutation/use-create-conversation.ts b/src/hooks/mutation/use-create-conversation.ts
index 27c80344d2..67feec4584 100644
--- a/src/hooks/mutation/use-create-conversation.ts
+++ b/src/hooks/mutation/use-create-conversation.ts
@@ -84,7 +84,11 @@ export const useCreateConversation = () => {
hasRepository: !!repository,
});
- queryClient.removeQueries({
+ // Invalidate (rather than remove) so the existing paginated list stays
+ // rendered while a background refetch picks up the new conversation.
+ // `removeQueries` would wipe the cache and force the panel back to its
+ // initial loading state, dropping loaded pages and scroll position.
+ queryClient.invalidateQueries({
queryKey: ["user", "conversations"],
});
},
diff --git a/src/hooks/mutation/use-delete-git-providers.ts b/src/hooks/mutation/use-delete-git-providers.ts
new file mode 100644
index 0000000000..b646dd9ab2
--- /dev/null
+++ b/src/hooks/mutation/use-delete-git-providers.ts
@@ -0,0 +1,19 @@
+import { useMutation, useQueryClient } from "@tanstack/react-query";
+import { SecretsService } from "#/api/secrets-service";
+import { SETTINGS_QUERY_KEYS } from "#/hooks/query/query-keys";
+
+export const useDeleteGitProviders = () => {
+ const queryClient = useQueryClient();
+
+ return useMutation({
+ mutationFn: () => SecretsService.deleteGitProviders(),
+ onSuccess: async () => {
+ await queryClient.invalidateQueries({
+ queryKey: SETTINGS_QUERY_KEYS.personal(),
+ });
+ },
+ meta: {
+ disableToast: true,
+ },
+ });
+};
diff --git a/src/hooks/mutation/use-unified-stop-conversation.ts b/src/hooks/mutation/use-unified-stop-conversation.ts
index e044e57589..7486191c32 100644
--- a/src/hooks/mutation/use-unified-stop-conversation.ts
+++ b/src/hooks/mutation/use-unified-stop-conversation.ts
@@ -59,7 +59,7 @@ export const useUnifiedPauseConversation = () => {
);
if (currentConversationId === variables.conversationId) {
- navigate("/");
+ navigate("/conversations");
}
},
});
diff --git a/src/hooks/query/use-paginated-conversations.ts b/src/hooks/query/use-paginated-conversations.ts
index 0a8f81cd62..6576657bdc 100644
--- a/src/hooks/query/use-paginated-conversations.ts
+++ b/src/hooks/query/use-paginated-conversations.ts
@@ -32,5 +32,10 @@ export const usePaginatedConversations = (limit: number = 20) => {
enabled: !!userIsAuthenticated,
getNextPageParam: (lastPage: AppConversationPage) => lastPage.next_page_id,
initialPageParam: undefined as string | undefined,
+ // Poll every 10s so titles, execution status, and timestamps stay fresh
+ // without requiring the user to refresh. React Query refetches in the
+ // background without flipping `isFetching` to a hard loading state, so
+ // the list updates silently.
+ refetchInterval: 10_000,
});
};
diff --git a/src/hooks/use-conversation-name-context-menu.ts b/src/hooks/use-conversation-name-context-menu.ts
index 94f14715e9..f162531832 100644
--- a/src/hooks/use-conversation-name-context-menu.ts
+++ b/src/hooks/use-conversation-name-context-menu.ts
@@ -76,7 +76,7 @@ export function useConversationNameContextMenu({
{
onSuccess: () => {
if (conversationId === currentConversationId) {
- navigate("/");
+ navigate("/conversations");
}
},
},
diff --git a/src/i18n/translation.json b/src/i18n/translation.json
index 933e0621e6..106067ff4e 100644
--- a/src/i18n/translation.json
+++ b/src/i18n/translation.json
@@ -12035,6 +12035,15 @@
"uk": "Розмови",
"ca": "Converses"
},
+ "SIDEBAR$SKILLS": {
+ "en": "Skills"
+ },
+ "SIDEBAR$INTEGRATIONS": {
+ "en": "Integrations"
+ },
+ "SIDEBAR$NEW_CONVERSATION": {
+ "en": "New Conversation"
+ },
"STATUS$CONNECTING_TO_RUNTIME": {
"en": "Connecting to runtime...",
"zh-CN": "正在连接到运行时...",
@@ -13735,6 +13744,27 @@
"uk": "Розмов не знайдено",
"ca": "No s'han trobat converses"
},
+ "CONVERSATION$N_OLDER_CONVERSATIONS": {
+ "en": "older conversations"
+ },
+ "CONVERSATION$SHOW_ALL": {
+ "en": "show all"
+ },
+ "CONVERSATION$HIDE": {
+ "en": "hide"
+ },
+ "CONVERSATION$DELETE_ALL": {
+ "en": "delete all"
+ },
+ "CONVERSATION$CONFIRM_DELETE_OLDER_TITLE": {
+ "en": "Delete older conversations"
+ },
+ "CONVERSATION$CONFIRM_DELETE_OLDER_DESC": {
+ "en": "Are you sure you want to delete {{count}} older conversations? This action cannot be undone."
+ },
+ "CONVERSATION$LOAD_MORE": {
+ "en": "Load more"
+ },
"LANDING$SELECT_GIT_REPO": {
"en": "Select a Git project",
"ja": "Gitプロジェクトを選択",
@@ -16506,6 +16536,23 @@
"uk": "Робочих областей ще немає",
"ca": "Encara no hi ha espais de treball"
},
+ "HOME$NO_WORKSPACE_OPTION": {
+ "en": "No workspace",
+ "ja": "ワークスペースなし",
+ "zh-CN": "无工作区",
+ "zh-TW": "無工作區",
+ "ko-KR": "작업 공간 없음",
+ "no": "Ingen arbeidsområde",
+ "it": "Nessuna area di lavoro",
+ "pt": "Sem espaço de trabalho",
+ "es": "Sin espacio de trabajo",
+ "ar": "بدون مساحة عمل",
+ "fr": "Aucun espace de travail",
+ "tr": "Çalışma alanı yok",
+ "de": "Kein Arbeitsbereich",
+ "uk": "Без робочої області",
+ "ca": "Sense espai de treball"
+ },
"HOME$WORKSPACE_PLACEHOLDER": {
"en": "Select a workspace",
"ja": "ワークスペースを選択",
@@ -19396,6 +19443,15 @@
"uk": "Працює",
"ca": "En execució"
},
+ "COMMON$WORKING": {
+ "en": "Working"
+ },
+ "COMMON$PAUSED": {
+ "en": "Paused"
+ },
+ "COMMON$FINISHED": {
+ "en": "Finished"
+ },
"COMMON$WAITING_FOR_SANDBOX": {
"en": "Waiting for sandbox",
"ja": "サンドボックスを待機中",
@@ -22456,6 +22512,58 @@
"uk": "Додати бекенд",
"ca": "Afegir backend"
},
+ "BACKEND$MANAGE": {
+ "en": "Manage Backends",
+ "ja": "バックエンドを管理",
+ "zh-CN": "管理后端",
+ "zh-TW": "管理後端",
+ "ko-KR": "백엔드 관리",
+ "no": "Administrer backender",
+ "it": "Gestisci backend",
+ "pt": "Gerenciar backends",
+ "es": "Gestionar backends",
+ "ar": "إدارة الخوادم الخلفية",
+ "fr": "Gérer les backends",
+ "tr": "Backend'leri yönet",
+ "de": "Backends verwalten",
+ "uk": "Керувати бекендами",
+ "ca": "Gestiona els backends"
+ },
+ "BACKEND$MANAGE_TITLE": {
+ "en": "Manage backends",
+ "ja": "バックエンドを管理",
+ "zh-CN": "管理后端",
+ "zh-TW": "管理後端",
+ "ko-KR": "백엔드 관리",
+ "no": "Administrer backender",
+ "it": "Gestisci backend",
+ "pt": "Gerenciar backends",
+ "es": "Gestionar backends",
+ "ar": "إدارة الخوادم الخلفية",
+ "fr": "Gérer les backends",
+ "tr": "Backend'leri yönet",
+ "de": "Backends verwalten",
+ "uk": "Керувати бекендами",
+ "ca": "Gestiona els backends"
+ },
+ "BACKEND$MANAGE_EMPTY": {
+ "en": "No extra backends added yet.",
+ "ja": "追加されたバックエンドはまだありません。",
+ "zh-CN": "尚未添加额外后端。",
+ "zh-TW": "尚未新增其他後端。",
+ "ko-KR": "아직 추가된 백엔드가 없습니다.",
+ "no": "Ingen ekstra backender er lagt til ennå.",
+ "it": "Nessun backend aggiuntivo ancora presente.",
+ "pt": "Nenhum backend adicional foi adicionado ainda.",
+ "es": "Aún no se han añadido backends adicionales.",
+ "ar": "لم تتم إضافة أي خوادم خلفية إضافية بعد.",
+ "fr": "Aucun backend supplémentaire n'a encore été ajouté.",
+ "tr": "Henüz ek bir backend eklenmedi.",
+ "de": "Es wurden noch keine zusätzlichen Backends hinzugefügt.",
+ "uk": "Додаткові бекенди ще не додано.",
+ "ca": "Encara no s'han afegit backends addicionals."
+ },
+
"BACKEND$ADD_TITLE": {
"en": "Add a backend",
"ja": "バックエンドを追加",
@@ -22677,6 +22785,23 @@
"uk": "Видалити",
"ca": "Eliminar"
},
+ "BACKEND$REMOVE_CONFIRMATION": {
+ "en": "Remove backend \"{{name}}\"? If it is active, the app will switch back to Local.",
+ "ja": "バックエンド \"{{name}}\" を削除しますか? アクティブな場合、アプリはローカルに戻ります。",
+ "zh-CN": "要移除后端“{{name}}”吗?如果它当前处于活动状态,应用将切换回本地。",
+ "zh-TW": "要移除後端「{{name}}」嗎?如果它目前為使用中,應用程式將切換回本機。",
+ "ko-KR": "백엔드 \"{{name}}\" 를 제거하시겠습니까? 현재 활성 상태라면 앱은 로컬로 전환됩니다.",
+ "no": "Fjern backend \"{{name}}\"? Hvis den er aktiv, bytter appen tilbake til Lokal.",
+ "it": "Rimuovere il backend \"{{name}}\"? Se è attivo, l'app tornerà a Locale.",
+ "pt": "Remover o backend \"{{name}}\"? Se ele estiver ativo, o aplicativo voltará para Local.",
+ "es": "¿Eliminar el backend \"{{name}}\"? Si está activo, la aplicación volverá a Local.",
+ "ar": "هل تريد إزالة الخادم الخلفي \"{{name}}\"؟ إذا كان نشطًا، فسيعود التطبيق إلى المحلي.",
+ "fr": "Supprimer le backend \"{{name}}\" ? S'il est actif, l'application reviendra sur Local.",
+ "tr": "\"{{name}}\" backend'i kaldırılsın mı? Etkinse uygulama yeniden Yerel'e döner.",
+ "de": "Backend \"{{name}}\" entfernen? Falls er aktiv ist, wechselt die App zurück zu Lokal.",
+ "uk": "Видалити бекенд \"{{name}}\"? Якщо він активний, застосунок повернеться до локального режиму.",
+ "ca": "Vols eliminar el backend \"{{name}}\"? Si és l'actiu, l'aplicació tornarà a Local."
+ },
"BACKEND$EDIT": {
"en": "Edit",
"ja": "編集",
diff --git a/src/routes.ts b/src/routes.ts
index 4befc539e5..e8bde742cd 100644
--- a/src/routes.ts
+++ b/src/routes.ts
@@ -7,18 +7,20 @@ import {
export default [
layout("routes/root-layout.tsx", [
- index("routes/home.tsx"),
+ index("routes/index-redirect.tsx"),
+ route("conversations", "routes/home.tsx"),
+ route("conversations/:conversationId", "routes/conversation.tsx"),
route("launch", "routes/launch.tsx"),
+ route("skills", "routes/skills-settings.tsx"),
+ route("integrations", "routes/git-settings.tsx"),
route("settings", "routes/settings.tsx", [
index("routes/llm-settings.tsx"),
route("condenser", "routes/condenser-settings.tsx"),
route("verification", "routes/verification-settings.tsx"),
route("mcp", "routes/mcp-settings.tsx"),
- route("skills", "routes/skills-settings.tsx"),
route("app", "routes/app-settings.tsx"),
route("secrets", "routes/secrets-settings.tsx"),
]),
- route("conversations/:conversationId", "routes/conversation.tsx"),
route("oauth/device/verify", "routes/device-verify.tsx"),
route("automations", "routes/automations-list.tsx"),
route("automations/:automationId", "routes/automation-detail.tsx"),
diff --git a/src/routes/conversation.tsx b/src/routes/conversation.tsx
index 09fe0a14a8..46a982c08c 100644
--- a/src/routes/conversation.tsx
+++ b/src/routes/conversation.tsx
@@ -16,11 +16,8 @@ import { useTaskPolling } from "#/hooks/query/use-task-polling";
import { displayErrorToast } from "#/utils/custom-toast-handlers";
import { useIsAuthed } from "#/hooks/query/use-is-authed";
-
import { ConversationMain } from "#/components/features/conversation/conversation-main/conversation-main";
-import { ConversationNameWithStatus } from "#/components/features/conversation/conversation-name-with-status";
-import { ConversationTabs } from "#/components/features/conversation/conversation-tabs/conversation-tabs";
import { WebSocketProviderWrapper } from "#/contexts/websocket-provider-wrapper";
import { useErrorMessageStore } from "#/stores/error-message-store";
import { I18nKey } from "#/i18n/declaration";
@@ -31,7 +28,6 @@ function AppContent() {
const { conversationId } = useConversationId();
const clearEvents = useEventStore((state) => state.clearEvents);
- // Handle both task IDs (task-{uuid}) and regular conversation IDs
const { isTask, taskStatus, taskDetail } = useTaskPolling();
const { data: conversation, isFetched } = useActiveConversation();
@@ -49,7 +45,6 @@ function AppContent() {
(state) => state.removeErrorMessage,
);
- // 1. Cleanup Effect - runs when navigating to a different conversation
React.useEffect(() => {
clearTerminal();
resetConversationState();
@@ -67,7 +62,6 @@ function AppContent() {
clearEvents,
]);
- // 2. Task Error Display Effect
React.useEffect(() => {
if (isTask && taskStatus === "ERROR") {
displayErrorToast(
@@ -77,34 +71,22 @@ function AppContent() {
}, [isTask, taskStatus, taskDetail, t]);
React.useEffect(() => {
- // Wait for data to be fetched
if (!isFetched || !isAuthed) return;
- // Handle conversation not found
if (!conversation) {
displayErrorToast(t(I18nKey.CONVERSATION$NOT_EXIST_OR_NO_PERMISSION));
- navigate("/");
+ navigate("/conversations");
}
}, [conversation, isFetched, isAuthed, navigate, t]);
const content = (
<EventHandler>
- <div
- data-testid="app-route"
- className="p-3 md:p-0 flex flex-col h-full gap-3"
- >
- <div className="flex flex-col lg:flex-row lg:items-center justify-between gap-4.5 pt-2 lg:pt-0">
- <ConversationNameWithStatus />
- <ConversationTabs />
- </div>
-
+ <div data-testid="app-route" className="flex flex-col h-full">
<ConversationMain />
</div>
</EventHandler>
);
- // Render WebSocket provider immediately to avoid mount/remount cycles
- // The providers internally handle waiting for conversation data to be ready
return (
<WebSocketProviderWrapper conversationId={conversationId}>
{content}
diff --git a/src/routes/git-settings.tsx b/src/routes/git-settings.tsx
new file mode 100644
index 0000000000..39b8f4fecc
--- /dev/null
+++ b/src/routes/git-settings.tsx
@@ -0,0 +1,307 @@
+import React from "react";
+import { redirect } from "react-router";
+import { useTranslation } from "react-i18next";
+import { useSettings } from "#/hooks/query/use-settings";
+import { getActiveBackend } from "#/api/backend-registry/active-store";
+import { BrandButton } from "#/components/features/settings/brand-button";
+import { GitHubTokenInput } from "#/components/features/settings/git-settings/github-token-input";
+import { GitLabTokenInput } from "#/components/features/settings/git-settings/gitlab-token-input";
+import { BitbucketTokenInput } from "#/components/features/settings/git-settings/bitbucket-token-input";
+import { BitbucketDCTokenInput } from "#/components/features/settings/git-settings/bitbucket-dc-token-help-input";
+import { AzureDevOpsTokenInput } from "#/components/features/settings/git-settings/azure-devops-token-input";
+import { ForgejoTokenInput } from "#/components/features/settings/git-settings/forgejo-token-input";
+import { I18nKey } from "#/i18n/declaration";
+import {
+ displayErrorToast,
+ displaySuccessToast,
+} from "#/utils/custom-toast-handlers";
+import { retrieveAxiosErrorMessage } from "#/utils/retrieve-axios-error-message";
+import { GitSettingInputsSkeleton } from "#/components/features/settings/git-settings/github-settings-inputs-skeleton";
+import { useAddGitProviders } from "#/hooks/mutation/use-add-git-providers";
+import { useDeleteGitProviders } from "#/hooks/mutation/use-delete-git-providers";
+import { useUserProviders } from "#/hooks/use-user-providers";
+import { Provider, ProviderToken } from "#/types/settings";
+
+// /integrations is a local-only page; cloud backends do not expose it.
+export const clientLoader = () => {
+ if (getActiveBackend().backend.kind === "cloud") {
+ return redirect("/conversations");
+ }
+ return null;
+};
+
+export function GitSettingsScreen() {
+ const { t } = useTranslation("openhands");
+
+ const { mutate: saveGitProviders, isPending } = useAddGitProviders();
+ const { mutate: disconnectGitTokens, isPending: isDisconnecting } =
+ useDeleteGitProviders();
+
+ const { data: settings, isLoading } = useSettings();
+ const { providers } = useUserProviders();
+
+ const [githubTokenInputHasValue, setGithubTokenInputHasValue] =
+ React.useState(false);
+ const [gitlabTokenInputHasValue, setGitlabTokenInputHasValue] =
+ React.useState(false);
+ const [bitbucketTokenInputHasValue, setBitbucketTokenInputHasValue] =
+ React.useState(false);
+ const [bitbucketDCTokenInputHasValue, setBitbucketDCTokenInputHasValue] =
+ React.useState(false);
+ const [azureDevOpsTokenInputHasValue, setAzureDevOpsTokenInputHasValue] =
+ React.useState(false);
+ const [forgejoTokenInputHasValue, setForgejoTokenInputHasValue] =
+ React.useState(false);
+
+ const [githubHostInputHasValue, setGithubHostInputHasValue] =
+ React.useState(false);
+ const [gitlabHostInputHasValue, setGitlabHostInputHasValue] =
+ React.useState(false);
+ const [bitbucketHostInputHasValue, setBitbucketHostInputHasValue] =
+ React.useState(false);
+ const [bitbucketDCHostInputHasValue, setBitbucketDCHostInputHasValue] =
+ React.useState(false);
+ const [azureDevOpsHostInputHasValue, setAzureDevOpsHostInputHasValue] =
+ React.useState(false);
+ const [forgejoHostInputHasValue, setForgejoHostInputHasValue] =
+ React.useState(false);
+
+ const existingGithubHost = settings?.provider_tokens_set.github;
+ const existingGitlabHost = settings?.provider_tokens_set.gitlab;
+ const existingBitbucketHost = settings?.provider_tokens_set.bitbucket;
+ const existingBitbucketDCHost =
+ settings?.provider_tokens_set.bitbucket_data_center;
+ const existingAzureDevOpsHost = settings?.provider_tokens_set.azure_devops;
+ const existingForgejoHost = settings?.provider_tokens_set.forgejo;
+
+ const isGitHubTokenSet = providers.includes("github");
+ const isGitLabTokenSet = providers.includes("gitlab");
+ const isBitbucketTokenSet = providers.includes("bitbucket");
+ const isBitbucketDCTokenSet = providers.includes("bitbucket_data_center");
+ const isAzureDevOpsTokenSet = providers.includes("azure_devops");
+ const isForgejoTokenSet = providers.includes("forgejo");
+
+ const formAction = async (formData: FormData) => {
+ const disconnectButtonClicked =
+ formData.get("disconnect-tokens-button") !== null;
+
+ if (disconnectButtonClicked) {
+ disconnectGitTokens(undefined, {
+ onSuccess: () => {
+ displaySuccessToast(t(I18nKey.SETTINGS$SAVED));
+ },
+ onError: (error) => {
+ const errorMessage = retrieveAxiosErrorMessage(error);
+ displayErrorToast(errorMessage || t(I18nKey.ERROR$GENERIC));
+ },
+ });
+ return;
+ }
+
+ const githubToken = (
+ formData.get("github-token-input")?.toString() || ""
+ ).trim();
+ const gitlabToken = (
+ formData.get("gitlab-token-input")?.toString() || ""
+ ).trim();
+ const bitbucketToken = (
+ formData.get("bitbucket-token-input")?.toString() || ""
+ ).trim();
+ const bitbucketDCToken = (
+ formData.get("bitbucket-dc-token-input")?.toString() || ""
+ ).trim();
+ const azureDevOpsToken = (
+ formData.get("azure-devops-token-input")?.toString() || ""
+ ).trim();
+ const forgejoToken = (
+ formData.get("forgejo-token-input")?.toString() || ""
+ ).trim();
+ const githubHost = (
+ formData.get("github-host-input")?.toString() || ""
+ ).trim();
+ const gitlabHost = (
+ formData.get("gitlab-host-input")?.toString() || ""
+ ).trim();
+ const bitbucketHost = (
+ formData.get("bitbucket-host-input")?.toString() || ""
+ ).trim();
+ const bitbucketDCHost = (
+ formData.get("bitbucket-dc-host-input")?.toString() || ""
+ ).trim();
+ const azureDevOpsHost = (
+ formData.get("azure-devops-host-input")?.toString() || ""
+ ).trim();
+ const forgejoHost = (
+ formData.get("forgejo-host-input")?.toString() || ""
+ ).trim();
+
+ const providerTokens: Partial<Record<Provider, ProviderToken>> = {
+ github: { token: githubToken, host: githubHost },
+ gitlab: { token: gitlabToken, host: gitlabHost },
+ bitbucket: { token: bitbucketToken, host: bitbucketHost },
+ bitbucket_data_center: { token: bitbucketDCToken, host: bitbucketDCHost },
+ azure_devops: { token: azureDevOpsToken, host: azureDevOpsHost },
+ forgejo: { token: forgejoToken, host: forgejoHost },
+ };
+
+ saveGitProviders(
+ {
+ providers: providerTokens,
+ },
+ {
+ onSuccess: () => {
+ displaySuccessToast(t(I18nKey.SETTINGS$SAVED));
+ },
+ onError: (error) => {
+ const errorMessage = retrieveAxiosErrorMessage(error);
+ displayErrorToast(errorMessage || t(I18nKey.ERROR$GENERIC));
+ },
+ onSettled: () => {
+ setGithubTokenInputHasValue(false);
+ setGitlabTokenInputHasValue(false);
+ setBitbucketTokenInputHasValue(false);
+ setBitbucketDCTokenInputHasValue(false);
+ setAzureDevOpsTokenInputHasValue(false);
+ setForgejoTokenInputHasValue(false);
+ setGithubHostInputHasValue(false);
+ setGitlabHostInputHasValue(false);
+ setBitbucketHostInputHasValue(false);
+ setBitbucketDCHostInputHasValue(false);
+ setAzureDevOpsHostInputHasValue(false);
+ setForgejoHostInputHasValue(false);
+ },
+ },
+ );
+ };
+
+ const formIsClean =
+ !githubTokenInputHasValue &&
+ !gitlabTokenInputHasValue &&
+ !bitbucketTokenInputHasValue &&
+ !bitbucketDCTokenInputHasValue &&
+ !azureDevOpsTokenInputHasValue &&
+ !forgejoTokenInputHasValue &&
+ !githubHostInputHasValue &&
+ !gitlabHostInputHasValue &&
+ !bitbucketHostInputHasValue &&
+ !bitbucketDCHostInputHasValue &&
+ !azureDevOpsHostInputHasValue &&
+ !forgejoHostInputHasValue;
+
+ return (
+ <form
+ data-testid="git-settings-screen"
+ action={formAction}
+ className="flex flex-col h-full justify-between"
+ >
+ {!isLoading && (
+ <div className="flex flex-col gap-4">
+ <GitHubTokenInput
+ name="github-token-input"
+ isGitHubTokenSet={isGitHubTokenSet}
+ onChange={(value) => {
+ setGithubTokenInputHasValue(!!value);
+ }}
+ onGitHubHostChange={(value) => {
+ setGithubHostInputHasValue(!!value);
+ }}
+ githubHostSet={existingGithubHost}
+ />
+
+ <GitLabTokenInput
+ name="gitlab-token-input"
+ isGitLabTokenSet={isGitLabTokenSet}
+ onChange={(value) => {
+ setGitlabTokenInputHasValue(!!value);
+ }}
+ onGitLabHostChange={(value) => {
+ setGitlabHostInputHasValue(!!value);
+ }}
+ gitlabHostSet={existingGitlabHost}
+ />
+
+ <BitbucketTokenInput
+ name="bitbucket-token-input"
+ isBitbucketTokenSet={isBitbucketTokenSet}
+ onChange={(value) => {
+ setBitbucketTokenInputHasValue(!!value);
+ }}
+ onBitbucketHostChange={(value) => {
+ setBitbucketHostInputHasValue(!!value);
+ }}
+ bitbucketHostSet={existingBitbucketHost}
+ />
+
+ <BitbucketDCTokenInput
+ name="bitbucket-dc-token-input"
+ isBitbucketDCTokenSet={isBitbucketDCTokenSet}
+ onChange={(value) => {
+ setBitbucketDCTokenInputHasValue(!!value);
+ }}
+ onBitbucketDCHostChange={(value) => {
+ setBitbucketDCHostInputHasValue(!!value);
+ }}
+ bitbucketDCHostSet={existingBitbucketDCHost}
+ />
+
+ <AzureDevOpsTokenInput
+ name="azure-devops-token-input"
+ isAzureDevOpsTokenSet={isAzureDevOpsTokenSet}
+ onChange={(value) => {
+ setAzureDevOpsTokenInputHasValue(!!value);
+ }}
+ onAzureDevOpsHostChange={(value) => {
+ setAzureDevOpsHostInputHasValue(!!value);
+ }}
+ azureDevOpsHostSet={existingAzureDevOpsHost}
+ />
+
+ <ForgejoTokenInput
+ name="forgejo-token-input"
+ isForgejoTokenSet={isForgejoTokenSet}
+ onChange={(value) => {
+ setForgejoTokenInputHasValue(!!value);
+ }}
+ onForgejoHostChange={(value) => {
+ setForgejoHostInputHasValue(!!value);
+ }}
+ forgejoHostSet={existingForgejoHost}
+ />
+ </div>
+ )}
+
+ {isLoading && <GitSettingInputsSkeleton />}
+
+ <div className="flex gap-6 p-6 justify-end">
+ <BrandButton
+ testId="disconnect-tokens-button"
+ name="disconnect-tokens-button"
+ type="submit"
+ variant="secondary"
+ isDisabled={
+ isDisconnecting ||
+ (!isGitHubTokenSet &&
+ !isGitLabTokenSet &&
+ !isBitbucketTokenSet &&
+ !isBitbucketDCTokenSet &&
+ !isAzureDevOpsTokenSet &&
+ !isForgejoTokenSet)
+ }
+ >
+ {t("GIT$DISCONNECT_TOKENS")}
+ </BrandButton>
+ <BrandButton
+ testId="submit-button"
+ type="submit"
+ variant="primary"
+ isDisabled={isPending || isDisconnecting || formIsClean}
+ >
+ {!isPending && t("SETTINGS$SAVE_CHANGES")}
+ {isPending && t("SETTINGS$SAVING")}
+ </BrandButton>
+ </div>
+ </form>
+ );
+}
+
+export default GitSettingsScreen;
diff --git a/src/routes/home.tsx b/src/routes/home.tsx
index 31a8f18ebd..0d45345e8a 100644
--- a/src/routes/home.tsx
+++ b/src/routes/home.tsx
@@ -1,19 +1,13 @@
-import React from "react";
import { PrefetchPageLinks } from "react-router";
import { HomeHeader } from "#/components/features/home/home-header/home-header";
import { RepoConnector } from "#/components/features/home/repo-connector";
import { TaskSuggestions } from "#/components/features/home/tasks/task-suggestions";
-import { GitRepository } from "#/types/git";
import { NewConversation } from "#/components/features/home/new-conversation/new-conversation";
import { RecentConversations } from "#/components/features/home/recent-conversations/recent-conversations";
<PrefetchPageLinks page="/conversations/:conversationId" />;
function HomeScreen() {
- const [selectedRepo, setSelectedRepo] = React.useState<GitRepository | null>(
- null,
- );
-
return (
<div
data-testid="home-screen"
@@ -26,7 +20,7 @@ function HomeScreen() {
className="flex flex-col gap-5 px-6 sm:max-w-full sm:min-w-full md:flex-row lg:px-0 lg:max-w-[703px] lg:min-w-[703px]"
data-testid="home-screen-new-conversation-section"
>
- <RepoConnector onRepoSelection={setSelectedRepo} />
+ <RepoConnector />
<NewConversation />
</div>
</div>
@@ -37,7 +31,7 @@ function HomeScreen() {
data-testid="home-screen-recent-conversations-section"
>
<RecentConversations />
- <TaskSuggestions filterFor={selectedRepo} />
+ <TaskSuggestions />
</div>
</div>
</div>
diff --git a/src/routes/index-redirect.tsx b/src/routes/index-redirect.tsx
new file mode 100644
index 0000000000..198695c213
--- /dev/null
+++ b/src/routes/index-redirect.tsx
@@ -0,0 +1,7 @@
+import { redirect } from "react-router";
+
+export const clientLoader = () => redirect("/conversations");
+
+export default function IndexRedirect() {
+ return null;
+}
diff --git a/src/routes/launch.tsx b/src/routes/launch.tsx
index 76788c05bd..4e3a3cb67d 100644
--- a/src/routes/launch.tsx
+++ b/src/routes/launch.tsx
@@ -164,7 +164,7 @@ export default function LaunchRoute() {
};
const handleGoHome = () => {
- navigate("/");
+ navigate("/conversations");
};
const handleTryAgain = () => {
diff --git a/src/routes/root-layout.tsx b/src/routes/root-layout.tsx
index dd0fd64b47..50fd2f2e41 100644
--- a/src/routes/root-layout.tsx
+++ b/src/routes/root-layout.tsx
@@ -91,15 +91,20 @@ export default function MainApp() {
);
}
+ let rootLayoutPaddingClass = "p-0 md:p-3 md:pl-0";
+ if (pathname === "/" || pathname.startsWith("/automations")) {
+ rootLayoutPaddingClass = "p-0";
+ } else if (pathname.startsWith("/conversations")) {
+ rootLayoutPaddingClass = "p-0 md:pr-3";
+ }
+
return (
<ReactRouterNavigationProvider>
<div
data-testid="root-layout"
className={cn(
"h-screen lg:min-w-5xl flex flex-col md:flex-row bg-base overflow-hidden",
- pathname === "/" || pathname.startsWith("/automations")
- ? "p-0"
- : "p-0 md:p-3 md:pl-0",
+ rootLayoutPaddingClass,
)}
>
<title>{appTitle}</title>
diff --git a/src/routes/shared-conversation.tsx b/src/routes/shared-conversation.tsx
index 108ebd204f..adc30fd682 100644
--- a/src/routes/shared-conversation.tsx
+++ b/src/routes/shared-conversation.tsx
@@ -80,7 +80,7 @@ export default function SharedConversation() {
<div className="border-b border-neutral-700 p-4 flex-shrink-0">
<div className="max-w-4xl mx-auto flex items-start gap-4">
<Link
- to="/"
+ to="/conversations"
className="flex-shrink-0"
aria-label={t(I18nKey.BRANDING$OPENHANDS_LOGO)}
>
diff --git a/src/ui/dropdown/dropdown-menu.tsx b/src/ui/dropdown/dropdown-menu.tsx
index 80bf7081a2..4bc0ee3f70 100644
--- a/src/ui/dropdown/dropdown-menu.tsx
+++ b/src/ui/dropdown/dropdown-menu.tsx
@@ -1,4 +1,5 @@
/* eslint-disable react/jsx-props-no-spreading */
+import React from "react";
import { cn } from "#/utils/utils";
import { DropdownOption } from "./types";
@@ -13,6 +14,8 @@ interface DropdownMenuProps {
index: number;
className?: string;
}) => object;
+ footer?: React.ReactNode;
+ openUpward?: boolean;
}
export function DropdownMenu({
@@ -22,11 +25,14 @@ export function DropdownMenu({
emptyMessage,
getMenuProps,
getItemProps,
+ footer,
+ openUpward = false,
}: DropdownMenuProps) {
return (
<div
className={cn(
- "absolute z-10 w-full mt-1",
+ "absolute z-10 w-full",
+ openUpward ? "bottom-full mb-1" : "mt-1",
"bg-[#1F1F1F] border border-[#242424] rounded-lg",
"max-h-60 overflow-auto",
!isOpen && "hidden",
@@ -58,6 +64,9 @@ export function DropdownMenu({
</li>
))}
</ul>
+ {isOpen && footer ? (
+ <div className="border-t border-[#242424] p-1">{footer}</div>
+ ) : null}
</div>
);
}
diff --git a/src/ui/dropdown/dropdown.tsx b/src/ui/dropdown/dropdown.tsx
index 3c40fcbe47..6046af9d53 100644
--- a/src/ui/dropdown/dropdown.tsx
+++ b/src/ui/dropdown/dropdown.tsx
@@ -19,6 +19,8 @@ interface DropdownProps {
onChange?: (item: DropdownOption | null) => void;
testId?: string;
className?: string;
+ footer?: React.ReactNode;
+ openUpward?: boolean;
}
export function Dropdown({
@@ -32,6 +34,8 @@ export function Dropdown({
onChange,
testId,
className,
+ footer,
+ openUpward = false,
}: DropdownProps) {
const [inputValue, setInputValue] = useState(defaultValue?.label ?? "");
const [searchTerm, setSearchTerm] = useState("");
@@ -125,6 +129,8 @@ export function Dropdown({
emptyMessage={emptyMessage}
getMenuProps={getMenuProps}
getItemProps={getItemProps}
+ footer={footer}
+ openUpward={openUpward}
/>
</div>
);
diff --git a/src/utils/path-utils.ts b/src/utils/path-utils.ts
index 0435fc085b..f17d33fe5d 100644
--- a/src/utils/path-utils.ts
+++ b/src/utils/path-utils.ts
@@ -18,3 +18,21 @@ export const stripWorkspacePrefix = (path: string): string => {
const workspaceMatch = path.match(/^\/workspace\/[^/]+\/(.*)$/);
return workspaceMatch ? workspaceMatch[1] : path;
};
+
+/**
+ * Returns the basename (top-level folder/file name) from a path string,
+ * tolerating POSIX and Windows separators and trailing slashes.
+ */
+export const getPathBasename = (path: string): string => {
+ const trimmed = path.trim();
+ if (!trimmed) return "";
+
+ const normalized = trimmed.replace(/[\\/]+$/, "");
+ if (!normalized || /^[A-Za-z]:$/.test(normalized)) return "";
+
+ const idx = Math.max(
+ normalized.lastIndexOf("/"),
+ normalized.lastIndexOf("\\"),
+ );
+ return idx >= 0 ? normalized.slice(idx + 1) : normalized;
+};
diff --git a/src/utils/settings-utils.ts b/src/utils/settings-utils.ts
index 091cba51d3..3de3b079fa 100644
--- a/src/utils/settings-utils.ts
+++ b/src/utils/settings-utils.ts
@@ -57,6 +57,15 @@ export function isSettingsPageHidden(
return false;
}
+// Top-level pages that only make sense against a local agent-server.
+// Hidden from navigation and blocked at the route loader when the active
+// backend is a cloud SaaS environment.
+export const LOCAL_ONLY_SETTINGS_PATHS = new Set<string>(["/integrations"]);
+
+export function isLocalOnlySettingsPath(path: string): boolean {
+ return LOCAL_ONLY_SETTINGS_PATHS.has(path);
+}
+
export function getFirstAvailablePath(
featureFlags: WebClientFeatureFlags | undefined,
): string | null {