before_code stringlengths 14 465k | reviewer_comment stringlengths 16 64.5k | after_code stringlengths 9 467k | diff_context stringlengths 0 97k | file_path stringlengths 5 226 | comment_line int32 0 26 | language stringclasses 37
values | quality_score float32 0.07 1 | comment_type stringclasses 9
values | comment_length int32 16 64.5k | before_lines int32 1 17.2k | after_lines int32 1 12.1k | is_negative bool 2
classes | pr_title stringlengths 1 308 | pr_number int32 1 299k | repo_name stringclasses 533
values | repo_stars int64 321 419k | repo_language stringclasses 27
values | reviewer_username stringlengths 0 39 | author_username stringlengths 2 39 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
import pytest
from openhands.utils import environment
@pytest.fixture(autouse=True)
def clear_docker_cache():
if hasattr(environment.is_running_in_docker, 'cache_clear'):
environment.is_running_in_docker.cache_clear()
yield
if hasattr(environment.is_running_in_docker, 'cache_clear'):
envi... | No issues found. | import pytest
from openhands.utils import environment
@pytest.fixture(autouse=True)
def clear_docker_cache():
if hasattr(environment.is_running_in_docker, 'cache_clear'):
environment.is_running_in_docker.cache_clear()
yield
if hasattr(environment.is_running_in_docker, 'cache_clear'):
envi... | @@ -0,0 +1,32 @@
+import pytest
+
+from openhands.utils import environment
+
+
+@pytest.fixture(autouse=True)
+def clear_docker_cache():
+ if hasattr(environment.is_running_in_docker, 'cache_clear'):
+ environment.is_running_in_docker.cache_clear()
+ yield
+ if hasattr(environment.is_running_in_docker, ... | tests/unit/utils/test_environment.py | 0 | Python | 1 | none | 16 | 33 | 33 | true | localhost base_url fixup when running in a docker container | 11,474 | All-Hands-AI/OpenHands | 55,974 | Python | eddierichter-amd | |
mock_request = Request(scope={'type': 'http'})
mock_request._base_url = URL('http://test.com/')
mock_billing_session = MagicMock()
mock_billing_session.status = 'in_progress'
mock_billing_session.user_id = 'mock_user'
mock_billing_session.billing_session_type = BillingSessionType.DIRECT_PAYMENT... | No issues found. | mock_request = Request(scope={'type': 'http'})
mock_request._base_url = URL('http://test.com/')
mock_billing_session = MagicMock()
mock_billing_session.status = 'in_progress'
mock_billing_session.user_id = 'mock_user'
mock_billing_session.billing_session_type = BillingSessionType.DIRECT_PAYMENT... | @@ -36,6 +36,46 @@ def session_maker(engine):
return sessionmaker(bind=engine)
+@pytest.fixture
+def mock_request():
+ """Create a mock request object with proper URL structure for testing."""
+ return Request(
+ scope={
+ 'type': 'http',
+ 'path': '/api/billing/test',
+ ... | enterprise/tests/unit/test_billing.py | 0 | Python | 1 | none | 16 | 51 | 51 | true | fix: disable pro subscription upgrade on LLM page for self-hosted installs | 11,479 | All-Hands-AI/OpenHands | 55,974 | Python | hieptl | |
class ApiKeyCreateResponse(ApiKeyResponse):
key: str
class LlmApiKeyResponse(BaseModel):
key: str | None
@api_router.post('', response_model=ApiKeyCreateResponse)
async def create_api_key(key_data: ApiKeyCreate, user_id: str = Depends(get_user_id)):
"""Create a new API key for the authenticated user.""... | No issues found. |
class ApiKeyCreateResponse(ApiKeyResponse):
key: str
class LlmApiKeyResponse(BaseModel):
key: str | None
@api_router.post('', response_model=ApiKeyCreateResponse)
async def create_api_key(key_data: ApiKeyCreate, user_id: str = Depends(get_user_id)):
"""Create a new API key for the authenticated user.""... | @@ -3,10 +3,11 @@
import httpx
from fastapi import APIRouter, Depends, HTTPException, status
from pydantic import BaseModel, field_validator
+from server.config import get_config
from server.constants import LITE_LLM_API_KEY, LITE_LLM_API_URL
from storage.api_key_store import ApiKeyStore
from storage.database imp... | enterprise/server/routes/api_keys.py | 0 | Python | 1 | none | 16 | 51 | 51 | true | SAAS: dedup fetching user settings from keycloak id | 11,480 | All-Hands-AI/OpenHands | 55,974 | Python | malhotra5 | |
async def send_event_to_conversation(self, sid, data):
async with httpx.AsyncClient(
verify=httpx_verify_option(),
headers={
'X-Session-API-Key': self._get_session_api_key_for_conversation(sid)
},
) as client:
nested_url = self._get_ne... | No issues found. |
async def send_event_to_conversation(self, sid, data):
async with httpx.AsyncClient(
verify=httpx_verify_option(),
headers={
'X-Session-API-Key': self._get_session_api_key_for_conversation(sid)
},
) as client:
nested_url = self._get_ne... | @@ -42,6 +42,7 @@
from openhands.storage.files import FileStore
from openhands.storage.locations import get_conversation_dir
from openhands.utils.async_utils import call_sync_from_async
+from openhands.utils.http_session import httpx_verify_option
from openhands.utils.import_utils import get_impl
from openhands.ut... | openhands/server/conversation_manager/docker_nested_conversation_manager.py | 0 | Python | 1 | none | 16 | 51 | 51 | true | Provide httpx default context for OS-provided certs | 11,505 | All-Hands-AI/OpenHands | 55,974 | Python | raymyers | |
// Fetch sandbox data for V1 conversations
const sandboxesQuery = useBatchSandboxes(sandboxId ? [sandboxId] : []);
const mainQuery = useQuery<VSCodeUrlResult>({
queryKey: [
"unified",
"vscode_url",
conversationId,
isV1Conversation,
sandboxId,
],
queryFn: async () => {
... | No issues found. | // Fetch sandbox data for V1 conversations
const sandboxesQuery = useBatchSandboxes(sandboxId ? [sandboxId] : []);
const mainQuery = useQuery<VSCodeUrlResult>({
queryKey: [
"unified",
"vscode_url",
conversationId,
isV1Conversation,
sandboxId,
],
queryFn: async () => {
... | @@ -0,0 +1,122 @@
+import { useQuery } from "@tanstack/react-query";
+import { useTranslation } from "react-i18next";
+import ConversationService from "#/api/conversation-service/conversation-service.api";
+import { useConversationId } from "#/hooks/use-conversation-id";
+import { useActiveConversation } from "#/hooks/... | frontend/src/hooks/query/use-unified-vscode-url.ts | 0 | TypeScript | 1 | none | 16 | 51 | 51 | true | chore(frontend): Add unified hooks for V1 sandbox URLs (VSCode and served hosts) | 11,511 | All-Hands-AI/OpenHands | 55,974 | Python | amanape | |
)
return hash_image_name
lock_image_name = f'{runtime_image_repo}:{lock_tag}'
build_from = BuildFromImageType.SCRATCH
# If the exact image already exists, we do not need to build it
if runtime_builder.image_exists(hash_image_name, False):
logger.debug(f'Reusing Image [{hash... | No issues found. | )
return hash_image_name
lock_image_name = f'{runtime_image_repo}:{lock_tag}'
build_from = BuildFromImageType.SCRATCH
# If the exact image already exists, we do not need to build it
if runtime_builder.image_exists(hash_image_name, False):
logger.debug(f'Reusing Image [{hash... | @@ -52,12 +52,16 @@ def _generate_dockerfile(
)
template = env.get_template('Dockerfile.j2')
+ # Allow overriding conda/mamba channel alias (e.g., to avoid anaconda.org)
+ channel_alias = os.getenv('OH_CONDA_CHANNEL_ALIAS', '').strip() or None
+
dockerfile_content = template.render(
base... | openhands/runtime/utils/runtime_build.py | 0 | Python | 1 | none | 16 | 51 | 51 | true | Configurable conda/mamba channel_alias for runtime builds | 11,516 | All-Hands-AI/OpenHands | 55,974 | Python | enyst | |
# Mock conversation setup
conv = MagicMock()
conv.id = UUID('aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa')
if agent_status:
conv.state.agent_status = agent_status
mock_setup_conversation.return_value = conv
# Mock runner
runner = MagicMock()... | No issues found. |
# Mock conversation setup
conv = MagicMock()
conv.id = UUID('aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa')
if agent_status:
conv.state.agent_status = agent_status
mock_setup_conversation.return_value = conv
# Mock runner
runner = MagicMock()... | @@ -0,0 +1,147 @@
+"""Tests for the /resume command functionality."""
+
+from unittest.mock import MagicMock, patch
+from uuid import UUID
+import pytest
+from prompt_toolkit.input.defaults import create_pipe_input
+from prompt_toolkit.output.defaults import DummyOutput
+
+from openhands.sdk.conversation.state import A... | openhands-cli/tests/commands/test_resume_command.py | 0 | Python | 1 | none | 16 | 51 | 51 | true | CLI: Create conversation last minute | 11,576 | All-Hands-AI/OpenHands | 55,974 | Python | malhotra5 | |
# Create the projects directory if it does not exist yet
parent = Path(workspace.working_dir).parent
result = await workspace.execute_command(
f'mkdir {workspace.working_dir}', parent
)
if result.exit_code:
_logger.warning(f'mkdir failed: {result.stderr}'... | No issues found. |
# Create the projects directory if it does not exist yet
parent = Path(workspace.working_dir).parent
result = await workspace.execute_command(
f'mkdir {workspace.working_dir}', parent
)
if result.exit_code:
_logger.warning(f'mkdir failed: {result.stderr}'... | @@ -56,6 +56,14 @@ async def clone_or_init_git_repo(
):
request = task.request
+ # Create the projects directory if it does not exist yet
+ parent = Path(workspace.working_dir).parent
+ result = await workspace.execute_command(
+ f'mkdir {workspace.working_dir}', parent
+... | openhands/app_server/app_conversation/git_app_conversation_service.py | 0 | Python | 1 | none | 16 | 51 | 51 | true | Fix remote sandbox permissions | 11,582 | All-Hands-AI/OpenHands | 55,974 | Python | tofarr | |
it("should always render the right options", () => {
renderWithRouter(
<AccountSettingsContextMenu
onLogout={onLogoutMock}
onClose={onCloseMock}
/>,
);
expect(
screen.getByTestId("account-settings-context-menu"),
).toBeInTheDocument();
expect(screen.getByText("S... | No issues found. |
it("should always render the right options", () => {
renderWithRouter(
<AccountSettingsContextMenu
onLogout={onLogoutMock}
onClose={onCloseMock}
/>,
);
expect(
screen.getByTestId("account-settings-context-menu"),
).toBeInTheDocument();
expect(screen.getByText("S... | @@ -33,9 +33,24 @@ describe("AccountSettingsContextMenu", () => {
expect(
screen.getByTestId("account-settings-context-menu"),
).toBeInTheDocument();
+ expect(screen.getByText("SIDEBAR$DOCS")).toBeInTheDocument();
expect(screen.getByText("ACCOUNT_SETTINGS$LOGOUT")).toBeInTheDocument();
});
... | frontend/__tests__/components/context-menu/account-settings-context-menu.test.tsx | 0 | TypeScript | 1 | none | 16 | 51 | 51 | true | Add Documentation link to profile context menu | 11,583 | All-Hands-AI/OpenHands | 55,974 | Python | jpshackelford | |
return
try:
initialized_agent = verify_agent_exists_or_setup_agent()
except MissingAgentSpec:
print_formatted_text(HTML('\n<yellow>Setup is required to use OpenHands CLI.</yellow>'))
print_formatted_text(HTML('\n<yellow>Goodbye! 👋</yellow>'))
return
display_we... | No issues found. | return
try:
initialized_agent = verify_agent_exists_or_setup_agent()
except MissingAgentSpec:
print_formatted_text(HTML('\n<yellow>Setup is required to use OpenHands CLI.</yellow>'))
print_formatted_text(HTML('\n<yellow>Goodbye! 👋</yellow>'))
return
display_we... | @@ -143,8 +143,9 @@ def run_cli_entry(resume_conversation_id: str | None = None) -> None:
elif command == '/new':
try:
# Start a fresh conversation (no resume ID = new conversation)
- conversation = setup_conversation(conversation_id)
- ... | openhands-cli/openhands_cli/agent_chat.py | 0 | Python | 1 | none | 16 | 51 | 51 | true | CLI: lazy load conversation for `/new` command | 11,601 | All-Hands-AI/OpenHands | 55,974 | Python | malhotra5 | |
SandboxSpecInfo,
SandboxSpecInfoPage,
)
from openhands.app_server.services.injector import Injector
from openhands.sdk.utils.models import DiscriminatedUnionMixin
# The version of the agent server to use for deployments.
# Typically this will be the same as the values from the pyproject.toml
AGENT_SERVER_IMAGE... | No issues found. | SandboxSpecInfo,
SandboxSpecInfoPage,
)
from openhands.app_server.services.injector import Injector
from openhands.sdk.utils.models import DiscriminatedUnionMixin
# The version of the agent server to use for deployments.
# Typically this will be the same as the values from the pyproject.toml
AGENT_SERVER_IMAGE... | @@ -11,7 +11,7 @@
# The version of the agent server to use for deployments.
# Typically this will be the same as the values from the pyproject.toml
-AGENT_SERVER_IMAGE = 'ghcr.io/openhands/agent-server:be9725b-python'
+AGENT_SERVER_IMAGE = 'ghcr.io/openhands/agent-server:23c8436-python'
class SandboxSpecServic... | openhands/app_server/sandbox/sandbox_spec_service.py | 0 | Python | 1 | none | 16 | 51 | 51 | true | Fix for issue where conversations won't start | 11,633 | All-Hands-AI/OpenHands | 55,974 | Python | tofarr | |
llm = LLM(**default_config(), usage_id='test-service')
return FakeAgent(llm=llm, tools=[])
class TestConversationRunner:
@pytest.mark.parametrize(
'agent_status', [ConversationExecutionStatus.RUNNING, ConversationExecutionStatus.PAUSED]
)
def test_non_confirmation_mode_runs_once(
s... | No issues found. | llm = LLM(**default_config(), usage_id='test-service')
return FakeAgent(llm=llm, tools=[])
class TestConversationRunner:
@pytest.mark.parametrize(
'agent_status', [ConversationExecutionStatus.RUNNING, ConversationExecutionStatus.PAUSED]
)
def test_non_confirmation_mode_runs_once(
s... | @@ -9,7 +9,7 @@
from openhands.sdk import Conversation, ConversationCallbackType, LocalConversation
from openhands.sdk.agent.base import AgentBase
from openhands.sdk.conversation import ConversationState
-from openhands.sdk.conversation.state import AgentExecutionStatus
+from openhands.sdk.conversation.state import ... | openhands-cli/tests/test_conversation_runner.py | 0 | Python | 1 | none | 16 | 51 | 51 | true | CLI: align with agent-sdk renames | 11,643 | All-Hands-AI/OpenHands | 55,974 | Python | enyst | |
import { useTranslation } from "react-i18next";
import { I18nKey } from "#/i18n/declaration";
import LessonPlanIcon from "#/icons/lesson-plan.svg?react";
function PlannerTab() {
const { t } = useTranslation();
return (
<div className="flex flex-col items-center justify-center w-full h-full p-10">
<Lesso... | No issues found. | import { useTranslation } from "react-i18next";
import { I18nKey } from "#/i18n/declaration";
import LessonPlanIcon from "#/icons/lesson-plan.svg?react";
function PlannerTab() {
const { t } = useTranslation();
return (
<div className="flex flex-col items-center justify-center w-full h-full p-10">
<Lesso... | @@ -0,0 +1,25 @@
+import { useTranslation } from "react-i18next";
+import { I18nKey } from "#/i18n/declaration";
+import LessonPlanIcon from "#/icons/lesson-plan.svg?react";
+
+function PlannerTab() {
+ const { t } = useTranslation();
+
+ return (
+ <div className="flex flex-col items-center justify-center w-full ... | frontend/src/routes/planner-tab.tsx | 0 | TypeScript | 1 | none | 16 | 26 | 26 | true | feat(frontend): create new planner tab in the interface | 11,646 | All-Hands-AI/OpenHands | 55,974 | Python | hieptl | |
// Custom component to render <h2> in markdown
export function h2({
children,
}: React.ClassAttributes<HTMLHeadingElement> &
React.HTMLAttributes<HTMLHeadingElement> &
ExtraProps) {
return (
<h2 className="text-xl font-semibold leading-6 -tracking-[0.02em] text-white mb-3 mt-5 first:mt-0">
{children}... | No issues found. |
// Custom component to render <h2> in markdown
export function h2({
children,
}: React.ClassAttributes<HTMLHeadingElement> &
React.HTMLAttributes<HTMLHeadingElement> &
ExtraProps) {
return (
<h2 className="text-xl font-semibold leading-6 -tracking-[0.02em] text-white mb-3 mt-5 first:mt-0">
{children}... | @@ -0,0 +1,80 @@
+import React from "react";
+import { ExtraProps } from "react-markdown";
+
+// Custom component to render <h1> in markdown
+export function h1({
+ children,
+}: React.ClassAttributes<HTMLHeadingElement> &
+ React.HTMLAttributes<HTMLHeadingElement> &
+ ExtraProps) {
+ return (
+ <h1 className="t... | frontend/src/components/features/markdown/headings.tsx | 0 | TypeScript | 1 | none | 16 | 51 | 51 | true | feat(frontend): display plan content within the planner tab | 11,658 | All-Hands-AI/OpenHands | 55,974 | Python | hieptl | |
setPersistedIsRightPanelShown(false);
} else {
// If clicking a different tab or drawer is closed, open drawer and select tab
onTabChange(tab);
if (!isRightPanelShown) {
setHasRightPanelToggled(true);
setPersistedIsRightPanelShown(true);
}
}
};
const isTabActiv... | No issues found. | setPersistedIsRightPanelShown(false);
} else {
// If clicking a different tab or drawer is closed, open drawer and select tab
onTabChange(tab);
if (!isRightPanelShown) {
setHasRightPanelToggled(true);
setPersistedIsRightPanelShown(true);
}
}
};
const isTabActiv... | @@ -1,11 +1,12 @@
-import { useEffect } from "react";
+import { useEffect, useState } from "react";
import { useTranslation } from "react-i18next";
import { useLocalStorage } from "@uidotdev/usehooks";
import TerminalIcon from "#/icons/terminal.svg?react";
import GlobeIcon from "#/icons/globe.svg?react";
import Se... | frontend/src/components/features/conversation/conversation-tabs/conversation-tabs.tsx | 0 | TypeScript | 1 | none | 16 | 51 | 51 | true | feat(frontend): enable pinning and unpinning of conversation tabs | 11,659 | All-Hands-AI/OpenHands | 55,974 | Python | hieptl | |
if (selectedTab === tab && isRightPanelShown) {
// If clicking the same active tab, close the drawer
setHasRightPanelToggled(false);
setPersistedIsRightPanelShown(false);
} else {
// If clicking a different tab or drawer is closed, open drawer and select tab
onTabChange(tab);
... | No issues found. | if (selectedTab === tab && isRightPanelShown) {
// If clicking the same active tab, close the drawer
setHasRightPanelToggled(false);
setPersistedIsRightPanelShown(false);
} else {
// If clicking a different tab or drawer is closed, open drawer and select tab
onTabChange(tab);
... | @@ -19,8 +19,10 @@ import {
} from "#/state/conversation-store";
import { ConversationTabsContextMenu } from "./conversation-tabs-context-menu";
import { USE_PLANNING_AGENT } from "#/utils/feature-flags";
+import { useConversationId } from "#/hooks/use-conversation-id";
export function ConversationTabs() {
+ con... | frontend/src/components/features/conversation/conversation-tabs/conversation-tabs.tsx | 0 | TypeScript | 1 | none | 16 | 51 | 51 | true | fix: conversation tab state sync across browser tabs | 11,680 | All-Hands-AI/OpenHands | 55,974 | Python | naaa760 | |
response = await self.httpx_client.get(url, params=params, headers=headers)
response.raise_for_status()
data = response.json()
conversation_info = _conversation_info_type_adapter.validate_python(data)
conversation_info = [c for c in conversation_info if c]
... | No issues found. | response = await self.httpx_client.get(url, params=params, headers=headers)
response.raise_for_status()
data = response.json()
conversation_info = _conversation_info_type_adapter.validate_python(data)
conversation_info = [c for c in conversation_info if c]
... | @@ -215,11 +215,12 @@ async def _start_app_conversation(
yield task
# Start conversation...
+ body_json = start_conversation_request.model_dump(
+ mode='json', context={'expose_secrets': True}
+ )
response = await self.httpx_client.post(
... | openhands/app_server/app_conversation/live_status_app_conversation_service.py | 0 | Python | 1 | none | 16 | 51 | 51 | true | Fix for issue where conversation does not start | 11,695 | All-Hands-AI/OpenHands | 55,974 | Python | tofarr | |
return (
<QueryClientProvider client={queryClient}>{children}</QueryClientProvider>
);
}
return Wrapper;
};
describe("AcceptTOS", () => {
beforeEach(() => {
vi.stubGlobal("location", { href: "" });
});
afterEach(() => {
vi.unstubAllGlobals();
vi.resetAllMocks();
});
it("shoul... | No issues found. | return (
<QueryClientProvider client={queryClient}>{children}</QueryClientProvider>
);
}
return Wrapper;
};
describe("AcceptTOS", () => {
beforeEach(() => {
vi.stubGlobal("location", { href: "" });
});
afterEach(() => {
vi.unstubAllGlobals();
vi.resetAllMocks();
});
it("shoul... | @@ -1,10 +1,9 @@
import { render, screen } from "@testing-library/react";
import { it, describe, expect, vi, beforeEach, afterEach } from "vitest";
import userEvent from "@testing-library/user-event";
+import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
import AcceptTOS from "#/routes/accept-t... | frontend/__tests__/routes/accept-tos.test.tsx | 0 | TypeScript | 1 | none | 16 | 51 | 51 | true | refactor(frontend): migrate from direct posthog imports to usePostHog hook | 11,703 | All-Hands-AI/OpenHands | 55,974 | Python | amanape | |
mock_manager.sio = mock_sio
# Call the function
result = await update_conversation(
conversation_id=conversation_id,
data=update_request,
user_id=user_id,
conversation_store=mock_conversation_store,
)
# Verify success
asse... | No issues found. | mock_manager.sio = mock_sio
# Call the function
result = await update_conversation(
conversation_id=conversation_id,
data=update_request,
user_id=user_id,
conversation_store=mock_conversation_store,
)
# Verify success
asse... | @@ -11,7 +11,14 @@
AppConversationInfoService,
)
from openhands.app_server.app_conversation.app_conversation_models import (
+ AgentType,
AppConversationInfo,
+ AppConversationStartRequest,
+ AppConversationStartTask,
+ AppConversationStartTaskStatus,
+)
+from openhands.app_server.app_conversati... | tests/unit/server/routes/test_conversation_routes.py | 0 | Python | 1 | none | 16 | 51 | 51 | true | feat(backend): enable sub-conversation creation using a different agent | 11,715 | All-Hands-AI/OpenHands | 55,974 | Python | hieptl | |
// V1 specific fields
v1_task_id?: string;
is_v1?: boolean;
}
export const useCreateConversation = () => {
const queryClient = useQueryClient();
const { trackConversationCreated } = useTracking();
return useMutation({
mutationKey: ["create-conversation"],
mutationFn: async (
variables: Creat... | No issues found. | // V1 specific fields
v1_task_id?: string;
is_v1?: boolean;
}
export const useCreateConversation = () => {
const queryClient = useQueryClient();
const { trackConversationCreated } = useTracking();
return useMutation({
mutationKey: ["create-conversation"],
mutationFn: async (
variables: Creat... | @@ -17,6 +17,8 @@ interface CreateConversationVariables {
suggestedTask?: SuggestedTask;
conversationInstructions?: string;
createMicroagent?: CreateMicroagent;
+ parentConversationId?: string;
+ agentType?: "default" | "plan";
}
// Response type that combines both V1 and legacy responses
@@ -44,6 +46,8 ... | frontend/src/hooks/mutation/use-create-conversation.ts | 0 | TypeScript | 1 | none | 16 | 51 | 51 | true | feat(frontend): integrate with the API to create a sub-conversation for the planning agent | 11,730 | All-Hands-AI/OpenHands | 55,974 | Python | hieptl | |
return FakeAgent(llm=llm, tools=[])
class TestConversationRunner:
@pytest.mark.parametrize(
'agent_status', [ConversationExecutionStatus.RUNNING, ConversationExecutionStatus.PAUSED]
)
def test_non_confirmation_mode_runs_once(
self, agent: FakeAgent, agent_status: ConversationExecutionS... | No issues found. | return FakeAgent(llm=llm, tools=[])
class TestConversationRunner:
@pytest.mark.parametrize(
'agent_status', [ConversationExecutionStatus.RUNNING, ConversationExecutionStatus.PAUSED]
)
def test_non_confirmation_mode_runs_once(
self, agent: FakeAgent, agent_status: ConversationExecutionS... | @@ -113,10 +113,10 @@ def test_confirmation_mode_waiting_and_user_decision_controls_run(
agent.finish_on_step = 1
convo = Conversation(agent)
-
+
# Set security analyzer using the new API to enable confirmation mode
convo.set_security_analyzer(MagicMock())
-
+
... | openhands-cli/tests/test_conversation_runner.py | 0 | Python | 1 | none | 16 | 51 | 51 | true | Bumped Software Agent SDK and fixed V1 Delete | 11,768 | All-Hands-AI/OpenHands | 55,974 | Python | tofarr | |
return None
local_deploy = os.environ.get('LOCAL_DEPLOYMENT', None)
key = LITE_LLM_API_KEY
if not local_deploy:
# Get user info to add to litellm
token_manager = TokenManager()
keycloak_user_info = (
await token_manager.get_user_inf... | No issues found. | return None
local_deploy = os.environ.get('LOCAL_DEPLOYMENT', None)
key = LITE_LLM_API_KEY
if not local_deploy:
# Get user info to add to litellm
token_manager = TokenManager()
keycloak_user_info = (
await token_manager.get_user_inf... | @@ -97,6 +97,10 @@ async def load(self) -> Settings | None:
return settings
async def store(self, item: Settings):
+ # Check if provider is OpenHands and generate API key if needed
+ if item and self._is_openhands_provider(item):
+ await self._ensure_openhands_api_key(item)
... | enterprise/storage/saas_settings_store.py | 0 | Python | 1 | none | 16 | 51 | 51 | true | fix(frontend): hide api key field for openhands provider and auto-populate the key | 11,791 | All-Hands-AI/OpenHands | 55,974 | Python | hieptl | |
/**
* Usage metrics mapping for different components
*/
export interface UsageToMetrics {
agent: LLMMetrics;
condenser: LLMMetrics;
}
/**
* Stats containing usage metrics
*/
export interface ConversationStats {
usage_to_metrics: UsageToMetrics;
}
/**
* Conversation state value types
*/
export interface C... | No issues found. |
/**
* Usage metrics mapping for different components
*/
export interface UsageToMetrics {
agent: LLMMetrics;
condenser: LLMMetrics;
}
/**
* Stats containing usage metrics
*/
export interface ConversationStats {
usage_to_metrics: UsageToMetrics;
}
/**
* Conversation state value types
*/
export interface C... | @@ -1,11 +1,63 @@
import { BaseEvent } from "../base/event";
import { V1ExecutionStatus } from "../base/common";
+/**
+ * Token usage metrics for LLM calls
+ */
+export interface TokenUsage {
+ model: string;
+ prompt_tokens: number;
+ completion_tokens: number;
+ cache_read_tokens: number;
+ cache_write_token... | frontend/src/types/v1/core/events/conversation-state-event.ts | 0 | TypeScript | 1 | none | 16 | 51 | 51 | true | fix(frontend): resolve issue preventing cost from displaying (V1) | 11,798 | All-Hands-AI/OpenHands | 55,974 | Python | hieptl | |
* the pending state of the conversation creation.
*
* @returns An object containing handlePlanClick function and isCreatingConversation boolean
*/
export const useHandlePlanClick = () => {
const { t } = useTranslation();
const { setConversationMode, setSubConversationTaskId } =
useConversationStore();
con... | No issues found. | * the pending state of the conversation creation.
*
* @returns An object containing handlePlanClick function and isCreatingConversation boolean
*/
export const useHandlePlanClick = () => {
const { t } = useTranslation();
const { setConversationMode, setSubConversationTaskId } =
useConversationStore();
con... | @@ -0,0 +1,71 @@
+import { useCallback } from "react";
+import { useTranslation } from "react-i18next";
+import { I18nKey } from "#/i18n/declaration";
+import { useConversationStore } from "#/state/conversation-store";
+import { useActiveConversation } from "#/hooks/query/use-active-conversation";
+import { useCreateCo... | frontend/src/hooks/use-handle-plan-click.ts | 0 | TypeScript | 1 | none | 16 | 51 | 51 | true | feat(frontend): add handler for 'create a plan' button click | 11,806 | All-Hands-AI/OpenHands | 55,974 | Python | hieptl | |
import React from "react";
import { describe, it, expect, vi } from "vitest";
import { screen } from "@testing-library/react";
import { renderWithProviders } from "test-utils";
import { ConfirmDeleteModal } from "#/components/features/conversation-panel/confirm-delete-modal";
vi.mock("react-i18next", async (importOrig... | No issues found. | import React from "react";
import { describe, it, expect, vi } from "vitest";
import { screen } from "@testing-library/react";
import { renderWithProviders } from "test-utils";
import { ConfirmDeleteModal } from "#/components/features/conversation-panel/confirm-delete-modal";
vi.mock("react-i18next", async (importOrig... | @@ -0,0 +1,30 @@
+import React from "react";
+import { describe, it, expect, vi } from "vitest";
+import { screen } from "@testing-library/react";
+import { renderWithProviders } from "test-utils";
+import { ConfirmDeleteModal } from "#/components/features/conversation-panel/confirm-delete-modal";
+
+vi.mock("react-i18... | frontend/__tests__/components/features/conversation-panel/confirm-delete-modal.test.tsx | 0 | TypeScript | 1 | none | 16 | 31 | 31 | true | fix: display conversation title in delete confirmation modal | 11,818 | All-Hands-AI/OpenHands | 55,974 | Python | naaa760 | |
/**
* Additional or override components for markdown elements.
* Default components (code, ul, ol) are always included unless overridden.
*/
components?: Partial<Components>;
/**
* Whether to include standard components (anchor, paragraph).
* Defaults to false.
*/
includeStandard?: boolean;
... | No issues found. | /**
* Additional or override components for markdown elements.
* Default components (code, ul, ol) are always included unless overridden.
*/
components?: Partial<Components>;
/**
* Whether to include standard components (anchor, paragraph).
* Defaults to false.
*/
includeStandard?: boolean;
... | @@ -0,0 +1,80 @@
+import Markdown, { Components } from "react-markdown";
+import remarkGfm from "remark-gfm";
+import remarkBreaks from "remark-breaks";
+import { code } from "./code";
+import { ul, ol } from "./list";
+import { paragraph } from "./paragraph";
+import { anchor } from "./anchor";
+import { h1, h2, h3, h... | frontend/src/components/features/markdown/markdown-renderer.tsx | 0 | TypeScript | 1 | none | 16 | 51 | 51 | true | fix(frontend): the content of the FinishObservation event is not being rendered correctly. | 11,846 | All-Hands-AI/OpenHands | 55,974 | Python | hieptl | |
@patch(
'openhands.app_server.app_conversation.app_conversation_service_base.LLMSummarizingCondenser'
)
def test_create_condenser_default_agent_with_none_max_size(mock_condenser_class):
"""Test _create_condenser for DEFAULT agent with condenser_max_size = None uses default."""
# Arrange
mock_user_conte... | No issues found. |
@patch(
'openhands.app_server.app_conversation.app_conversation_service_base.LLMSummarizingCondenser'
)
def test_create_condenser_default_agent_with_none_max_size(mock_condenser_class):
"""Test _create_condenser for DEFAULT agent with condenser_max_size = None uses default."""
# Arrange
mock_user_conte... | @@ -5,13 +5,15 @@
"""
import subprocess
-from unittest.mock import AsyncMock, MagicMock, patch
+from unittest.mock import AsyncMock, MagicMock, Mock, patch
import pytest
+from openhands.app_server.app_conversation.app_conversation_models import AgentType
from openhands.app_server.app_conversation.app_conversa... | tests/unit/app_server/test_app_conversation_service_base.py | 0 | Python | 1 | none | 16 | 51 | 51 | true | fix(backend): apply user-defined condenser_max_size in new v1 conversations | 11,862 | All-Hands-AI/OpenHands | 55,974 | Python | hieptl | |
expect(billingLink).toHaveAttribute("href", "/settings/billing");
const integrationsLink = screen
.getByText("SETTINGS$NAV_INTEGRATIONS")
.closest("a");
expect(integrationsLink).toHaveAttribute("href", "/settings/integrations");
});
it("should navigate to /settings/organization-members whe... | No issues found. | expect(billingLink).toHaveAttribute("href", "/settings/billing");
const integrationsLink = screen
.getByText("SETTINGS$NAV_INTEGRATIONS")
.closest("a");
expect(integrationsLink).toHaveAttribute("href", "/settings/integrations");
});
it("should navigate to /settings/organization-members whe... | @@ -59,25 +59,38 @@ describe("UserContextMenu", () => {
screen.getByTestId("org-selector");
screen.getByText("ACCOUNT_SETTINGS$LOGOUT");
- expect(screen.queryByText("ORG$INVITE_TEAM")).not.toBeInTheDocument();
- expect(screen.queryByText("ORG$MANAGE_TEAM")).not.toBeInTheDocument();
+ expect(
+ ... | frontend/__tests__/components/features/user/user-context-menu.test.tsx | 0 | TypeScript | 1 | none | 16 | 51 | 51 | true | refactor(frontend): rename team to organization members | 11,886 | All-Hands-AI/OpenHands | 55,974 | Python | hieptl | |
import { useQuery } from "@tanstack/react-query";
import V1ConversationService from "#/api/conversation-service/v1-conversation-service.api";
import { useSettings } from "#/hooks/query/use-settings";
/**
* Hook to fetch in-progress V1 conversation start tasks
*
* Use case: Show tasks that are provisioning sandboxes... | No issues found. | import { useQuery } from "@tanstack/react-query";
import V1ConversationService from "#/api/conversation-service/v1-conversation-service.api";
import { useSettings } from "#/hooks/query/use-settings";
/**
* Hook to fetch in-progress V1 conversation start tasks
*
* Use case: Show tasks that are provisioning sandboxes... | @@ -1,6 +1,6 @@
import { useQuery } from "@tanstack/react-query";
import V1ConversationService from "#/api/conversation-service/v1-conversation-service.api";
-import { USE_V1_CONVERSATION_API } from "#/utils/feature-flags";
+import { useSettings } from "#/hooks/query/use-settings";
/**
* Hook to fetch in-progres... | frontend/src/hooks/query/use-start-tasks.ts | 0 | TypeScript | 1 | none | 16 | 30 | 30 | true | Replace USE_V1_CONVERSATION_API feature flag with user setting | 11,893 | All-Hands-AI/OpenHands | 55,974 | Python | tofarr | |
onClose,
onRoleChange,
onRemove,
}: OrganizationMemberRoleContextMenuProps) {
const { t } = useTranslation();
const menuRef = useClickOutsideElement<HTMLUListElement>(onClose);
const handleAdminClick = (event: React.MouseEvent<HTMLButtonElement>) => {
event.preventDefault();
event.stopPropagation()... | No issues found. | onClose,
onRoleChange,
onRemove,
}: OrganizationMemberRoleContextMenuProps) {
const { t } = useTranslation();
const menuRef = useClickOutsideElement<HTMLUListElement>(onClose);
const handleAdminClick = (event: React.MouseEvent<HTMLButtonElement>) => {
event.preventDefault();
event.stopPropagation()... | @@ -0,0 +1,98 @@
+import React from "react";
+import { useTranslation } from "react-i18next";
+import { I18nKey } from "#/i18n/declaration";
+import { ContextMenu } from "#/ui/context-menu";
+import { ContextMenuListItem } from "../context-menu/context-menu-list-item";
+import { ContextMenuIconText } from "#/ui/context... | frontend/src/components/features/org/organization-member-role-context-menu.tsx | 0 | TypeScript | 1 | none | 16 | 51 | 51 | true | refactor(frontend): update role dropdown styles in the team page (org support) | 11,906 | All-Hands-AI/OpenHands | 55,974 | Python | hieptl | |
@pytest.mark.asyncio
async def test_configure_llm_and_mcp_no_tavily_without_keys(self):
"""Test _configure_llm_and_mcp does not add tavily when no keys are available."""
# Arrange
self.mock_user.search_api_key = None
self.service.tavily_api_key = None
self.mock_user_conte... | No issues found. | @pytest.mark.asyncio
async def test_configure_llm_and_mcp_no_tavily_without_keys(self):
"""Test _configure_llm_and_mcp does not add tavily when no keys are available."""
# Arrange
self.mock_user.search_api_key = None
self.service.tavily_api_key = None
self.mock_user_conte... | @@ -50,6 +50,7 @@ def setup_method(self):
sandbox_startup_poll_frequency=1,
httpx_client=self.mock_httpx_client,
web_url='https://test.example.com',
+ openhands_provider_base_url='https://provider.example.com',
access_token_hard_timeout=None,
a... | tests/unit/app_server/test_live_status_app_conversation_service.py | 0 | Python | 1 | none | 16 | 51 | 51 | true | fix: switching from own model to breaks functionality | 11,916 | All-Hands-AI/OpenHands | 55,974 | Python | hieptl | |
</button>
</div>
);
}
interface AddCreditsModalProps {
onClose: () => void;
}
function AddCreditsModal({ onClose }: AddCreditsModalProps) {
const { t } = useTranslation();
const { mutate: addBalance } = useCreateStripeCheckoutSession();
const [inputValue, setInputValue] = React.useState("");
co... | No issues found. | </button>
</div>
);
}
interface AddCreditsModalProps {
onClose: () => void;
}
function AddCreditsModal({ onClose }: AddCreditsModalProps) {
const { t } = useTranslation();
const { mutate: addBalance } = useCreateStripeCheckoutSession();
const [inputValue, setInputValue] = React.useState("");
co... | @@ -19,6 +19,7 @@ import {
} from "#/utils/query-client-getters";
import { queryClient } from "#/query-client-config";
import { I18nKey } from "#/i18n/declaration";
+import { amountIsValid } from "#/utils/amount-is-valid";
function TempChip({
children,
@@ -191,21 +192,62 @@ function AddCreditsModal({ onClose }... | frontend/src/routes/manage-org.tsx | 0 | TypeScript | 1 | none | 16 | 51 | 51 | true | refactor(frontend): ensure proper validation in organization add credits modal (org support) | 11,917 | All-Hands-AI/OpenHands | 55,974 | Python | hieptl | |
import { describe, it, expect, vi, beforeEach } from "vitest";
import { SAAS_NAV_ITEMS, OSS_NAV_ITEMS } from "#/constants/settings-nav";
import OptionService from "#/api/option-service/option-service.api";
import { useSettingsNavItems } from "#/hooks/use-settings-nav-items";
const queryClient = new QueryClient();
cons... | No issues found. | import { describe, it, expect, vi, beforeEach } from "vitest";
import { SAAS_NAV_ITEMS, OSS_NAV_ITEMS } from "#/constants/settings-nav";
import OptionService from "#/api/option-service/option-service.api";
import { useSettingsNavItems } from "#/hooks/use-settings-nav-items";
const queryClient = new QueryClient();
cons... | @@ -0,0 +1,53 @@
+import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
+import { renderHook, waitFor } from "@testing-library/react";
+import { describe, it, expect, vi, beforeEach } from "vitest";
+import { SAAS_NAV_ITEMS, OSS_NAV_ITEMS } from "#/constants/settings-nav";
+import OptionService from... | frontend/__tests__/hooks/use-settings-nav-items.test.tsx | 0 | TypeScript | 1 | none | 16 | 51 | 51 | true | refactor(frontend): consolidate settings navigation items logic into shared custom hook | 11,950 | All-Hands-AI/OpenHands | 55,974 | Python | AVBharath10 | |
setLastSelectedProvider(provider); // Store the selected provider
setSelectedRepository(null); // Reset repository selection when provider changes
setSelectedBranch(null); // Reset branch selection when provider changes
onRepoSelection(null); // Reset parent component's selected repo
};
const handl... | No issues found. | setLastSelectedProvider(provider); // Store the selected provider
setSelectedRepository(null); // Reset repository selection when provider changes
setSelectedBranch(null); // Reset branch selection when provider changes
onRepoSelection(null); // Reset parent component's selected repo
};
const handl... | @@ -35,7 +35,11 @@ export function RepositorySelectionForm({
React.useState<Provider | null>(null);
const { providers } = useUserProviders();
- const { addRecentRepository } = useHomeStore();
+ const {
+ addRecentRepository,
+ setLastSelectedProvider,
+ getLastSelectedProvider,
+ } = useHomeStore(... | frontend/src/components/features/home/repo-selection-form.tsx | 0 | TypeScript | 1 | none | 16 | 51 | 51 | true | feat: remember last selected git provider in homepage dropdown | 11,979 | All-Hands-AI/OpenHands | 55,974 | Python | tofarr | |
# When there are no triggered agents, build_microagent_info is not called
conversation_memory.prompt_manager.build_microagent_info.assert_not_called()
def test_conversation_memory_processes_microagent_observation(prompt_dir):
"""Test that ConversationMemory processes RecallObservations correctly."""
... | No issues found. |
# When there are no triggered agents, build_microagent_info is not called
conversation_memory.prompt_manager.build_microagent_info.assert_not_called()
def test_conversation_memory_processes_microagent_observation(prompt_dir):
"""Test that ConversationMemory processes RecallObservations correctly."""
... | @@ -158,7 +158,8 @@ def test_ensure_initial_user_message_adds_if_only_system(
system_message = SystemMessageAction(content='System')
system_message._source = EventSource.AGENT
events = [system_message]
- conversation_memory._ensure_initial_user_message(events, initial_user_action)
+ # Pass empty se... | tests/unit/memory/test_conversation_memory.py | 0 | Python | 1 | none | 16 | 51 | 51 | true | fix: Prevent old instructions from being re-executed after conversation condensation | 11,982 | All-Hands-AI/OpenHands | 55,974 | Python | nathannewyen | |
class EventService {
/**
* Respond to a confirmation request in a V1 conversation
* @param conversationId The conversation ID
* @param conversationUrl The conversation URL (e.g., "http://localhost:54928/api/conversations/...")
* @param request The confirmation response request
* @param sessionApiKey Se... | No issues found. | class EventService {
/**
* Respond to a confirmation request in a V1 conversation
* @param conversationId The conversation ID
* @param conversationUrl The conversation URL (e.g., "http://localhost:54928/api/conversations/...")
* @param request The confirmation response request
* @param sessionApiKey Se... | @@ -5,7 +5,6 @@ import type {
ConfirmationResponseRequest,
ConfirmationResponseResponse,
} from "./event-service.types";
-import { openHands } from "../open-hands-axios";
class EventService {
/**
@@ -38,11 +37,27 @@ class EventService {
return data;
}
- static async getEventCount(conversationId:... | frontend/src/api/event-service/event-service.api.ts | 0 | TypeScript | 1 | none | 16 | 51 | 51 | true | fix(frontend): fix fetching the number of events on the front end (v1 conversations) | 11,987 | All-Hands-AI/OpenHands | 55,974 | Python | hieptl | |
assert call_kwargs['llm'].usage_id == 'planning_condenser'
mock_llm.model_copy.assert_called_once()
# =============================================================================
# Tests for security analyzer helpers
# =============================================================================
@p... | No issues found. | assert call_kwargs['llm'].usage_id == 'planning_condenser'
mock_llm.model_copy.assert_called_once()
# =============================================================================
# Tests for security analyzer helpers
# =============================================================================
@p... | @@ -1,11 +1,13 @@
-"""Unit tests for git functionality in AppConversationServiceBase.
+"""Unit tests for git and security functionality in AppConversationServiceBase.
This module tests the git-related functionality, specifically the clone_or_init_git_repo method
and the recent bug fixes for git checkout operations.... | tests/unit/app_server/test_app_conversation_service_base.py | 0 | Python | 1 | none | 16 | 51 | 51 | true | feat: support security analyzer settings for v1 conversations | 12,008 | All-Hands-AI/OpenHands | 55,974 | Python | hieptl | |
// Clear any existing query data
mockQueryClient.clear();
renderSettingsScreen();
const navbar = await screen.findByTestId("settings-navbar");
sectionsToInclude.forEach((section) => {
const sectionElement = within(navbar).getByText(section, {
exact: false, // case insensitive
}... | No issues found. | // Clear any existing query data
mockQueryClient.clear();
renderSettingsScreen();
const navbar = await screen.findByTestId("settings-navbar");
sectionsToInclude.forEach((section) => {
const sectionElement = within(navbar).getByText(section, {
exact: false, // case insensitive
}... | @@ -1,4 +1,4 @@
-import { render, screen, within } from "@testing-library/react";
+import { render, screen, within, waitFor } from "@testing-library/react";
import { createRoutesStub } from "react-router";
import { describe, expect, it, vi } from "vitest";
import { QueryClientProvider } from "@tanstack/react-query";... | frontend/__tests__/routes/settings.test.tsx | 0 | TypeScript | 1 | none | 16 | 51 | 51 | true | feat(frontend): hide billing section in organization settings page for self-hosted (org support) | 12,019 | All-Hands-AI/OpenHands | 55,974 | Python | hieptl | |
import { I18nKey } from "#/i18n/declaration";
import OpenHandsLogo from "#/assets/branding/openhands-logo.svg?react";
import { TOSCheckbox } from "#/components/features/waitlist/tos-checkbox";
import { BrandButton } from "#/components/features/settings/brand-button";
import { ModalBackdrop } from "#/components/shared/m... | No issues found. | import { I18nKey } from "#/i18n/declaration";
import OpenHandsLogo from "#/assets/branding/openhands-logo.svg?react";
import { TOSCheckbox } from "#/components/features/waitlist/tos-checkbox";
import { BrandButton } from "#/components/features/settings/brand-button";
import { ModalBackdrop } from "#/components/shared/m... | @@ -1,66 +1,27 @@
import React from "react";
import { useTranslation } from "react-i18next";
-import { useNavigate, useSearchParams } from "react-router";
-import { useMutation } from "@tanstack/react-query";
-import { usePostHog } from "posthog-js/react";
+import { useSearchParams } from "react-router";
import { I1... | frontend/src/routes/accept-tos.tsx | 0 | TypeScript | 1 | none | 16 | 51 | 51 | true | refactor(frontend): Extracted useQuery and useMutation from the main branch | 12,031 | All-Hands-AI/OpenHands | 55,974 | Python | abhayymishraa | |
vi.mock("#/hooks/use-conversation-id", () => ({
useConversationId: () => ({ conversationId: "test-id" }),
}));
const wrapper = ({ children }: { children: React.ReactNode }) => (
<MemoryRouter>
<QueryClientProvider client={new QueryClient()}>
{children}
</QueryClientProvider>
</MemoryRouter>
);
con... | No issues found. | vi.mock("#/hooks/use-conversation-id", () => ({
useConversationId: () => ({ conversationId: "test-id" }),
}));
const wrapper = ({ children }: { children: React.ReactNode }) => (
<MemoryRouter>
<QueryClientProvider client={new QueryClient()}>
{children}
</QueryClientProvider>
</MemoryRouter>
);
con... | @@ -0,0 +1,71 @@
+import { render, screen } from "@testing-library/react";
+import { describe, it, expect, vi } from "vitest";
+import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
+import { MemoryRouter } from "react-router";
+import { AgentStatus } from "#/components/features/controls/agent-statu... | frontend/__tests__/components/features/conversation/agent-status.test.tsx | 0 | TypeScript | 1 | none | 16 | 51 | 51 | true | fix(frontend): Separate pause state from agent loading | 12,041 | All-Hands-AI/OpenHands | 55,974 | Python | Mariam-Saeed | |
max_iterations: 20,
llm_model: "gpt-4",
llm_api_key_for_byor: null,
llm_base_url: "https://api.openai.com",
status: "active",
},
0,
0, // First member (user_id: "1")
"Owner",
);
});
it("should show a remove option in the role dropdown and remove t... | No issues found. | max_iterations: 20,
llm_model: "gpt-4",
llm_api_key_for_byor: null,
llm_base_url: "https://api.openai.com",
status: "active",
},
0,
0, // First member (user_id: "1")
"Owner",
);
});
it("should show a remove option in the role dropdown and remove t... | @@ -61,9 +61,15 @@ describe("Manage Organization Members Route", () => {
// Set default mock for user (admin role has invite permission)
getMeSpy.mockResolvedValue({
- id: "1",
+ org_id: "1",
+ user_id: "1",
email: "test@example.com",
role: "admin",
+ llm_api_key: "********... | frontend/__tests__/routes/manage-organization-members.test.tsx | 0 | TypeScript | 1 | none | 16 | 51 | 51 | true | refactor(frontend): update organizationmember type (org support) | 12,054 | All-Hands-AI/OpenHands | 55,974 | Python | hieptl | |
isMessageEvent(event) && event.llm_message.role === "user";
/**
* Type guard function to check if an event is an action event
*/
export const isActionEvent = (event: OpenHandsEvent): event is ActionEvent =>
event.source === "agent" &&
"action" in event &&
event.action !== null &&
typeof event.action === "o... | No issues found. | isMessageEvent(event) && event.llm_message.role === "user";
/**
* Type guard function to check if an event is an action event
*/
export const isActionEvent = (event: OpenHandsEvent): event is ActionEvent =>
event.source === "agent" &&
"action" in event &&
event.action !== null &&
typeof event.action === "o... | @@ -54,7 +54,10 @@ export const isObservationEvent = (
): event is ObservationEvent =>
event.source === "environment" &&
"action_id" in event &&
- "observation" in event;
+ "observation" in event &&
+ event.observation !== null &&
+ typeof event.observation === "object" &&
+ "kind" in event.observation;
... | frontend/src/types/v1/type-guards.ts | 0 | TypeScript | 1 | none | 16 | 51 | 51 | true | fix(frontend): observation events and action events (v1 conversations) | 12,066 | All-Hands-AI/OpenHands | 55,974 | Python | hieptl | |
};
// Create a persistent reference that survives component unmounts
// This ensures terminal history is preserved when navigating away and back
const persistentLastCommandIndex = { current: 0 };
export const useTerminal = () => {
const commands = useCommandStore((state) => state.commands);
const terminal = React... | No issues found. | };
// Create a persistent reference that survives component unmounts
// This ensures terminal history is preserved when navigating away and back
const persistentLastCommandIndex = { current: 0 };
export const useTerminal = () => {
const commands = useCommandStore((state) => state.commands);
const terminal = React... | @@ -29,6 +29,47 @@ const renderCommand = (
}
};
+/**
+ * Check if the terminal is ready for fit operations.
+ * This prevents the "Cannot read properties of undefined (reading 'dimensions')" error
+ * that occurs when fit() is called on a terminal that is hidden, disposed, or not fully initialized.
+ */
+const ca... | frontend/src/hooks/use-terminal.ts | 0 | TypeScript | 1 | none | 16 | 51 | 51 | true | Fix xterm dimensions error with explicit checks instead of try-catch | 12,095 | All-Hands-AI/OpenHands | 55,974 | Python | neubig | |
# Execute
with patch('base62.encodebytes', return_value='test-sandbox-123'):
await remote_sandbox_service.start_sandbox()
# Verify runtime_class is included in request
call_args = remote_sandbox_service.httpx_client.request.call_args
request_data = call_args[1]['json... | No issues found. | # Execute
with patch('base62.encodebytes', return_value='test-sandbox-123'):
await remote_sandbox_service.start_sandbox()
# Verify runtime_class is included in request
call_args = remote_sandbox_service.httpx_client.request.call_args
request_data = call_args[1]['json... | @@ -331,7 +331,7 @@ async def test_to_sandbox_info_with_running_runtime(self, remote_sandbox_service
runtime_data = create_runtime_data(status='running', pod_status='ready')
# Execute
- sandbox_info = await remote_sandbox_service._to_sandbox_info(
+ sandbox_info = remote_sandbox_servic... | tests/unit/app_server/test_remote_sandbox_service.py | 0 | Python | 1 | none | 16 | 51 | 51 | true | fix: eliminate N+1 performance bug in RemoteSandboxService with batch endpoint | 12,105 | All-Hands-AI/OpenHands | 55,974 | Python | tofarr | |
import { getStatusColor, getStatusText } from "#/utils/utils";
import { useErrorMessageStore } from "#/stores/error-message-store";
export interface ServerStatusProps {
className?: string;
conversationStatus: ConversationStatus | null;
isPausing?: boolean;
}
export function ServerStatus({
className = "",
co... | No issues found. | import { getStatusColor, getStatusText } from "#/utils/utils";
import { useErrorMessageStore } from "#/stores/error-message-store";
export interface ServerStatusProps {
className?: string;
conversationStatus: ConversationStatus | null;
isPausing?: boolean;
}
export function ServerStatus({
className = "",
co... | @@ -1,11 +1,10 @@
import { useTranslation } from "react-i18next";
import DebugStackframeDot from "#/icons/debug-stackframe-dot.svg?react";
-import { I18nKey } from "#/i18n/declaration";
import { ConversationStatus } from "#/types/conversation-status";
import { AgentState } from "#/types/agent-state";
import { useA... | frontend/src/components/features/controls/server-status.tsx | 0 | TypeScript | 1 | none | 16 | 51 | 51 | true | feat(frontend): adding status indicator and unit test | 12,111 | All-Hands-AI/OpenHands | 55,974 | Python | HeyItsChloe | |
== ConversationTrigger.MICROAGENT_MANAGEMENT
)
assert (
call_args['git_provider'] is None
) # Should remain None since not set in create_microagent
@pytest.mark.asyncio
async def test_search_conversations_with_pr_number():
"""Test searching conv... | No issues found. | == ConversationTrigger.MICROAGENT_MANAGEMENT
)
assert (
call_args['git_provider'] is None
) # Should remain None since not set in create_microagent
@pytest.mark.asyncio
async def test_search_conversations_with_pr_number():
"""Test searching conv... | @@ -946,6 +946,10 @@ async def test_delete_conversation():
# Create a mock sandbox service
mock_sandbox_service = MagicMock()
+ # Create mock db_session and httpx_client
+ mock_db_session = AsyncMock()
+ mock_httpx_client = AsyncMock()
+
# Mock t... | tests/unit/server/data_models/test_conversation.py | 0 | Python | 1 | none | 16 | 51 | 51 | true | ALL-4636 Resolution for connection leaks | 12,144 | All-Hands-AI/OpenHands | 55,974 | Python | tofarr | |
});
renderUserContextMenu({ type: "member", onClose: vi.fn });
await waitFor(() => {
// Other nav items should still be visible
expect(screen.getByText("SETTINGS$NAV_USER")).toBeInTheDocument();
// LLM settings (to: "/settings") should NOT be visible
expect(
... | No issues found. | });
renderUserContextMenu({ type: "member", onClose: vi.fn });
await waitFor(() => {
// Other nav items should still be visible
expect(screen.getByText("SETTINGS$NAV_USER")).toBeInTheDocument();
// LLM settings (to: "/settings") should NOT be visible
expect(
... | @@ -54,7 +54,7 @@ describe("UserContextMenu", () => {
});
it("should render the default context items for a user", () => {
- renderUserContextMenu({ type: "user", onClose: vi.fn });
+ renderUserContextMenu({ type: "member", onClose: vi.fn });
screen.getByTestId("org-selector");
screen.getByTex... | frontend/__tests__/components/features/user/user-context-menu.test.tsx | 0 | TypeScript | 1 | none | 16 | 51 | 51 | true | Refactor(frontend):change the role-name user to member | 12,146 | All-Hands-AI/OpenHands | 55,974 | Python | AVBharath10 | |
import { describe, expect, it } from "vitest";
import { useSelectedOrganizationStore } from "#/stores/selected-organization-store";
describe("useSelectedOrganizationStore", () => {
it("should have null as initial orgId", () => {
const { result } = renderHook(() => useSelectedOrganizationStore());
expect(resu... | No issues found. | import { describe, expect, it } from "vitest";
import { useSelectedOrganizationStore } from "#/stores/selected-organization-store";
describe("useSelectedOrganizationStore", () => {
it("should have null as initial orgId", () => {
const { result } = renderHook(() => useSelectedOrganizationStore());
expect(resu... | @@ -0,0 +1,51 @@
+import { act, renderHook } from "@testing-library/react";
+import { describe, expect, it } from "vitest";
+import { useSelectedOrganizationStore } from "#/stores/selected-organization-store";
+
+describe("useSelectedOrganizationStore", () => {
+ it("should have null as initial orgId", () => {
+ co... | frontend/__tests__/stores/selected-organization-store.test.ts | 0 | TypeScript | 1 | none | 16 | 51 | 51 | true | refactor(frontend): migrate selected org ID to Zustand | 12,153 | All-Hands-AI/OpenHands | 55,974 | Python | smosco | |
it("should call onClose the modal when the close button is clicked", async () => {
const onCloseMock = vi.fn();
renderInviteOrganizationMemberModal({ onClose: onCloseMock });
const modal = screen.getByTestId("invite-modal");
const closeButton = within(modal).getByRole("button", {
name: /cancel/... | No issues found. | it("should call onClose the modal when the close button is clicked", async () => {
const onCloseMock = vi.fn();
renderInviteOrganizationMemberModal({ onClose: onCloseMock });
const modal = screen.getByTestId("invite-modal");
const closeButton = within(modal).getByRole("button", {
name: /cancel/... | @@ -1,9 +1,14 @@
import { within, screen, render } from "@testing-library/react";
import userEvent from "@testing-library/user-event";
-import { afterEach, describe, expect, it, vi } from "vitest";
+import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
import { QueryClientProvider, QueryClient } ... | frontend/__tests__/components/features/org/invite-organization-member-modal.test.tsx | 0 | TypeScript | 1 | none | 16 | 51 | 51 | true | hotfix(frontend): org naming consistency | 12,164 | All-Hands-AI/OpenHands | 55,974 | Python | amanape | |
return props.children;
},
}));
describe("PostHogWrapper", () => {
beforeEach(() => {
vi.clearAllMocks();
// Reset URL hash
window.location.hash = "";
// Mock the config fetch
// @ts-expect-error - partial mock
vi.spyOn(OptionService, "getConfig").mockResolvedValue({
POSTHOG_CLIENT... | No issues found. | return props.children;
},
}));
describe("PostHogWrapper", () => {
beforeEach(() => {
vi.clearAllMocks();
// Reset URL hash
window.location.hash = "";
// Mock the config fetch
// @ts-expect-error - partial mock
vi.spyOn(OptionService, "getConfig").mockResolvedValue({
POSTHOG_CLIENT... | @@ -0,0 +1,69 @@
+import { describe, it, expect, vi, beforeEach } from "vitest";
+import { render, screen } from "@testing-library/react";
+import { PostHogWrapper } from "#/components/providers/posthog-wrapper";
+import OptionService from "#/api/option-service/option-service.api";
+
+// Mock PostHogProvider to capture... | frontend/__tests__/components/providers/posthog-wrapper.test.tsx | 0 | TypeScript | 1 | none | 16 | 51 | 51 | true | chore(frontend): Cross-domain PostHog tracking | 12,166 | All-Hands-AI/OpenHands | 55,974 | Python | amanape | |
)
result = get_summary_for_agent_state([observation], self.conversation_link)
# Test the exact message format
assert 'rate limited' in result.lower()
assert 'try again later' in result.lower()
# RATE_LIMITED doesn't include conversation link in response
assert s... | No issues found. | )
result = get_summary_for_agent_state([observation], self.conversation_link)
# Test the exact message format
assert 'rate limited' in result.lower()
assert 'try again later' in result.lower()
# RATE_LIMITED doesn't include conversation link in response
assert s... | @@ -4,7 +4,9 @@
import pytest
from integrations.utils import (
+ HOST_URL,
append_conversation_footer,
+ get_session_expired_message,
get_summary_for_agent_state,
)
@@ -164,6 +166,68 @@ def test_rate_limited_specific_message(self):
assert self.conversation_link not in result
+class T... | enterprise/tests/unit/integrations/test_utils.py | 0 | Python | 1 | none | 16 | 51 | 51 | true | Handle expired Keycloak session with user-friendly error message | 12,168 | All-Hands-AI/OpenHands | 55,974 | Python | xingyaoww | |
import { useTranslation } from "react-i18next";
import { I18nKey } from "#/i18n/declaration";
import ListIcon from "#/icons/list.svg?react";
import { StyledTooltip } from "#/components/shared/buttons/styled-tooltip";
import { cn } from "#/utils/utils";
interface ConversationPanelButtonProps {
isOpen: boolean;
onCl... | No issues found. | import { useTranslation } from "react-i18next";
import { I18nKey } from "#/i18n/declaration";
import ListIcon from "#/icons/list.svg?react";
import { StyledTooltip } from "#/components/shared/buttons/styled-tooltip";
import { cn } from "#/utils/utils";
interface ConversationPanelButtonProps {
isOpen: boolean;
onCl... | @@ -1,7 +1,7 @@
import { useTranslation } from "react-i18next";
import { I18nKey } from "#/i18n/declaration";
import ListIcon from "#/icons/list.svg?react";
-import { TooltipButton } from "./tooltip-button";
+import { StyledTooltip } from "#/components/shared/buttons/styled-tooltip";
import { cn } from "#/utils/uti... | frontend/src/components/shared/buttons/conversation-panel-button.tsx | 0 | TypeScript | 1 | none | 16 | 45 | 45 | true | fix: prevent nested buttons in tooltip button | 12,177 | All-Hands-AI/OpenHands | 55,974 | Python | AVBharath10 | |
import { describe, it, expect } from "vitest";
import { adaptSystemMessage } from "#/utils/system-message-adapter";
import { EventState } from "#/stores/use-event-store";
const v1Event: EventState["events"] = [
{
id: "v1-id",
timestamp: "2025-12-30T12:00:00Z",
source: "agent",
system_prompt: {
... | No issues found. | import { describe, it, expect } from "vitest";
import { adaptSystemMessage } from "#/utils/system-message-adapter";
import { EventState } from "#/stores/use-event-store";
const v1Event: EventState["events"] = [
{
id: "v1-id",
timestamp: "2025-12-30T12:00:00Z",
source: "agent",
system_prompt: {
... | @@ -0,0 +1,37 @@
+import { describe, it, expect } from "vitest";
+import { adaptSystemMessage } from "#/utils/system-message-adapter";
+import { EventState } from "#/stores/use-event-store";
+
+const v1Event: EventState["events"] = [
+ {
+ id: "v1-id",
+ timestamp: "2025-12-30T12:00:00Z",
+ source: "agent",
+... | frontend/__tests__/utils/system-message-adapter.test.ts | 0 | TypeScript | 1 | none | 16 | 38 | 38 | true | fix(frontend): Agent Tools & Metadata not available for V1 conversations | 12,180 | All-Hands-AI/OpenHands | 55,974 | Python | kub938 | |
)
# Assert: Default model is used (whitespace treated as no model)
assert updated_settings is not None
expected_default = get_default_litellm_model()
assert updated_settings.llm_model == expected_default
@pytest.mark.asyncio
async def test_update_settings_with_litellm_default_preserves_custom... | No issues found. | )
# Assert: Default model is used (whitespace treated as no model)
assert updated_settings is not None
expected_default = get_default_litellm_model()
assert updated_settings.llm_model == expected_default
@pytest.mark.asyncio
async def test_update_settings_with_litellm_default_preserves_custom... | @@ -981,7 +981,7 @@ async def test_has_custom_settings_matches_old_default_model(settings_store):
),
):
settings = Settings(
- llm_model='litellm_proxy/prod/claude-3-5-sonnet-20241022',
+ llm_model='litellm_proxy/claude-3-5-sonnet-20241022',
llm_base_url='http:/... | enterprise/tests/unit/test_saas_settings_store.py | 0 | Python | 1 | none | 16 | 51 | 51 | true | Remove prod/ prefix from litellm proxy model path | 12,200 | All-Hands-AI/OpenHands | 55,974 | Python | xingyaoww | |
mock_client.__aexit__.return_value = None
mock_client.get.side_effect = httpx.NetworkError('Network error')
mock_client_class.return_value = mock_client
# Act
result = await verify_byor_key_in_litellm(byor_key, user_id)
# Assert
assert result is False
@pyte... | No issues found. | mock_client.__aexit__.return_value = None
mock_client.get.side_effect = httpx.NetworkError('Network error')
mock_client_class.return_value = mock_client
# Act
result = await verify_byor_key_in_litellm(byor_key, user_id)
# Assert
assert result is False
@pyte... | @@ -0,0 +1,330 @@
+"""Unit tests for API keys routes, focusing on BYOR key validation and retrieval."""
+
+from unittest.mock import AsyncMock, MagicMock, patch
+
+import httpx
+import pytest
+from fastapi import HTTPException
+from server.routes.api_keys import (
+ get_llm_api_key_for_byor,
+ verify_byor_key_in_... | enterprise/tests/unit/server/routes/test_api_keys.py | 0 | Python | 1 | none | 16 | 51 | 51 | true | fix(backend): invalid api key | 12,217 | All-Hands-AI/OpenHands | 55,974 | Python | hieptl | |
import React from "react";
const SKELETON_PATTERN = [
{ width: "w-[25%]", height: "h-4", align: "justify-end" },
{ width: "w-[60%]", height: "h-4", align: "justify-start" },
{ width: "w-[45%]", height: "h-4", align: "justify-start" },
{ width: "w-[65%]", height: "h-20", align: "justify-start" },
{ width: "w-... | No issues found. | import React from "react";
const SKELETON_PATTERN = [
{ width: "w-[25%]", height: "h-4", align: "justify-end" },
{ width: "w-[60%]", height: "h-4", align: "justify-start" },
{ width: "w-[45%]", height: "h-4", align: "justify-start" },
{ width: "w-[65%]", height: "h-20", align: "justify-start" },
{ width: "w-... | @@ -0,0 +1,37 @@
+import React from "react";
+
+const SKELETON_PATTERN = [
+ { width: "w-[25%]", height: "h-4", align: "justify-end" },
+ { width: "w-[60%]", height: "h-4", align: "justify-start" },
+ { width: "w-[45%]", height: "h-4", align: "justify-start" },
+ { width: "w-[65%]", height: "h-20", align: "justify-... | frontend/src/components/features/chat/chat-messages-skeleton.tsx | 0 | TypeScript | 1 | none | 16 | 38 | 38 | true | feat: add chat message skeletons and improve routing stability | 12,223 | All-Hands-AI/OpenHands | 55,974 | Python | Ryanakml | |
const mockUseUserConversation = vi.mocked(useUserConversation);
const mockUseParams = vi.mocked(useParams);
beforeEach(() => {
// @ts-expect-error - only returning partial config for test
mockUseUserConversation.mockReturnValue({ data: null });
mockUseParams.mockReturnValue({});
});
it("should r... | No issues found. | const mockUseUserConversation = vi.mocked(useUserConversation);
const mockUseParams = vi.mocked(useParams);
beforeEach(() => {
// @ts-expect-error - only returning partial config for test
mockUseUserConversation.mockReturnValue({ data: null });
mockUseParams.mockReturnValue({});
});
it("should r... | @@ -0,0 +1,105 @@
+import { renderHook, waitFor } from "@testing-library/react";
+import { beforeEach, describe, expect, it, vi } from "vitest";
+import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
+import { useParams } from "react-router";
+import OptionService from "#/api/option-service/option-s... | frontend/src/hooks/use-app-title.test.tsx | 0 | TypeScript | 1 | none | 16 | 51 | 51 | true | feat(frontend): create `useAppTitle` hook for dynamic document titles | 12,224 | All-Hands-AI/OpenHands | 55,974 | Python | amanape | |
import { render, screen } from "@testing-library/react";
import { describe, it, expect } from "vitest";
import { ConversationCardSkeleton } from "./conversation-card-skeleton";
describe("ConversationCardSkeleton", () => {
it("renders skeleton card", () => {
render(<ConversationCardSkeleton />);
expect(
... | No issues found. | import { render, screen } from "@testing-library/react";
import { describe, it, expect } from "vitest";
import { ConversationCardSkeleton } from "./conversation-card-skeleton";
describe("ConversationCardSkeleton", () => {
it("renders skeleton card", () => {
render(<ConversationCardSkeleton />);
expect(
... | @@ -0,0 +1,12 @@
+import { render, screen } from "@testing-library/react";
+import { describe, it, expect } from "vitest";
+import { ConversationCardSkeleton } from "./conversation-card-skeleton";
+
+describe("ConversationCardSkeleton", () => {
+ it("renders skeleton card", () => {
+ render(<ConversationCardSkeleto... | frontend/src/components/features/conversation-panel/conversation-card/conversation-card-skeleton.test.tsx | 0 | TypeScript | 1 | none | 16 | 13 | 13 | true | Replace conversation loading spinner with skeleton cards | 12,230 | All-Hands-AI/OpenHands | 55,974 | Python | adithya-naik | |
sort='updated',
order='desc',
public=True,
app_mode=AppMode.OPENHANDS,
)
# Verify the correct workspace/repo combination was extracted and passed
assert len(repositories) == 1
assert repositories[0].full_name == 'workspace/repo'
mo... | No issues found. | sort='updated',
order='desc',
public=True,
app_mode=AppMode.OPENHANDS,
)
# Verify the correct workspace/repo combination was extracted and passed
assert len(repositories) == 1
assert repositories[0].full_name == 'workspace/repo'
mo... | @@ -43,7 +43,7 @@ async def test_search_repositories_url_parsing_standard_url(bitbucket_service):
sort='updated',
order='desc',
public=True,
- app_mode=AppMode.OSS,
+ app_mode=AppMode.OPENHANDS,
)
# Verify the correct workspace/repo combin... | tests/unit/integrations/bitbucket/test_bitbucket_repos.py | 0 | Python | 1 | none | 16 | 51 | 51 | true | Clarify OpenHands naming (replace “OSS” wording in docs and backend) | 12,235 | All-Hands-AI/OpenHands | 55,974 | Python | enyst | |
vi.mock("react-i18next", () => ({
useTranslation: () => ({
t: (key: string) => key,
}),
}));
vi.mock("#/hooks/query/use-unified-get-git-changes");
vi.mock("#/hooks/use-agent-state");
vi.mock("#/hooks/use-conversation-id", () => ({
useConversationId: () => ({ conversationId: "test-id" }),
}));
const wrapper ... | No issues found. | vi.mock("react-i18next", () => ({
useTranslation: () => ({
t: (key: string) => key,
}),
}));
vi.mock("#/hooks/query/use-unified-get-git-changes");
vi.mock("#/hooks/use-agent-state");
vi.mock("#/hooks/use-conversation-id", () => ({
useConversationId: () => ({ conversationId: "test-id" }),
}));
const wrapper ... | @@ -0,0 +1,68 @@
+import { render, screen } from "@testing-library/react";
+import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
+import { describe, expect, it, vi } from "vitest";
+import { MemoryRouter } from "react-router";
+import GitChanges from "#/routes/changes-tab";
+import { useUnifiedGetG... | frontend/__tests__/routes/changes-tab.test.tsx | 0 | TypeScript | 1 | none | 16 | 51 | 51 | true | feat: add empty state to Changes tab with icon and message | 12,237 | All-Hands-AI/OpenHands | 55,974 | Python | naaa760 | |
# Assert
mock_create.assert_called_once_with('none')
httpx_client.post.assert_not_called()
class DummyAnalyzer:
"""Simple analyzer stub for testing model_dump contract."""
def __init__(self, payload: dict):
self._payload = payload
def model_dump(self) -> dict:
return self._p... | No issues found. |
# Assert
mock_create.assert_called_once_with('none')
httpx_client.post.assert_not_called()
class DummyAnalyzer:
"""Simple analyzer stub for testing model_dump contract."""
def __init__(self, payload: dict):
self._payload = payload
def model_dump(self) -> dict:
return self._p... | @@ -320,9 +320,9 @@ def test_create_condenser_default_agent_with_none_max_size(mock_condenser_class)
# Assert
mock_condenser_class.assert_called_once()
call_kwargs = mock_condenser_class.call_args[1]
- # When condenser_max_size is None, max_size should not be passed (uses SDK default o... | tests/unit/app_server/test_app_conversation_service_base.py | 0 | Python | 1 | none | 16 | 51 | 51 | true | Bump condenser defaults: max_size 120->240 | 12,267 | All-Hands-AI/OpenHands | 55,974 | Python | xingyaoww | |
@pytest.mark.asyncio
async def test_list_user_orgs_with_pagination(mock_app_list):
"""
GIVEN: User has multiple organizations
WHEN: GET /api/organizations is called with pagination params
THEN: Paginated results are returned with next_page_id
"""
# Arrange
org1 = Org(
id=uuid.uuid4... | No issues found. |
@pytest.mark.asyncio
async def test_list_user_orgs_with_pagination(mock_app_list):
"""
GIVEN: User has multiple organizations
WHEN: GET /api/organizations is called with pagination params
THEN: Paginated results are returned with next_page_id
"""
# Arrange
org1 = Org(
id=uuid.uuid4... | @@ -20,6 +20,7 @@
LiteLLMIntegrationError,
OrgDatabaseError,
OrgNameExistsError,
+ OrgNotFoundError,
)
from server.routes.orgs import org_router
from storage.org import Org
@@ -650,3 +651,274 @@ async def test_list_user_orgs_all_fields_present(mock_app_list):
as... | enterprise/tests/unit/server/routes/test_orgs.py | 0 | Python | 1 | none | 16 | 51 | 51 | true | feat(backend): develop get /api/organizations/{orgid} api | 12,274 | All-Hands-AI/OpenHands | 55,974 | Python | hieptl | |
shared_conversation_info = (
await self.shared_conversation_info_service.get_shared_conversation_info(
conversation_id
)
)
if shared_conversation_info is None:
return None
return GoogleCloudEventService(
bucket=bucket,
... | No issues found. | shared_conversation_info = (
await self.shared_conversation_info_service.get_shared_conversation_info(
conversation_id
)
)
if shared_conversation_info is None:
return None
return GoogleCloudEventService(
bucket=bucket,
... | @@ -9,6 +9,7 @@
from __future__ import annotations
import logging
+import os
from dataclasses import dataclass
from datetime import datetime
from pathlib import Path
@@ -20,6 +21,7 @@
from google.cloud.storage.bucket import Bucket
from google.cloud.storage.client import Client
from more_itertools import bucke... | enterprise/server/sharing/google_cloud_shared_event_service.py | 0 | Python | 1 | none | 16 | 51 | 51 | true | Fix GoogleCloudSharedEventServiceInjector missing bucket_name field and add tests | 12,280 | All-Hands-AI/OpenHands | 55,974 | Python | tofarr | |
}
}
return window.location.host;
}
/**
* Extracts the path prefix from conversation URL (everything before /api/conversations)
* This is needed for proxy deployments where agent-servers are accessed via paths like /runtime/{port}/
* @param conversationUrl The conversation URL (e.g., "http://localhost:3000/r... | No issues found. | }
}
return window.location.host;
}
/**
* Extracts the path prefix from conversation URL (everything before /api/conversations)
* This is needed for proxy deployments where agent-servers are accessed via paths like /runtime/{port}/
* @param conversationUrl The conversation URL (e.g., "http://localhost:3000/r... | @@ -17,17 +17,39 @@ export function extractBaseHost(
return window.location.host;
}
+/**
+ * Extracts the path prefix from conversation URL (everything before /api/conversations)
+ * This is needed for proxy deployments where agent-servers are accessed via paths like /runtime/{port}/
+ * @param conversationUrl Th... | frontend/src/utils/websocket-url.ts | 0 | TypeScript | 1 | none | 16 | 51 | 51 | true | fix(frontend): preserve path prefix in WebSocket URL for proxy deployments | 12,284 | All-Hands-AI/OpenHands | 55,974 | Python | zxkane | |
const createWrapper = (conversationId: string) => {
return ({ children }: { children: React.ReactNode }) => (
<MemoryRouter initialEntries={[`/conversations/${conversationId}`]}>
<QueryClientProvider client={new QueryClient()}>
{children}
</QueryClientProvider>
</MemoryRouter>
);
};
de... | No issues found. |
const createWrapper = (conversationId: string) => {
return ({ children }: { children: React.ReactNode }) => (
<MemoryRouter initialEntries={[`/conversations/${conversationId}`]}>
<QueryClientProvider client={new QueryClient()}>
{children}
</QueryClientProvider>
</MemoryRouter>
);
};
de... | @@ -0,0 +1,90 @@
+import { render, screen } from "@testing-library/react";
+import userEvent from "@testing-library/user-event";
+import { describe, it, expect, vi, beforeEach } from "vitest";
+import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
+import { MemoryRouter } from "react-router";
+impor... | frontend/__tests__/components/features/conversation/conversation-tabs.test.tsx | 0 | TypeScript | 1 | none | 16 | 51 | 51 | true | fix: clean up conversation localStorage on delete and migration | 12,300 | All-Hands-AI/OpenHands | 55,974 | Python | mo-abdulai | |
/>,
);
const showAgentToolsButton = screen.getByTestId("show-agent-tools-button");
await user.click(showAgentToolsButton);
expect(onShowAgentTools).toHaveBeenCalledTimes(1);
});
it("should call show microagents handler when show microagents button is clicked", async () => {
const user =... | No issues found. | />,
);
const showAgentToolsButton = screen.getByTestId("show-agent-tools-button");
await user.click(showAgentToolsButton);
expect(onShowAgentTools).toHaveBeenCalledTimes(1);
});
it("should call show microagents handler when show microagents button is clicked", async () => {
const user =... | @@ -1,22 +1,49 @@
-import { screen, within } from "@testing-library/react";
+import { screen, within, waitFor } from "@testing-library/react";
import userEvent from "@testing-library/user-event";
-import { afterEach, beforeAll, describe, expect, it, vi } from "vitest";
+import {
+ afterEach,
+ beforeAll,
+ beforeEa... | frontend/__tests__/components/features/conversation/conversation-name.test.tsx | 0 | TypeScript | 1 | none | 16 | 51 | 51 | true | feat(frontend): improve public share menu behavior | 12,345 | All-Hands-AI/OpenHands | 55,974 | Python | tofarr | |
import { render, screen } from "@testing-library/react";
import userEvent from "@testing-library/user-event";
import { describe, expect, it, vi } from "vitest";
import { ErrorMessageBanner } from "#/components/features/chat/error-message-banner";
describe("ErrorMessageBanner", () => {
it("calls onDismiss when the cl... | No issues found. | import { render, screen } from "@testing-library/react";
import userEvent from "@testing-library/user-event";
import { describe, expect, it, vi } from "vitest";
import { ErrorMessageBanner } from "#/components/features/chat/error-message-banner";
describe("ErrorMessageBanner", () => {
it("calls onDismiss when the cl... | @@ -0,0 +1,34 @@
+import { render, screen } from "@testing-library/react";
+import userEvent from "@testing-library/user-event";
+import { describe, expect, it, vi } from "vitest";
+import { ErrorMessageBanner } from "#/components/features/chat/error-message-banner";
+
+describe("ErrorMessageBanner", () => {
+ it("cal... | frontend/__tests__/components/chat/error-message-banner.test.tsx | 0 | TypeScript | 1 | none | 16 | 35 | 35 | true | fix(frontend): dismissible & expandable error banner | 12,354 | All-Hands-AI/OpenHands | 55,974 | Python | VedantMadane | |
with (
patch(
'server.auth.token_manager.TokenManager.get_user_info_from_user_id',
AsyncMock(return_value={'email': 'user@example.com'}),
),
patch('storage.saas_settings_store.session_maker', session_maker),
):
# Act: Update settings with LiteLLM defaults... | No issues found. |
with (
patch(
'server.auth.token_manager.TokenManager.get_user_info_from_user_id',
AsyncMock(return_value={'email': 'user@example.com'}),
),
patch('storage.saas_settings_store.session_maker', session_maker),
):
# Act: Update settings with LiteLLM defaults... | @@ -65,6 +65,15 @@ def mock_stripe():
yield
+@pytest.fixture
+def mock_redis_client():
+ """Mock Redis client for testing create_default_settings locking."""
+ mock_redis = AsyncMock()
+ # By default, allow proceeding with create (lock acquired successfully)
+ mock_redis.set = AsyncMock(return_... | enterprise/tests/unit/test_saas_settings_store.py | 0 | Python | 1 | none | 16 | 51 | 51 | true | Guard User Creation with Redis based Lock | 12,381 | All-Hands-AI/OpenHands | 55,974 | Python | tofarr | |
}),
);
// Verify error message store is initially empty
expect(useErrorMessageStore.getState().errorMessage).toBeNull();
// Render with WebSocket context (minimal component just to trigger connection)
renderWithWebSocketContext(
<ConnectionStatusComponent />,
conv... | No issues found. | }),
);
// Verify error message store is initially empty
expect(useErrorMessageStore.getState().errorMessage).toBeNull();
// Render with WebSocket context (minimal component just to trigger connection)
renderWithWebSocketContext(
<ConnectionStatusComponent />,
conv... | @@ -15,10 +15,11 @@ import { MemoryRouter, Route, Routes } from "react-router";
import { useOptimisticUserMessageStore } from "#/stores/optimistic-user-message-store";
import { useBrowserStore } from "#/stores/browser-store";
import { useCommandStore } from "#/stores/command-store";
+import { useErrorMessageStore } ... | frontend/__tests__/conversation-websocket-handler.test.tsx | 0 | TypeScript | 1 | none | 16 | 51 | 51 | true | fix(frontend): clear error banner on successful V1 WebSocket events | 12,398 | All-Hands-AI/OpenHands | 55,974 | Python | amanape | |
() => HttpResponse.json(2),
),
wsLink.addEventListener("connection", ({ client, server }) => {
server.connect();
// Send a ConversationErrorEvent first (this sets the error banner)
const mockConversationErrorEvent = createMockConversationErrorEvent();
c... | No issues found. | () => HttpResponse.json(2),
),
wsLink.addEventListener("connection", ({ client, server }) => {
server.connect();
// Send a ConversationErrorEvent first (this sets the error banner)
const mockConversationErrorEvent = createMockConversationErrorEvent();
c... | @@ -20,6 +20,7 @@ import {
createMockMessageEvent,
createMockUserMessageEvent,
createMockConversationErrorEvent,
+ createMockAgentErrorEvent,
createMockBrowserObservationEvent,
createMockBrowserNavigateActionEvent,
createMockExecuteBashActionEvent,
@@ -315,6 +316,36 @@ describe("Conversation WebSocke... | frontend/__tests__/conversation-websocket-handler.test.tsx | 0 | TypeScript | 1 | none | 16 | 51 | 51 | true | fix(frontend): show friendly message for budget/credit errors in V1 conversations | 12,401 | All-Hands-AI/OpenHands | 55,974 | Python | neubig | |
last_used_at: null,
},
];
const apiKeys = new Map<string, ApiKey>(
DEFAULT_API_KEYS.map((key) => [key.id, key]),
);
export const API_KEYS_HANDLERS = [
// GET /api/keys - List all API keys
http.get("/api/keys", () => HttpResponse.json(Array.from(apiKeys.values()))),
// POST /api/keys - Create a new API ... | No issues found. | last_used_at: null,
},
];
const apiKeys = new Map<string, ApiKey>(
DEFAULT_API_KEYS.map((key) => [key.id, key]),
);
export const API_KEYS_HANDLERS = [
// GET /api/keys - List all API keys
http.get("/api/keys", () => HttpResponse.json(Array.from(apiKeys.values()))),
// POST /api/keys - Create a new API ... | @@ -0,0 +1,86 @@
+import { http, HttpResponse } from "msw";
+import { ApiKey, CreateApiKeyResponse } from "#/api/api-keys";
+
+let nextId = 2;
+
+const DEFAULT_API_KEYS: ApiKey[] = [
+ {
+ id: "1",
+ name: "My Dev Key",
+ prefix: "oh_dev_",
+ created_at: "2025-12-01T10:00:00Z",
+ last_used_at: "2026-02-... | frontend/src/mocks/api-keys-handlers.ts | 0 | TypeScript | 1 | none | 16 | 51 | 51 | true | feat(frontend): add mutateWithToast utility for standardized mutation toast handling | 12,433 | All-Hands-AI/OpenHands | 55,974 | Python | eureka928 | |
) -> tuple[Any, dict]:
try:
async with httpx.AsyncClient(verify=httpx_verify_option()) as client:
headers = await self._get_headers()
response = await self.execute_request(
client=client,
url=url,
headers... | No issues found. | ) -> tuple[Any, dict]:
try:
async with httpx.AsyncClient(verify=httpx_verify_option()) as client:
headers = await self._get_headers()
response = await self.execute_request(
client=client,
url=url,
headers... | @@ -57,7 +57,9 @@ def __init__(
self.base_url = self.BASE_URL # Backwards compatibility for existing usage
parsed = urlparse(self.BASE_URL)
self.base_domain = parsed.netloc or self.DEFAULT_DOMAIN
- self.web_base_url = f'https://{self.base_domain}'.rstrip('/')
+ # Preserve the p... | openhands/integrations/forgejo/service/base.py | 0 | Python | 1 | none | 16 | 51 | 51 | true | fix: preserve HTTP protocol for self-hosted Gitea/Forgejo instances | 12,439 | All-Hands-AI/OpenHands | 55,974 | Python | MkDev11 | |
) as mock_cleanup:
# Execute
result = await service.resume_sandbox('oh-test-abc123')
# Verify
assert result is True
mock_container.unpause.assert_called_once()
mock_container.start.assert_not_called()
# Verify cleanup was called with the correct l... | No issues found. | ) as mock_cleanup:
# Execute
result = await service.resume_sandbox('oh-test-abc123')
# Verify
assert result is True
mock_container.unpause.assert_called_once()
mock_container.start.assert_not_called()
# Verify cleanup was called with the correct l... | @@ -1181,6 +1181,24 @@ def test_custom_configuration_combined(self):
assert injector.host_port == 4000
assert injector.container_url_pattern == 'http://192.168.1.100:{port}'
+ def test_use_host_network_default_value(self):
+ """Test that use_host_network field defaults to False."""
+ ... | tests/unit/app_server/test_docker_sandbox_service.py | 0 | Python | 1 | none | 16 | 51 | 51 | true | feat: add host network support for V1 DockerSandboxService | 12,445 | All-Hands-AI/OpenHands | 55,974 | Python | MkDev11 | |
from datetime import datetime
from pydantic import BaseModel
from openhands.agent_server.env_parser import DiscriminatedUnionMixin
from openhands.integrations.service_types import ProviderType
from openhands.server.types import AppMode
class WebClientFeatureFlags(BaseModel):
enable_billing: bool = False
hid... | No issues found. | from datetime import datetime
from pydantic import BaseModel
from openhands.agent_server.env_parser import DiscriminatedUnionMixin
from openhands.integrations.service_types import ProviderType
from openhands.server.types import AppMode
class WebClientFeatureFlags(BaseModel):
enable_billing: bool = False
hid... | @@ -0,0 +1,27 @@
+from datetime import datetime
+
+from pydantic import BaseModel
+
+from openhands.agent_server.env_parser import DiscriminatedUnionMixin
+from openhands.integrations.service_types import ProviderType
+from openhands.server.types import AppMode
+
+
+class WebClientFeatureFlags(BaseModel):
+ enable_b... | openhands/app_server/web_client/web_client_models.py | 0 | Python | 1 | none | 16 | 28 | 28 | true | (Backend) New Config Endpoint | 12,460 | All-Hands-AI/OpenHands | 55,974 | Python | tofarr | |
)
# Assert
# Should proceed with normal flow despite exception (fail open)
assert isinstance(result, RedirectResponse)
assert result.status_code == 302
@pytest.mark.asyncio
async def test_keycloak_callback_no_duplicate_email(mock_request):
"""Test keycloak_callback when no... | No issues found. | )
# Assert
# Should proceed with normal flow despite exception (fail open)
assert isinstance(result, RedirectResponse)
assert result.status_code == 302
@pytest.mark.asyncio
async def test_keycloak_callback_no_duplicate_email(mock_request):
"""Test keycloak_callback when no... | @@ -150,7 +150,7 @@ async def test_keycloak_callback_user_not_allowed(mock_request):
mock_user.id = 'test_user_id'
mock_user.current_org_id = 'test_org_id'
mock_user.accepted_tos = None
- mock_user_store.get_user_by_id.return_value = mock_user
+ mock_user_store.get_user_by_id_as... | enterprise/tests/unit/test_auth_routes.py | 0 | Python | 1 | none | 16 | 51 | 51 | true | Fix asyncio event loop conflict in get_user_by_id | 12,475 | All-Hands-AI/OpenHands | 55,974 | Python | chuckbutkus | |
import { useQuery } from "@tanstack/react-query";
import EventService from "#/api/event-service/event-service.api";
import { useUserConversation } from "#/hooks/query/use-user-conversation";
export const useConversationHistory = (conversationId?: string) => {
const { data: conversation } = useUserConversation(conver... | No issues found. | import { useQuery } from "@tanstack/react-query";
import EventService from "#/api/event-service/event-service.api";
import { useUserConversation } from "#/hooks/query/use-user-conversation";
export const useConversationHistory = (conversationId?: string) => {
const { data: conversation } = useUserConversation(conver... | @@ -0,0 +1,22 @@
+import { useQuery } from "@tanstack/react-query";
+import EventService from "#/api/event-service/event-service.api";
+import { useUserConversation } from "#/hooks/query/use-user-conversation";
+
+export const useConversationHistory = (conversationId?: string) => {
+ const { data: conversation } = use... | frontend/src/hooks/query/use-conversation-history.ts | 0 | TypeScript | 1 | none | 16 | 23 | 23 | true | feat: preload conversation history before websocket connection | 12,488 | All-Hands-AI/OpenHands | 55,974 | Python | mo-abdulai | |
) {
fetchNextPage();
}
},
[hasNextPage, isFetchingNextPage, fetchNextPage],
);
// Downshift configuration
const {
isOpen,
selectedItem,
highlightedIndex,
getInputProps,
getItemProps,
getMenuProps,
getToggleButtonProps,
} = useCombobox({
items: filtere... | No issues found. | ) {
fetchNextPage();
}
},
[hasNextPage, isFetchingNextPage, fetchNextPage],
);
// Downshift configuration
const {
isOpen,
selectedItem,
highlightedIndex,
getInputProps,
getItemProps,
getMenuProps,
getToggleButtonProps,
} = useCombobox({
items: filtere... | @@ -87,16 +87,6 @@ export function GitBranchDropdown({
[onBranchSelect],
);
- // Handle input value change
- const handleInputValueChange = useCallback(
- ({ inputValue: newInputValue }: { inputValue?: string }) => {
- if (newInputValue !== undefined) {
- setInputValue(newInputValue);
- ... | frontend/src/components/features/home/git-branch-dropdown/git-branch-dropdown.tsx | 0 | TypeScript | 1 | none | 16 | 51 | 51 | true | Fix: branch/repo dropdown reset on click | 12,501 | All-Hands-AI/OpenHands | 55,974 | Python | abhayymishraa | |
}
else:
_logger.info('No search engine API key found, skipping search engine')
def _add_custom_sse_servers(
self, mcp_servers: dict[str, Any], sse_servers: list
) -> None:
"""Add custom SSE MCP servers from user configuration.
Args:
mcp_serve... | No issues found. | }
else:
_logger.info('No search engine API key found, skipping search engine')
def _add_custom_sse_servers(
self, mcp_servers: dict[str, Any], sse_servers: list
) -> None:
"""Add custom SSE MCP servers from user configuration.
Args:
mcp_serve... | @@ -114,7 +114,6 @@ class LiveStatusAppConversationService(AppConversationServiceBase):
openhands_provider_base_url: str | None
access_token_hard_timeout: timedelta | None
app_mode: str | None = None
- keycloak_auth_cookie: str | None = None
tavily_api_key: str | None = None
async def sear... | openhands/app_server/app_conversation/live_status_app_conversation_service.py | 0 | Python | 1 | none | 16 | 51 | 51 | true | fix: remove keycloak_auth cookie requirement for webhook secrets endpoint | 12,525 | All-Hands-AI/OpenHands | 55,974 | Python | tofarr | |
}
if (isStatsConversationStateUpdateEvent(event)) {
updateMetricsFromStats(event);
}
}
// Handle ExecuteBashAction events - add command as input to terminal
if (isExecuteBashActionEvent(event)) {
appendInput(event.action.comman... | No issues found. | }
if (isStatsConversationStateUpdateEvent(event)) {
updateMetricsFromStats(event);
}
}
// Handle ExecuteBashAction events - add command as input to terminal
if (isExecuteBashActionEvent(event)) {
appendInput(event.action.comman... | @@ -8,6 +8,7 @@ import React, {
useRef,
} from "react";
import { useQueryClient } from "@tanstack/react-query";
+import { usePostHog } from "posthog-js/react";
import { useWebSocket, WebSocketHookOptions } from "#/hooks/use-websocket";
import { useEventStore } from "#/stores/use-event-store";
import { useErrorM... | frontend/src/contexts/conversation-websocket-context.tsx | 0 | TypeScript | 1 | none | 16 | 51 | 51 | true | fix: Add PostHog error tracking for V1 AgentErrorEvent and ConversationErrorEvent | 12,543 | All-Hands-AI/OpenHands | 55,974 | Python | neubig | |
},
'tax_behavior': 'exclusive',
},
'quantity': 1,
}
],
mode='payment',
payment_method_types=['card'],
saved_payment_method_options={'payment_method_save': 'enabled'},
... | No issues found. | },
'tax_behavior': 'exclusive',
},
'quantity': 1,
}
],
mode='payment',
payment_method_types=['card'],
saved_payment_method_options={'payment_method_save': 'enabled'},
... | @@ -163,7 +163,7 @@ async def test_create_checkout_session_stripe_error(
'server.auth.token_manager.TokenManager.get_user_info_from_user_id',
AsyncMock(return_value={'email': 'testy@tester.com'}),
),
- patch('server.routes.billing.validate_saas_environment'),
+ patch('se... | enterprise/tests/unit/test_billing.py | 0 | Python | 1 | none | 16 | 51 | 51 | true | Fix org billing | 12,562 | All-Hands-AI/OpenHands | 55,974 | Python | tofarr | |
class OrgResponse(BaseModel):
"""Response model for organization."""
id: str
name: str
contact_name: str
contact_email: str
conversation_expiration: int | None = None
agent: str | None = None
default_max_iterations: int | None = None
security_analyzer: str | None = None
confirm... | No issues found. |
class OrgResponse(BaseModel):
"""Response model for organization."""
id: str
name: str
contact_name: str
contact_email: str
conversation_expiration: int | None = None
agent: str | None = None
default_max_iterations: int | None = None
security_analyzer: str | None = None
confirm... | @@ -1,4 +1,6 @@
-from pydantic import BaseModel, EmailStr, Field
+from typing import Annotated
+
+from pydantic import BaseModel, EmailStr, Field, StringConstraints
from storage.org import Org
@@ -53,9 +55,11 @@ class OrgCreate(BaseModel):
"""Request model for creating a new organization."""
# Required... | enterprise/server/routes/org_models.py | 0 | Python | 1 | none | 16 | 51 | 51 | true | Cleaner Logs | 12,579 | All-Hands-AI/OpenHands | 55,974 | Python | tofarr | |
return self._user_has_write_access_to_repo(installation_id, repo_name, username)
async def receive_message(self, message: Message):
self._confirm_incoming_source_type(message)
try:
await call_sync_from_async(self.data_collector.process_payload, message)
except Exception... | No issues found. |
return self._user_has_write_access_to_repo(installation_id, repo_name, username)
async def receive_message(self, message: Message):
self._confirm_incoming_source_type(message)
try:
await call_sync_from_async(self.data_collector.process_payload, message)
except Exception... | @@ -33,6 +33,7 @@
from openhands.core.logger import openhands_logger as logger
from openhands.integrations.provider import ProviderToken, ProviderType
+from openhands.integrations.service_types import AuthenticationError
from openhands.server.types import (
LLMAuthenticationError,
MissingSettingsError,
@... | enterprise/integrations/github/github_manager.py | 0 | Python | 1 | none | 16 | 51 | 51 | true | Fix V0 Integrations | 12,584 | All-Hands-AI/OpenHands | 55,974 | Python | tofarr | |
onLogout={onLogoutMock}
onClose={onCloseMock}
/>,
);
expect(
screen.getByTestId("account-settings-context-menu"),
).toBeInTheDocument();
expect(screen.getByText("SIDEBAR$DOCS")).toBeInTheDocument();
expect(screen.getByText("ACCOUNT_SETTINGS$LOGOUT")).toBeInTheDocument();... | No issues found. | onLogout={onLogoutMock}
onClose={onCloseMock}
/>,
);
expect(
screen.getByTestId("account-settings-context-menu"),
).toBeInTheDocument();
expect(screen.getByText("SIDEBAR$DOCS")).toBeInTheDocument();
expect(screen.getByText("ACCOUNT_SETTINGS$LOGOUT")).toBeInTheDocument();... | @@ -1,25 +1,73 @@
import { render, screen } from "@testing-library/react";
import userEvent from "@testing-library/user-event";
-import { afterEach, describe, expect, it, test, vi } from "vitest";
+import { afterEach, beforeEach, describe, expect, it, test, vi } from "vitest";
import { AccountSettingsContextMenu } f... | frontend/__tests__/components/context-menu/account-settings-context-menu.test.tsx | 0 | TypeScript | 1 | none | 16 | 51 | 51 | true | Experiment - Add 'Add Team Members' button to Avatar menu in SaaS mode | 12,647 | All-Hands-AI/OpenHands | 55,974 | Python | jpelletier1 | |
conversationInfo: V1RuntimeConversationInfo,
): V1MetricsSnapshot {
const { stats } = conversationInfo;
if (!stats?.usage_to_metrics) {
return {
accumulated_cost: 0,
max_budget_per_task: null,
accumulated_token_usage: null,
};
}
let totalCost = 0;
let maxBudgetPerTask: number | n... | No issues found. | conversationInfo: V1RuntimeConversationInfo,
): V1MetricsSnapshot {
const { stats } = conversationInfo;
if (!stats?.usage_to_metrics) {
return {
accumulated_cost: 0,
max_budget_per_task: null,
accumulated_token_usage: null,
};
}
let totalCost = 0;
let maxBudgetPerTask: number | n... | @@ -0,0 +1,71 @@
+import type {
+ V1MetricsSnapshot,
+ V1RuntimeConversationInfo,
+ V1TokenUsage,
+} from "#/api/conversation-service/v1-conversation-service.types";
+
+/**
+ * TypeScript equivalent of the get_combined_metrics method from the Python SDK
+ * Combines metrics from all LLM usage IDs in the conversation... | frontend/src/utils/conversation-metrics.ts | 0 | TypeScript | 1 | none | 16 | 51 | 51 | true | fix(frontend): Support V1 conversations in MetricsModal | 12,678 | All-Hands-AI/OpenHands | 55,974 | Python | tofarr | |
# Act
result = recaptcha_service.create_assessment(
token='invalid-token',
action='LOGIN',
user_ip='192.168.1.1',
user_agent='Mozilla/5.0',
)
# Assert
assert result.allowed is False
assert result.valid is False
def tes... | No issues found. | # Act
result = recaptcha_service.create_assessment(
token='invalid-token',
action='LOGIN',
user_ip='192.168.1.1',
user_agent='Mozilla/5.0',
)
# Assert
assert result.allowed is False
assert result.valid is False
def tes... | @@ -290,6 +290,64 @@ def test_should_log_assessment_details_including_name(
assert call_kwargs[1]['extra']['action_valid'] is True
assert call_kwargs[1]['extra']['user_ip'] == '192.168.1.1'
+ def test_should_log_user_id_and_email_when_provided(
+ self, recaptcha_service, mock_gcp_c... | enterprise/tests/unit/test_recaptcha_service.py | 0 | Python | 1 | none | 16 | 51 | 51 | true | feat(recaptcha): add user_id and email to assessment log | 12,749 | All-Hands-AI/OpenHands | 55,974 | Python | saurya | |
"""Add byor_export_enabled flag to org table.
Revision ID: 091
Revises: 090
Create Date: 2025-01-15 00:00:00.000000
"""
from typing import Sequence, Union
import sqlalchemy as sa
from alembic import op
# revision identifiers, used by Alembic.
revision: str = '091'
down_revision: Union[str, None] = '090'
branch_lab... | No issues found. | """Add byor_export_enabled flag to org table.
Revision ID: 091
Revises: 090
Create Date: 2025-01-15 00:00:00.000000
"""
from typing import Sequence, Union
import sqlalchemy as sa
from alembic import op
# revision identifiers, used by Alembic.
revision: str = '091'
down_revision: Union[str, None] = '090'
branch_lab... | @@ -0,0 +1,46 @@
+"""Add byor_export_enabled flag to org table.
+
+Revision ID: 091
+Revises: 090
+Create Date: 2025-01-15 00:00:00.000000
+
+"""
+
+from typing import Sequence, Union
+
+import sqlalchemy as sa
+from alembic import op
+
+# revision identifiers, used by Alembic.
+revision: str = '091'
+down_revision: Un... | enterprise/migrations/versions/091_add_byor_export_enabled_flag.py | 0 | Python | 1 | none | 16 | 47 | 47 | true | feat: Add BYOR export flag to org for LLM key access control | 12,753 | All-Hands-AI/OpenHands | 55,974 | Python | tofarr | |
describe("useCreateConversation", () => {
it("passes suggested tasks to the V1 create conversation API", async () => {
const createConversationSpy = vi
.spyOn(V1ConversationService, "createConversation")
.mockResolvedValue({
id: "task-id",
created_by_user_id: null,
status: "RE... | No issues found. |
describe("useCreateConversation", () => {
it("passes suggested tasks to the V1 create conversation API", async () => {
const createConversationSpy = vi
.spyOn(V1ConversationService, "createConversation")
.mockResolvedValue({
id: "task-id",
created_by_user_id: null,
status: "RE... | @@ -0,0 +1,104 @@
+import { renderHook, waitFor } from "@testing-library/react";
+import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
+import { describe, expect, it, vi } from "vitest";
+import V1ConversationService from "#/api/conversation-service/v1-conversation-service.api";
+import { useCreate... | frontend/__tests__/hooks/mutation/use-create-conversation.test.tsx | 0 | TypeScript | 1 | none | 16 | 51 | 51 | true | fix: wire suggested task prompts for V1 | 12,787 | All-Hands-AI/OpenHands | 55,974 | Python | enyst | |
WHEN: DELETE /api/organizations/{org_id} is called
THEN: 500 Internal Server Error is returned with generic message
"""
# Arrange
org_id = uuid.uuid4()
with patch(
'server.routes.orgs.OrgService.delete_org_with_cleanup',
AsyncMock(side_effect=RuntimeError('Unexpected system erro... | No issues found. | WHEN: DELETE /api/organizations/{org_id} is called
THEN: 500 Internal Server Error is returned with generic message
"""
# Arrange
org_id = uuid.uuid4()
with patch(
'server.routes.orgs.OrgService.delete_org_with_cleanup',
AsyncMock(side_effect=RuntimeError('Unexpected system erro... | @@ -2635,3 +2635,136 @@ async def test_get_me_direct_function_call_role_not_found(
await get_me(org_id=test_org_id, user_id=test_user_id)
assert exc_info.value.status_code == status.HTTP_500_INTERNAL_SERVER_ERROR
+
+
+@pytest.mark.asyncio
+async def test_switch_org_success(mock_app_with_get_... | enterprise/tests/unit/server/routes/test_orgs.py | 0 | Python | 1 | none | 16 | 51 | 51 | true | feat(backend): add api for switching between orgs | 12,799 | All-Hands-AI/OpenHands | 55,974 | Python | hieptl | |
side_effect=[first_page, second_page, third_page, fourth_page]
)
# Act
result = await self.service.export_conversation(conversation_id)
# Assert
assert result is not None
assert isinstance(result, bytes) # Should be bytes
# Verify the zip file cont... | No issues found. | side_effect=[first_page, second_page, third_page, fourth_page]
)
# Act
result = await self.service.export_conversation(conversation_id)
# Assert
assert result is not None
assert isinstance(result, bytes) # Should be bytes
# Verify the zip file cont... | @@ -2,6 +2,7 @@
import io
import json
+import os
import zipfile
from datetime import datetime
from unittest.mock import AsyncMock, Mock, patch
@@ -38,6 +39,23 @@
from openhands.sdk.workspace.remote.async_remote_workspace import AsyncRemoteWorkspace
from openhands.server.types import AppMode
+# Env var used b... | tests/unit/app_server/test_live_status_app_conversation_service.py | 0 | Python | 1 | none | 16 | 51 | 51 | true | chore: update sdk to the latest version | 12,811 | All-Hands-AI/OpenHands | 55,974 | Python | hieptl | |
name=f'user_{user_id}_org',
contact_name='Updated Name',
contact_email='john@example.com',
org_version=5,
)
update_data = {'contact_name': 'Updated Name'}
with (
patch(
'server.routes.orgs.OrgService.update_org_with_permissions',
AsyncMock(re... | No issues found. | name=f'user_{user_id}_org',
contact_name='Updated Name',
contact_email='john@example.com',
org_version=5,
)
update_data = {'contact_name': 'Updated Name'}
with (
patch(
'server.routes.orgs.OrgService.update_org_with_permissions',
AsyncMock(re... | @@ -32,6 +32,7 @@
OrgMemberUpdate,
OrgNameExistsError,
OrgNotFoundError,
+ OrphanedUserError,
RoleNotFoundError,
)
from server.routes.orgs import (
@@ -1403,30 +1404,52 @@ async def test_delete_org_invalid_uuid(mock_app):
@pytest.mark.asyncio
-async def test_del... | enterprise/tests/unit/server/routes/test_orgs.py | 0 | Python | 1 | none | 16 | 51 | 51 | true | fix(backend): prevent org deletion from setting current_org_id to NULL | 12,817 | All-Hands-AI/OpenHands | 55,974 | Python | hieptl | |
user_role,
):
"""Test that a regular user cannot remove anyone."""
# Arrange
requester_membership_user = MagicMock(spec=OrgMember)
requester_membership_user.org_id = org_id
requester_membership_user.user_id = current_user_id
requester_membership_user.role_id =... | No issues found. | user_role,
):
"""Test that a regular user cannot remove anyone."""
# Arrange
requester_membership_user = MagicMock(spec=OrgMember)
requester_membership_user.org_id = org_id
requester_membership_user.user_id = current_user_id
requester_membership_user.role_id =... | @@ -179,7 +179,7 @@ async def test_get_members_succeeds_returns_paginated_data(
assert data.items[0].user_id == str(current_user_id)
assert data.items[0].email == 'test@example.com'
assert data.items[0].role_id == 1
- assert data.items[0].role_name == 'owner'
+ ... | enterprise/tests/unit/server/services/test_org_member_service.py | 0 | Python | 1 | none | 16 | 51 | 51 | true | feat: integrate with the get org members api | 12,829 | All-Hands-AI/OpenHands | 55,974 | Python | hieptl | |
@pytest.mark.asyncio
async def test_delete_org_with_cleanup_database_failure(session_maker, owner_role):
"""
GIVEN: Authorization succeeds but database deletion fails
WHEN: delete_org_with_cleanup is called
THEN: OrgDatabaseError is raised
"""
# Arrange
org_id = uuid.uuid4()
user_id = st... | No issues found. | @pytest.mark.asyncio
async def test_delete_org_with_cleanup_database_failure(session_maker, owner_role):
"""
GIVEN: Authorization succeeds but database deletion fails
WHEN: delete_org_with_cleanup is called
THEN: OrgDatabaseError is raised
"""
# Arrange
org_id = uuid.uuid4()
user_id = st... | @@ -1535,6 +1535,118 @@ async def test_update_org_with_permissions_database_error(session_maker):
assert 'Failed to update organization' in str(exc_info.value)
+@pytest.mark.asyncio
+async def test_update_org_with_permissions_duplicate_name_raises_org_name_exists_error(
+ session_maker,
+):
+ """
+ ... | enterprise/tests/unit/test_org_service.py | 0 | Python | 1 | none | 16 | 51 | 51 | true | refactor(backend): update the patch organization api to support organization name updates | 12,834 | All-Hands-AI/OpenHands | 55,974 | Python | hieptl | |
<h3 className="text-xl font-semibold">
{t(I18nKey.ORG$ADD_CREDITS)}
</h3>
<input
data-testid="amount-input"
name="amount"
type="number"
className="text-lg bg-[#27272A] p-2"
placeholder={t(I18nKey.PAYMENT$SPECIFY_AMOUNT... | No issues found. | <h3 className="text-xl font-semibold">
{t(I18nKey.ORG$ADD_CREDITS)}
</h3>
<input
data-testid="amount-input"
name="amount"
type="number"
className="text-lg bg-[#27272A] p-2"
placeholder={t(I18nKey.PAYMENT$SPECIFY_AMOUNT... | @@ -5,74 +5,18 @@ import { useOrganization } from "#/hooks/query/use-organization";
import { useOrganizationPaymentInfo } from "#/hooks/query/use-organization-payment-info";
import { ModalBackdrop } from "#/components/shared/modals/modal-backdrop";
import { cn } from "#/utils/utils";
-import { SettingsInput } from "... | frontend/src/routes/manage-org.tsx | 0 | TypeScript | 1 | none | 16 | 51 | 51 | true | feat(frontend): allow users to change organization name | 12,842 | All-Hands-AI/OpenHands | 55,974 | Python | hieptl | |
onChange={(e) => handleAmountInputChange(e.target.value)}
/>
{errorMessage && (
<p className="text-red-500 text-sm mt-1" data-testid="amount-error">
{errorMessage}
</p>
)}
</div>
<div className="flex gap-2">
<Bran... | No issues found. | onChange={(e) => handleAmountInputChange(e.target.value)}
/>
{errorMessage && (
<p className="text-red-500 text-sm mt-1" data-testid="amount-error">
{errorMessage}
</p>
)}
</div>
<div className="flex gap-2">
<Bran... | @@ -10,40 +10,14 @@ import { useMe } from "#/hooks/query/use-me";
import { useConfig } from "#/hooks/query/use-config";
import { I18nKey } from "#/i18n/declaration";
import { amountIsValid } from "#/utils/amount-is-valid";
-import { useDeleteOrganization } from "#/hooks/mutation/use-delete-organization";
import { C... | frontend/src/routes/manage-org.tsx | 0 | TypeScript | 1 | none | 16 | 51 | 51 | true | feat(frontend): integrate with the delete organization api | 12,845 | All-Hands-AI/OpenHands | 55,974 | Python | hieptl | |
enable_jira: false,
enable_jira_dc: false,
enable_linear: false,
},
});
renderUserContextMenu({ type: "member", onClose: vi.fn });
await waitFor(() => {
// Other nav items should still be visible
expect(screen.getByText("SETTINGS$NAV_USER")).toBe... | No issues found. | enable_jira: false,
enable_jira_dc: false,
enable_linear: false,
},
});
renderUserContextMenu({ type: "member", onClose: vi.fn });
await waitFor(() => {
// Other nav items should still be visible
expect(screen.getByText("SETTINGS$NAV_USER")).toBe... | @@ -98,9 +98,17 @@ vi.mock("react-i18next", async () => {
});
describe("UserContextMenu", () => {
+ beforeEach(() => {
+ // Ensure clean state at the start of each test
+ vi.restoreAllMocks();
+ useSelectedOrganizationStore.setState({ organizationId: null });
+ });
+
afterEach(() => {
vi.restoreA... | frontend/__tests__/components/features/user/user-context-menu.test.tsx | 0 | TypeScript | 1 | none | 16 | 51 | 51 | true | feat(frontend): hide org selector when only personal workspace exists | 12,847 | All-Hands-AI/OpenHands | 55,974 | Python | hieptl | |
const memberEmail = "test@example.com";
// Act
renderWithProviders(
<ConfirmRemoveMemberModal
onConfirm={vi.fn()}
onCancel={vi.fn()}
memberEmail={memberEmail}
/>,
);
// Assert
expect(screen.getByText(memberEmail)).toBeInTheDocument();
});
it("should cal... | No issues found. | const memberEmail = "test@example.com";
// Act
renderWithProviders(
<ConfirmRemoveMemberModal
onConfirm={vi.fn()}
onCancel={vi.fn()}
memberEmail={memberEmail}
/>,
);
// Assert
expect(screen.getByText(memberEmail)).toBeInTheDocument();
});
it("should cal... | @@ -0,0 +1,91 @@
+import React from "react";
+import { describe, it, expect, vi } from "vitest";
+import { screen } from "@testing-library/react";
+import userEvent from "@testing-library/user-event";
+import { renderWithProviders } from "test-utils";
+import { ConfirmRemoveMemberModal } from "#/components/features/org... | frontend/__tests__/components/features/org/confirm-remove-member-modal.test.tsx | 0 | TypeScript | 1 | none | 16 | 51 | 51 | true | feat(frontend): integrate with delete organization members api | 12,848 | All-Hands-AI/OpenHands | 55,974 | Python | hieptl | |
assert not call_args['stream']
@patch('openhands.llm.llm.litellm_completion')
def test_llm_gemini_thinking_parameter(mock_litellm_completion, default_config):
"""Test that the 'thinking' parameter is correctly passed to litellm_completion
when a Gemini model is used with 'low' reasoning_effort.
"""
... | No issues found. | assert not call_args['stream']
@patch('openhands.llm.llm.litellm_completion')
def test_llm_gemini_thinking_parameter(mock_litellm_completion, default_config):
"""Test that the 'thinking' parameter is correctly passed to litellm_completion
when a Gemini model is used with 'low' reasoning_effort.
"""
... | @@ -1274,6 +1274,25 @@ def test_opus_45_keeps_temperature_drops_top_p(mock_completion):
assert 'top_p' not in call_kwargs
+@patch('openhands.llm.llm.litellm_completion')
+def test_opus_46_keeps_temperature_drops_top_p(mock_completion):
+ mock_completion.return_value = {
+ 'choices': [{'message': {'co... | tests/unit/llm/test_llm.py | 0 | Python | 1 | none | 16 | 51 | 51 | true | fix: add claude-opus-4-6 to temperature/top_p guard | 12,874 | All-Hands-AI/OpenHands | 55,974 | Python | 314clay | |
navigateToTab("planner");
};
// Handle Build action with scroll to bottom
const handleBuildClick = useCallback(
(event?: React.MouseEvent<HTMLButtonElement>) => {
handleBuildPlanClick(event);
scrollDomToBottom();
},
[handleBuildPlanClick, scrollDomToBottom],
);
// Truncate plan c... | No issues found. | navigateToTab("planner");
};
// Handle Build action with scroll to bottom
const handleBuildClick = useCallback(
(event?: React.MouseEvent<HTMLButtonElement>) => {
handleBuildPlanClick(event);
scrollDomToBottom();
},
[handleBuildPlanClick, scrollDomToBottom],
);
// Truncate plan c... | @@ -65,7 +65,7 @@ export function PlanPreview({
return `${planContent.slice(0, MAX_CONTENT_LENGTH)}...`;
}, [planContent]);
- if (!shouldUsePlanningAgent) {
+ if (!shouldUsePlanningAgent || !planContent) {
return null;
}
| frontend/src/components/features/chat/plan-preview.tsx | 0 | TypeScript | 1 | none | 16 | 51 | 51 | true | refactor(frontend): hide planning preview component when plan content is empty | 12,879 | All-Hands-AI/OpenHands | 55,974 | Python | hieptl | |
assert agent.llm.usage_id == 'primary-llm'
# Control: max_size = 120, keep_first = 4
assert result.condenser.max_size == 120
assert result.condenser.keep_first == 4
def test_treatment_variant_sets_condenser_with_max_size_80(monkeypatch):
_patch_variant(monkeypatch, 'treatment')
agent = make_a... | No issues found. | assert agent.llm.usage_id == 'primary-llm'
# Control: max_size = 120, keep_first = 4
assert result.condenser.max_size == 120
assert result.condenser.keep_first == 4
def test_treatment_variant_sets_condenser_with_max_size_80(monkeypatch):
_patch_variant(monkeypatch, 'treatment')
agent = make_a... | @@ -126,3 +126,24 @@ def test_run_agent_variant_tests_v1_calls_handler_and_sets_system_prompt(monkeyp
# Should be a different instance than the original (copied after handler runs)
assert result is not agent
assert result.system_prompt_filename == 'system_prompt_long_horizon.j2'
+
+
+@patch('experiments.... | enterprise/tests/unit/experiments/test_saas_experiment_manager.py | 0 | Python | 1 | none | 16 | 51 | 51 | true | fix(backend): system prompt override (planning agent) | 12,893 | All-Hands-AI/OpenHands | 55,974 | Python | hieptl | |
'storage.lite_llm_manager.LiteLlmManager.get_user_team_info',
return_value={
'spend': 25.50,
'litellm_budget_table': {'max_budget': 100.00},
},
),
patch(
'storage.lite_llm_manager.LiteLlmManager.update_team_and_users_budget'... | No issues found. | 'storage.lite_llm_manager.LiteLlmManager.get_user_team_info',
return_value={
'spend': 25.50,
'litellm_budget_table': {'max_budget': 100.00},
},
),
patch(
'storage.lite_llm_manager.LiteLlmManager.update_team_and_users_budget'... | @@ -291,7 +291,7 @@ async def test_success_callback_stripe_incomplete():
@pytest.mark.asyncio
async def test_success_callback_success():
- """Test successful payment completion and credit update."""
+ """Test successful payment completion and credit update (bonus already granted)."""
mock_request = Reque... | enterprise/tests/unit/test_billing.py | 0 | Python | 1 | none | 16 | 51 | 51 | true | Grant free credits after minimum purchase | 12,899 | All-Hands-AI/OpenHands | 55,974 | Python | malhotra5 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.