before_code stringlengths 30 149k | reviewer_comment stringlengths 16 20.6k | after_code stringlengths 30 163k | diff_context stringlengths 0 22.4k | file_path stringlengths 6 155 | comment_line int64 0 26 | language stringclasses 19
values | quality_score float64 0.07 1 | comment_type stringclasses 9
values | comment_length int64 16 20.6k | before_lines int64 2 4.61k | after_lines int64 2 4.4k | is_negative bool 2
classes | pr_title stringlengths 7 140 | pr_number int64 18 61.2k | repo_name stringclasses 29
values | repo_stars int64 321 56k | repo_language stringclasses 14
values | reviewer_username stringclasses 378
values | author_username stringclasses 739
values | user stringlengths 361 200k | assistant stringlengths 16 20.6k | system stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
import { useTracking } from "#/hooks/use-tracking";
interface AcceptTosVariables {
redirectUrl: string;
}
interface AcceptTosResponse {
data: {
redirect_url?: string;
};
}
export const useAcceptTos = () => {
const posthog = usePostHog();
const navigate = useNavigate();
const { trackUserSignupComplete... | ```suggestion
return openHands.post<AcceptTosResponse>("/api/accept_tos", {
redirect_url: redirectUrl,
});
``` | import { useTracking } from "#/hooks/use-tracking";
interface AcceptTosVariables {
redirectUrl: string;
}
interface AcceptTosResponse {
redirect_url?: string;
}
export const useAcceptTos = () => {
const posthog = usePostHog();
const navigate = useNavigate();
const { trackUserSignupCompleted } = useTracking... | @@ -0,0 +1,56 @@
+import { useMutation } from "@tanstack/react-query";
+import { usePostHog } from "posthog-js/react";
+import { useNavigate } from "react-router";
+import { openHands } from "#/api/open-hands-axios";
+import { handleCaptureConsent } from "#/utils/handle-capture-consent";
+import { useTracking } from "#... | frontend/src/hooks/mutation/use-accept-tos.ts | 26 | TypeScript | 0.714 | suggestion | 130 | 51 | 50 | false | refactor(frontend): Extracted useQuery and useMutation from the main branch | 12,031 | All-Hands-AI/OpenHands | 55,974 | Python | amanape | abhayymishraa | Review this pull request change.
Language: TypeScript
File: frontend/src/hooks/mutation/use-accept-tos.ts
PR Title: refactor(frontend): Extracted useQuery and useMutation from the main branch
BEFORE CODE: import { useTracking } from "#/hooks/use-tracking";
interface AcceptTosVariables {
redirectUrl: string;
}
i... | ```suggestion
return openHands.post<AcceptTosResponse>("/api/accept_tos", {
redirect_url: redirectUrl,
});
``` | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
import { useMutation } from "@tanstack/react-query";
import { usePostHog } from "posthog-js/react";
import { useNavigate } from "react-router";
import { openHands } from "#/api/open-hands-axios";
import { handleCaptureConsent } from "#/utils/handle-capture-consent";
import { useTracking } from "#/hooks/use-tracking";
... | ```suggestion
interface AcceptTosResponse {
redirect_url?: string;
}
``` | import { useMutation } from "@tanstack/react-query";
import { usePostHog } from "posthog-js/react";
import { useNavigate } from "react-router";
import { openHands } from "#/api/open-hands-axios";
import { handleCaptureConsent } from "#/utils/handle-capture-consent";
import { useTracking } from "#/hooks/use-tracking";
... | @@ -0,0 +1,56 @@
+import { useMutation } from "@tanstack/react-query";
+import { usePostHog } from "posthog-js/react";
+import { useNavigate } from "react-router";
+import { openHands } from "#/api/open-hands-axios";
+import { handleCaptureConsent } from "#/utils/handle-capture-consent";
+import { useTracking } from "#... | frontend/src/hooks/mutation/use-accept-tos.ts | 14 | TypeScript | 0.571 | suggestion | 74 | 39 | 39 | false | refactor(frontend): Extracted useQuery and useMutation from the main branch | 12,031 | All-Hands-AI/OpenHands | 55,974 | Python | amanape | abhayymishraa | Review this pull request change.
Language: TypeScript
File: frontend/src/hooks/mutation/use-accept-tos.ts
PR Title: refactor(frontend): Extracted useQuery and useMutation from the main branch
BEFORE CODE: import { useMutation } from "@tanstack/react-query";
import { usePostHog } from "posthog-js/react";
import { us... | ```suggestion
interface AcceptTosResponse {
redirect_url?: string;
}
``` | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
from __future__ import annotations
import json
from dataclasses import dataclass
from openhands.core.config.openhands_config import OpenHandsConfig
from openhands.storage import get_file_store
from openhands.storage.data_models.settings import Settings
from openhands.storage.files import FileStore
from openhands.stor... | ```suggestion
# Turn on V1 in OpenHands
``` | from __future__ import annotations
import json
from dataclasses import dataclass
from openhands.core.config.openhands_config import OpenHandsConfig
from openhands.storage import get_file_store
from openhands.storage.data_models.settings import Settings
from openhands.storage.files import FileStore
from openhands.stor... | @@ -21,6 +21,11 @@ async def load(self) -> Settings | None:
json_str = await call_sync_from_async(self.file_store.read, self.path)
kwargs = json.loads(json_str)
settings = Settings(**kwargs)
+
+ # Turn on V1 in all OSS conversations | openhands/storage/settings/file_settings_store.py | 25 | Python | 0.571 | suggestion | 57 | 49 | 49 | false | Release OpenHands v1.0.0 | 12,052 | All-Hands-AI/OpenHands | 55,974 | Python | enyst | tofarr | Review this pull request change.
Language: Python
File: openhands/storage/settings/file_settings_store.py
PR Title: Release OpenHands v1.0.0
BEFORE CODE: from __future__ import annotations
import json
from dataclasses import dataclass
from openhands.core.config.openhands_config import OpenHandsConfig
from openhan... | ```suggestion
# Turn on V1 in OpenHands
``` | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
const { navigateMock } = vi.hoisted(() => ({
navigateMock: vi.fn(),
}));
vi.mock("react-router", async () => ({
...(await vi.importActual("react-router")),
useNavigate: () => navigateMock,
}));
describe("Manage Org Route", () => {
const getMeSpy = vi.spyOn(organizationService, "getMe");
// Test data const... | We can add a `Record<"OWNER" | "ADMIN", OrganizationMember>` type annotation and remove the `as const` type annotation in the object properties like `”role"` | });
const { navigateMock } = vi.hoisted(() => ({
navigateMock: vi.fn(),
}));
vi.mock("react-router", async () => ({
...(await vi.importActual("react-router")),
useNavigate: () => navigateMock,
}));
describe("Manage Org Route", () => {
const getMeSpy = vi.spyOn(organizationService, "getMe");
// Test data... | @@ -64,25 +64,43 @@ describe("Manage Org Route", () => {
// Test data constants
const TEST_USERS = {
OWNER: {
- id: "1",
+ org_id: "1",
+ user_id: "1",
email: "test@example.com",
role: "owner" as const,
+ llm_api_key: "**********",
+ max_iterations: 20,
+ llm_model... | frontend/__tests__/routes/manage-org.test.tsx | 26 | TypeScript | 0.714 | suggestion | 157 | 51 | 51 | false | refactor(frontend): update organizationmember type (org support) | 12,054 | All-Hands-AI/OpenHands | 55,974 | Python | amanape | hieptl | Review this pull request change.
Language: TypeScript
File: frontend/__tests__/routes/manage-org.test.tsx
PR Title: refactor(frontend): update organizationmember type (org support)
BEFORE CODE:
const { navigateMock } = vi.hoisted(() => ({
navigateMock: vi.fn(),
}));
vi.mock("react-router", async () => ({
...(... | We can add a `Record<"OWNER" | "ADMIN", OrganizationMember>` type annotation and remove the `as const` type annotation in the object properties like `”role"` | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
tooltip?: string;
}>;
}
export function ObservationPairEventMessage({
event,
microagentStatus,
microagentConversationId,
microagentPRUrl,
actions,
}: ObservationPairEventMessageProps) {
if (!isActionEvent(event)) {
return null;
}
// Check if there's thought content to display
const thought... | @OpenHands review this pr, irrc there's a syntax similar to `?==` that will automatically check for null, is that a thing? | tooltip?: string;
}>;
}
export function ObservationPairEventMessage({
event,
microagentStatus,
microagentConversationId,
microagentPRUrl,
actions,
}: ObservationPairEventMessageProps) {
if (!isActionEvent(event)) {
return null;
}
// Check if there's thought content to display
const thought... | @@ -34,7 +34,14 @@ export function ObservationPairEventMessage({
.map((t) => t.text)
.join("\n");
- if (thoughtContent && event.action.kind !== "ThinkAction") {
+ // Defensive check: ensure action exists and has kind property
+ if (
+ thoughtContent &&
+ event.action &&
+ typeof event.action ===... | frontend/src/components/v1/chat/event-message-components/observation-pair-event-message.tsx | 26 | TypeScript | 0.643 | question | 122 | 51 | 50 | false | fix(frontend): observation events and action events (v1 conversations) | 12,066 | All-Hands-AI/OpenHands | 55,974 | Python | xingyaoww | hieptl | Review this pull request change.
Language: TypeScript
File: frontend/src/components/v1/chat/event-message-components/observation-pair-event-message.tsx
PR Title: fix(frontend): observation events and action events (v1 conversations)
BEFORE CODE: tooltip?: string;
}>;
}
export function ObservationPairEventMes... | @OpenHands review this pr, irrc there's a syntax similar to `?==` that will automatically check for null, is that a thing? | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
items = await asyncio.gather(
*[
self._to_sandbox_info(stored_sandbox)
for stored_sandbox in stored_sandboxes
]
)
return SandboxPage(items=items, next_page_id=next_page_id)
async def get_sandbox(self, sandbox_id: str) -> Union[Sandbox... | Will this get all runtimes or only those that are running? (i.e is there an upper bound on the number of items?) | items = await asyncio.gather(
*[
self._to_sandbox_info(stored_sandbox)
for stored_sandbox in stored_sandboxes
]
)
return SandboxPage(items=items, next_page_id=next_page_id)
async def get_sandbox(self, sandbox_id: str) -> Union[Sandbox... | @@ -303,21 +303,27 @@ async def get_sandbox_by_session_api_key(
self, session_api_key: str
) -> Union[SandboxInfo, None]:
"""Get a single sandbox by session API key."""
- # Get all stored sandboxes for the current user
- stmt = await self._secure_select()
- result = await sel... | openhands/app_server/sandbox/remote_sandbox_service.py | 26 | Python | 0.357 | suggestion | 112 | 51 | 51 | false | Fixed performance bug in remote sandbox service | 12,076 | All-Hands-AI/OpenHands | 55,974 | Python | malhotra5 | tofarr | Review this pull request change.
Language: Python
File: openhands/app_server/sandbox/remote_sandbox_service.py
PR Title: Fixed performance bug in remote sandbox service
BEFORE CODE: items = await asyncio.gather(
*[
self._to_sandbox_info(stored_sandbox)
for stored_... | Will this get all runtimes or only those that are running? (i.e is there an upper bound on the number of items?) | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
const fitAddon = createErrorThrowingFitAddon();
// Without safety checks, calling fit() throws the error
expect(() => fitAddon.fit()).toThrow(
"Cannot read properties of undefined (reading 'dimensions')",
);
});
});
describe("error prevention with safety checks", () => {
it... | Each test essentially says "if I check condition X before calling `fit()`, and condition X is `false`, then `fit()` won't be called." The tests are just verifying that `if (false) { … }` doesn't execute the block.
This tests JavaScript's if statement | import { beforeAll, describe, expect, it, vi, afterEach } from "vitest";
import { useTerminal } from "#/hooks/use-terminal";
import { Command, useCommandStore } from "#/stores/command-store";
import { renderWithProviders } from "../../test-utils";
// Mock the WsClient context
vi.mock("#/context/ws-client-provider", ()... | @@ -97,3 +111,173 @@ describe("useTerminal", () => {
expect(mockTerminal.writeln).toHaveBeenNthCalledWith(2, "hello");
});
});
+
+describe("canFitTerminal safety checks", () => {
+ /**
+ * These tests verify the logic that prevents the
+ * "Cannot read properties of undefined (reading 'dimensions')" error... | frontend/__tests__/hooks/use-terminal.test.tsx | 26 | TypeScript | 0.571 | suggestion | 251 | 51 | 127 | false | Fix xterm dimensions error with explicit checks instead of try-catch | 12,095 | All-Hands-AI/OpenHands | 55,974 | Python | amanape | neubig | Review this pull request change.
Language: TypeScript
File: frontend/__tests__/hooks/use-terminal.test.tsx
PR Title: Fix xterm dimensions error with explicit checks instead of try-catch
BEFORE CODE: const fitAddon = createErrorThrowingFitAddon();
// Without safety checks, calling fit() throws the error... | Each test essentially says "if I check condition X before calling `fit()`, and condition X is `false`, then `fit()` won't be called." The tests are just verifying that `if (false) { … }` doesn't execute the block.
This tests JavaScript's if statement | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
/**
* Simulates the error that occurs in xterm when fit() is called
* on a terminal in an invalid state.
*/
const createErrorThrowingFitAddon = () => ({
fit: vi.fn().mockImplementation(() => {
// This simulates what happens inside xterm when the terminal
// is hidden or not properly initia... | This tests that `createErrorThrowingFitAddon` throws when called—which is defined to always throw. It doesn't demonstrate anything about when `xterm` actually throws this error.
| import { beforeAll, describe, expect, it, vi, afterEach } from "vitest";
import { useTerminal } from "#/hooks/use-terminal";
import { Command, useCommandStore } from "#/stores/command-store";
import { renderWithProviders } from "../../test-utils";
// Mock the WsClient context
vi.mock("#/context/ws-client-provider", ()... | @@ -97,3 +111,173 @@ describe("useTerminal", () => {
expect(mockTerminal.writeln).toHaveBeenNthCalledWith(2, "hello");
});
});
+
+describe("canFitTerminal safety checks", () => {
+ /**
+ * These tests verify the logic that prevents the
+ * "Cannot read properties of undefined (reading 'dimensions')" error... | frontend/__tests__/hooks/use-terminal.test.tsx | 26 | TypeScript | 0.643 | suggestion | 178 | 51 | 127 | false | Fix xterm dimensions error with explicit checks instead of try-catch | 12,095 | All-Hands-AI/OpenHands | 55,974 | Python | amanape | neubig | Review this pull request change.
Language: TypeScript
File: frontend/__tests__/hooks/use-terminal.test.tsx
PR Title: Fix xterm dimensions error with explicit checks instead of try-catch
BEFORE CODE:
/**
* Simulates the error that occurs in xterm when fit() is called
* on a terminal in an invalid state.
... | This tests that `createErrorThrowingFitAddon` throws when called—which is defined to always throw. It doesn't demonstrate anything about when `xterm` actually throws this error.
| You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
/* eslint-disable max-classes-per-file */
import { beforeAll, describe, expect, it, vi, afterEach } from "vitest";
import { useTerminal } from "#/hooks/use-terminal";
import { Command, useCommandStore } from "#/state/command-store";
import { renderWithProviders } from "../../test-utils";
// Mock the WsClient context
v... | The actual `canFitTerminal` function is defined in `use-terminal.ts`, but none of these tests import or call it. Instead, each test manually recreates the safety check logic.
If someone changes the implementation, the tests will still pass because they're testing their own inlined logic, not the real code. These tests... | import { beforeAll, describe, expect, it, vi, afterEach } from "vitest";
import { useTerminal } from "#/hooks/use-terminal";
import { Command, useCommandStore } from "#/stores/command-store";
import { renderWithProviders } from "../../test-utils";
// Mock the WsClient context
vi.mock("#/context/ws-client-provider", ()... | frontend/__tests__/hooks/use-terminal.test.tsx | 1 | TypeScript | 0.643 | suggestion | 718 | 26 | 26 | false | Fix xterm dimensions error with explicit checks instead of try-catch | 12,095 | All-Hands-AI/OpenHands | 55,974 | Python | amanape | neubig | Review this pull request change.
Language: TypeScript
File: frontend/__tests__/hooks/use-terminal.test.tsx
PR Title: Fix xterm dimensions error with explicit checks instead of try-catch
BEFORE CODE: /* eslint-disable max-classes-per-file */
import { beforeAll, describe, expect, it, vi, afterEach } from "vitest";
im... | The actual `canFitTerminal` function is defined in `use-terminal.ts`, but none of these tests import or call it. Instead, each test manually recreates the safety check logic.
If someone changes the implementation, the tests will still pass because they're testing their own inlined logic, not the real code. These tests... | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. | |
except httpx.HTTPError as e:
_logger.error(f'Error pausing sandbox {sandbox_id}: {e}')
return False
async def delete_sandbox(self, sandbox_id: str) -> bool:
"""Delete a sandbox by stopping its runtime."""
try:
stored_sandbox = await self._get_stored_sandb... | The function name and docstring disagree slightly on what this is doing. Xonsider a more clunky and honest name. e.g. `pause_oldest_sandboxes_when_over_max`
https://www.digdeeproots.com/articles/naming-process/
If if we're calling this "pausing" then let's not have any of the comments call it "stop".
| except httpx.HTTPError as e:
_logger.error(f'Error pausing sandbox {sandbox_id}: {e}')
return False
async def delete_sandbox(self, sandbox_id: str) -> bool:
"""Delete a sandbox by stopping its runtime."""
try:
stored_sandbox = await self._get_stored_sandb... | @@ -480,6 +517,55 @@ async def delete_sandbox(self, sandbox_id: str) -> bool:
_logger.error(f'Error deleting sandbox {sandbox_id}: {e}')
return False
+ async def pause_old_sandboxes(self, max_num_sandboxes: int) -> list[str]:
+ """Stop the oldest sandboxes if there are more than ma... | openhands/app_server/sandbox/remote_sandbox_service.py | 26 | Python | 0.643 | style | 309 | 51 | 51 | false | fix: eliminate N+1 performance bug in RemoteSandboxService with batch endpoint | 12,105 | All-Hands-AI/OpenHands | 55,974 | Python | raymyers | tofarr | Review this pull request change.
Language: Python
File: openhands/app_server/sandbox/remote_sandbox_service.py
PR Title: fix: eliminate N+1 performance bug in RemoteSandboxService with batch endpoint
BEFORE CODE: except httpx.HTTPError as e:
_logger.error(f'Error pausing sandbox {sandbox_id}: {e... | The function name and docstring disagree slightly on what this is doing. Xonsider a more clunky and honest name. e.g. `pause_oldest_sandboxes_when_over_max`
https://www.digdeeproots.com/articles/naming-process/
If if we're calling this "pausing" then let's not have any of the comments call it "stop".
| You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
(txt) => txt.charAt(0).toUpperCase() + txt.slice(1).toLowerCase(),
);
return (
<div
id="chat-status-indicator"
className="
h-[31px]
w-fit
rounded-[100px]
pt-[20px]
pr-[16px]
pb-[20px]
... | TailwindCSS has a `capitalize` utility that can be used instead of a function. See https://tailwindcss.com/docs/text-transform | <div
data-testid="chat-status-indicator"
className={cn(
"h-[31px] w-fit rounded-[100px] pt-[20px] pr-[16px] pb-[20px] pl-[5px] bg-[#25272D] flex items-center gap-2",
)}
>
<AnimatePresence mode="wait">
{/* Dot */}
<motion.span
key={`dot-${status}`}
... | @@ -0,0 +1,45 @@
+import DebugStackframeDot from "#/icons/debug-stackframe-dot.svg?react";
+
+interface ChatStatusIndicatorProps {
+ status: string;
+ statusColor: string;
+}
+
+function ChatStatusIndicator({
+ status,
+ statusColor,
+}: ChatStatusIndicatorProps) {
+ const formatString = (str: string) =>
+ str.... | frontend/src/components/features/chat/chat-status-indicator.tsx | 26 | TypeScript | 0.571 | refactor | 126 | 32 | 40 | false | feat(frontend): adding status indicator and unit test | 12,111 | All-Hands-AI/OpenHands | 55,974 | Python | amanape | HeyItsChloe | Review this pull request change.
Language: TypeScript
File: frontend/src/components/features/chat/chat-status-indicator.tsx
PR Title: feat(frontend): adding status indicator and unit test
BEFORE CODE: (txt) => txt.charAt(0).toUpperCase() + txt.slice(1).toLowerCase(),
);
return (
<div
id="chat... | TailwindCSS has a `capitalize` utility that can be used instead of a function. See https://tailwindcss.com/docs/text-transform | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
</MemoryRouter>,
);
// Verify the text input was cleared
expect(screen.getByTestId("chat-input")).toHaveTextContent("");
});
it("should render ChatStatusIndicator when conversation has status and agent is disabled", () => {
vi.mocked(useAgentState).mockReturnValue({
curAgentState: Agen... | Generally try to avoid full store mocking for our Zustand stores. We have a custom Zustand mock in `__mocks__/zustand.ts` that allows for direct store state setting in tests. Example: https://github.com/OpenHands/OpenHands/blob/ed7adb335ca7e65f19418ca1f337f88c7b7f9c24/frontend/__tests__/components/chat/chat-interface.t... | import { screen } from "@testing-library/react";
import userEvent from "@testing-library/user-event";
import { afterEach, beforeAll, describe, expect, it, vi } from "vitest";
import { MemoryRouter } from "react-router";
import { InteractiveChatBox } from "#/components/features/chat/interactive-chat-box";
import { rende... | @@ -247,4 +283,103 @@ describe("InteractiveChatBox", () => {
// Verify the text input was cleared
expect(screen.getByTestId("chat-input")).toHaveTextContent("");
});
+
+ it("should render ChatStatusIndicator when conversation has status and agent is disabled", () => {
+ vi.mocked(useAgentState).mockRet... | frontend/__tests__/components/interactive-chat-box.test.tsx | 26 | TypeScript | 0.643 | suggestion | 337 | 51 | 251 | false | feat(frontend): adding status indicator and unit test | 12,111 | All-Hands-AI/OpenHands | 55,974 | Python | amanape | HeyItsChloe | Review this pull request change.
Language: TypeScript
File: frontend/__tests__/components/interactive-chat-box.test.tsx
PR Title: feat(frontend): adding status indicator and unit test
BEFORE CODE: </MemoryRouter>,
);
// Verify the text input was cleared
expect(screen.getByTestId("chat-input")).to... | Generally try to avoid full store mocking for our Zustand stores. We have a custom Zustand mock in `__mocks__/zustand.ts` that allows for direct store state setting in tests. Example: https://github.com/OpenHands/OpenHands/blob/ed7adb335ca7e65f19418ca1f337f88c7b7f9c24/frontend/__tests__/components/chat/chat-interface.t... | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
displayErrorToast("An unexpected error occurred while processing files");
}
};
const handleSubmit = (message: string) => {
onSubmit(message, images, files);
clearAllFiles();
};
const handleSuggestionsClick = (suggestion: string) => {
handleSubmit(suggestion);
};
const isDisabled =
... | Always setting `isPausing: false` and `taskStatus: null` feels off, maybe we can -ass in the same data (if possible) as we do in https://github.com/OpenHands/OpenHands/blob/d6fc553ad97b52677ee9b414a92db547e82dd918/frontend/src/components/features/controls/server-status.tsx#L32-L39 | }
};
const handleSubmit = (message: string) => {
onSubmit(message, images, files);
clearAllFiles();
};
const handleSuggestionsClick = (suggestion: string) => {
handleSubmit(suggestion);
};
const isDisabled =
curAgentState === AgentState.LOADING ||
curAgentState === AgentState.AWAI... | @@ -147,8 +148,23 @@ export function InteractiveChatBox({ onSubmit }: InteractiveChatBoxProps) {
curAgentState === AgentState.AWAITING_USER_CONFIRMATION ||
isTaskPolling(subConversationTaskStatus);
+ const statusColor = getStatusColor({
+ isPausing: false,
+ isTask: isDisabled,
+ taskStatus: null,... | frontend/src/components/features/chat/interactive-chat-box.tsx | 26 | TypeScript | 0.714 | suggestion | 281 | 48 | 32 | false | feat(frontend): adding status indicator and unit test | 12,111 | All-Hands-AI/OpenHands | 55,974 | Python | amanape | HeyItsChloe | Review this pull request change.
Language: TypeScript
File: frontend/src/components/features/chat/interactive-chat-box.tsx
PR Title: feat(frontend): adding status indicator and unit test
BEFORE CODE: displayErrorToast("An unexpected error occurred while processing files");
}
};
const handleSubmit = (... | Always setting `isPausing: false` and `taskStatus: null` feels off, maybe we can -ass in the same data (if possible) as we do in https://github.com/OpenHands/OpenHands/blob/d6fc553ad97b52677ee9b414a92db547e82dd918/frontend/src/components/features/controls/server-status.tsx#L32-L39 | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
};
const handleSuggestionsClick = (suggestion: string) => {
handleSubmit(suggestion);
};
const isDisabled =
curAgentState === AgentState.LOADING ||
curAgentState === AgentState.AWAITING_USER_CONFIRMATION ||
isTaskPolling(subConversationTaskStatus);
const statusColor = getStatusColor({
i... | The demo attached looks to show “RUNNING” even when something else is initializing. TBH this is probably one confusing part in our code since we determine what to render here from roughly 3 different sources 😅
Maybe we can move this logic: https://github.com/OpenHands/OpenHands/blob/d6fc553ad97b52677ee9b414a92db547e8... | import { isFileImage } from "#/utils/is-file-image";
import { displayErrorToast } from "#/utils/custom-toast-handlers";
import { validateFiles } from "#/utils/file-validation";
import { CustomChatInput } from "./custom-chat-input";
import { AgentState } from "#/types/agent-state";
import { useActiveConversation } from ... | @@ -147,8 +148,23 @@ export function InteractiveChatBox({ onSubmit }: InteractiveChatBoxProps) {
curAgentState === AgentState.AWAITING_USER_CONFIRMATION ||
isTaskPolling(subConversationTaskStatus);
+ const statusColor = getStatusColor({
+ isPausing: false,
+ isTask: isDisabled,
+ taskStatus: null,... | frontend/src/components/features/chat/interactive-chat-box.tsx | 26 | TypeScript | 0.5 | refactor | 434 | 41 | 164 | false | feat(frontend): adding status indicator and unit test | 12,111 | All-Hands-AI/OpenHands | 55,974 | Python | amanape | HeyItsChloe | Review this pull request change.
Language: TypeScript
File: frontend/src/components/features/chat/interactive-chat-box.tsx
PR Title: feat(frontend): adding status indicator and unit test
BEFORE CODE: };
const handleSuggestionsClick = (suggestion: string) => {
handleSubmit(suggestion);
};
const isDisab... | The demo attached looks to show “RUNNING” even when something else is initializing. TBH this is probably one confusing part in our code since we determine what to render here from roughly 3 different sources 😅
Maybe we can move this logic: https://github.com/OpenHands/OpenHands/blob/d6fc553ad97b52677ee9b414a92db547e8... | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
images: [],
files: [],
loadingFiles: [],
loadingImages: [],
// AgentStatus
setShouldShownAgentLoading: vi.fn(),
// useChatInputLogic
setMessageToSend: vi.fn(),
setIsRightPanelShown: vi.fn(),
hasRightPanelToggled: false,
// CustomChatInput cleanup
... | ```suggestion
expect(screen.getByTestId("chat-status-indicator")).toBeInTheDocument();
```
Generally `screen.getByTestId` is preferred for consistency with React Testing Library and better error messages (`getByTestId` throws a descriptive error if the element isn't found, showing the available DOM structure. `get... | import { screen } from "@testing-library/react";
import userEvent from "@testing-library/user-event";
import { afterEach, beforeAll, describe, expect, it, vi } from "vitest";
import { MemoryRouter } from "react-router";
import { InteractiveChatBox } from "#/components/features/chat/interactive-chat-box";
import { rende... | @@ -247,4 +283,103 @@ describe("InteractiveChatBox", () => {
// Verify the text input was cleared
expect(screen.getByTestId("chat-input")).toHaveTextContent("");
});
+
+ it("should render ChatStatusIndicator when conversation has status and agent is disabled", () => {
+ vi.mocked(useAgentState).mockRet... | frontend/__tests__/components/interactive-chat-box.test.tsx | 26 | TypeScript | 1 | bug | 606 | 51 | 251 | false | feat(frontend): adding status indicator and unit test | 12,111 | All-Hands-AI/OpenHands | 55,974 | Python | amanape | HeyItsChloe | Review this pull request change.
Language: TypeScript
File: frontend/__tests__/components/interactive-chat-box.test.tsx
PR Title: feat(frontend): adding status indicator and unit test
BEFORE CODE: images: [],
files: [],
loadingFiles: [],
loadingImages: [],
// AgentStatus
setShou... | ```suggestion
expect(screen.getByTestId("chat-status-indicator")).toBeInTheDocument();
```
Generally `screen.getByTestId` is preferred for consistency with React Testing Library and better error messages (`getByTestId` throws a descriptive error if the element isn't found, showing the available DOM structure. `get... | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
loadingImages: [],
// AgentStatus
setShouldShownAgentLoading: vi.fn(),
// useChatInputLogic
setMessageToSend: vi.fn(),
setIsRightPanelShown: vi.fn(),
hasRightPanelToggled: false,
// CustomChatInput cleanup
setShouldHideSuggestions: vi.fn(),
clearAllFiles: v... | ```suggestion
expect(screen.queryByTestId("chat-status-indicator")).not.toBeInTheDocument();
``` | import { screen } from "@testing-library/react";
import userEvent from "@testing-library/user-event";
import { afterEach, beforeAll, describe, expect, it, vi } from "vitest";
import { MemoryRouter } from "react-router";
import { InteractiveChatBox } from "#/components/features/chat/interactive-chat-box";
import { rende... | @@ -247,4 +283,103 @@ describe("InteractiveChatBox", () => {
// Verify the text input was cleared
expect(screen.getByTestId("chat-input")).toHaveTextContent("");
});
+
+ it("should render ChatStatusIndicator when conversation has status and agent is disabled", () => {
+ vi.mocked(useAgentState).mockRet... | frontend/__tests__/components/interactive-chat-box.test.tsx | 26 | TypeScript | 0.714 | suggestion | 102 | 29 | 251 | false | feat(frontend): adding status indicator and unit test | 12,111 | All-Hands-AI/OpenHands | 55,974 | Python | amanape | HeyItsChloe | Review this pull request change.
Language: TypeScript
File: frontend/__tests__/components/interactive-chat-box.test.tsx
PR Title: feat(frontend): adding status indicator and unit test
BEFORE CODE: loadingImages: [],
// AgentStatus
setShouldShownAgentLoading: vi.fn(),
// useChatInputLogic
... | ```suggestion
expect(screen.queryByTestId("chat-status-indicator")).not.toBeInTheDocument();
``` | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
const isStopStatus = curAgentState === AgentState.STOPPED;
const isPausing = curAgentState === AgentState.PAUSED;
const showStatusIndicator = curAgentState !== AgentState.AWAITING_USER_INPUT;
const serverStatusColor = getStatusColor({
isPausing,
isTask,
taskStatus,
isStartingStatus,
isStopSt... | **suggestion:** Using the isDisabled property of the chat input to control the rendering of this component may not be optimal. The chat input can be enabled or disabled in various scenarios, which could result in this component being rendered unexpectedly. | import { isFileImage } from "#/utils/is-file-image";
import { displayErrorToast } from "#/utils/custom-toast-handlers";
import { validateFiles } from "#/utils/file-validation";
import { CustomChatInput } from "./custom-chat-input";
import { AgentState } from "#/types/agent-state";
import { useActiveConversation } from ... | @@ -147,8 +154,40 @@ export function InteractiveChatBox({ onSubmit }: InteractiveChatBoxProps) {
curAgentState === AgentState.AWAITING_USER_CONFIRMATION ||
isTaskPolling(subConversationTaskStatus);
+ // Get server status indicator props
+ const isStartingStatus =
+ curAgentState === AgentState.LOADING ... | frontend/src/components/features/chat/interactive-chat-box.tsx | 26 | TypeScript | 0.5 | suggestion | 256 | 44 | 164 | false | feat(frontend): adding status indicator and unit test | 12,111 | All-Hands-AI/OpenHands | 55,974 | Python | hieptl | HeyItsChloe | Review this pull request change.
Language: TypeScript
File: frontend/src/components/features/chat/interactive-chat-box.tsx
PR Title: feat(frontend): adding status indicator and unit test
BEFORE CODE: const isStopStatus = curAgentState === AgentState.STOPPED;
const isPausing = curAgentState === AgentState.PAUSED... | **suggestion:** Using the isDisabled property of the chat input to control the rendering of this component may not be optimal. The chat input can be enabled or disabled in various scenarios, which could result in this component being rendered unexpectedly. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
return getLimitedTaskGroups(suggestedTasks, 3);
}
/**
* Get the repository markdown creation prompt with additional PR creation instructions
* @param gitProvider The git provider to use for generating provider-specific text
* @param query Optional custom query to use instead of the default prompt
* @returns The ... | **question:** Why was the indentation of this content changed? Have you re-tested the prompt after modifying its indentation? |
if (tasksToShow.length > 0) {
limitedGroups.push({
...group,
tasks: tasksToShow,
});
taskCount += tasksToShow.length;
}
}
return limitedGroups;
}
export function getDisplayedTaskGroups(
suggestedTasks: SuggestedTaskGroup[] | undefined,
isExpanded: boolean,
): Suggest... | @@ -513,10 +514,10 @@ export const getRepoMdCreatePrompt = (
query
? `- ${query}`
: `- A description of the project
- - An overview of the file structure
- - Any information on how to run tests or other relevant commands
- - Any other inf... | frontend/src/utils/utils.ts | 26 | TypeScript | 0.429 | question | 125 | 51 | 51 | false | feat(frontend): adding status indicator and unit test | 12,111 | All-Hands-AI/OpenHands | 55,974 | Python | hieptl | HeyItsChloe | Review this pull request change.
Language: TypeScript
File: frontend/src/utils/utils.ts
PR Title: feat(frontend): adding status indicator and unit test
BEFORE CODE: return getLimitedTaskGroups(suggestedTasks, 3);
}
/**
* Get the repository markdown creation prompt with additional PR creation instructions
* @pa... | **question:** Why was the indentation of this content changed? Have you re-tested the prompt after modifying its indentation? | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
import DebugStackframeDot from "#/icons/debug-stackframe-dot.svg?react";
interface ChatStatusIndicatorProps {
status: string;
statusColor: string;
}
function ChatStatusIndicator({
status,
statusColor,
}: ChatStatusIndicatorProps) {
return (
<div
data-testid="chat-status-indicator"
className=... | **suggestion:** Could you please write test cases for this component? | import { cn } from "@heroui/react";
import { motion, AnimatePresence } from "framer-motion";
import DebugStackframeDot from "#/icons/debug-stackframe-dot.svg?react";
interface ChatStatusIndicatorProps {
status: string;
statusColor: string;
}
function ChatStatusIndicator({
status,
statusColor,
}: ChatStatusInd... | @@ -0,0 +1,27 @@
+import DebugStackframeDot from "#/icons/debug-stackframe-dot.svg?react";
+
+interface ChatStatusIndicatorProps {
+ status: string;
+ statusColor: string;
+}
+
+function ChatStatusIndicator({ | frontend/src/components/features/chat/chat-status-indicator.tsx | 10 | TypeScript | 0.286 | question | 69 | 28 | 35 | false | feat(frontend): adding status indicator and unit test | 12,111 | All-Hands-AI/OpenHands | 55,974 | Python | hieptl | HeyItsChloe | Review this pull request change.
Language: TypeScript
File: frontend/src/components/features/chat/chat-status-indicator.tsx
PR Title: feat(frontend): adding status indicator and unit test
BEFORE CODE: import DebugStackframeDot from "#/icons/debug-stackframe-dot.svg?react";
interface ChatStatusIndicatorProps {
st... | **suggestion:** Could you please write test cases for this component? | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
export function getStatusText({
isPausing = false,
isTask,
taskStatus,
taskDetail,
isStartingStatus,
isStopStatus,
curAgentState,
errorMessage,
t,
}: GetStatusTextArgs): string {
// Show pausing status
if (isPausing) {
return t(I18nKey.COMMON$STOPPING);
}
// Show task status if we're poll... | **suggestion:** Could you please write test cases for this function? | /**
* Get the server status text based on agent and task state
*
* @param options Configuration object for status text calculation
* @param options.isPausing Whether the agent is currently pausing
* @param options.isTask Whether we're polling a task
* @param options.taskStatus The task status string (e.g., "ERROR... | @@ -721,3 +722,91 @@ export const getStatusColor = (options: {
}
return "#BCFF8C";
};
+
+interface GetStatusTextArgs {
+ isPausing: boolean;
+ isTask: boolean;
+ taskStatus?: string | null;
+ taskDetail?: string | null;
+ isStartingStatus: boolean;
+ isStopStatus: boolean;
+ curAgentState: AgentState;
+ ... | frontend/src/utils/utils.ts | 26 | TypeScript | 0.286 | question | 68 | 51 | 51 | false | feat(frontend): adding status indicator and unit test | 12,111 | All-Hands-AI/OpenHands | 55,974 | Python | hieptl | HeyItsChloe | Review this pull request change.
Language: TypeScript
File: frontend/src/utils/utils.ts
PR Title: feat(frontend): adding status indicator and unit test
BEFORE CODE: export function getStatusText({
isPausing = false,
isTask,
taskStatus,
taskDetail,
isStartingStatus,
isStopStatus,
curAgentState,
error... | **suggestion:** Could you please write test cases for this function? | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
await user.click(displayedSuggestions[0]);
expect(sendMock).not.toHaveBeenCalled();
useWsClientMock.mockImplementation(() => ({
send: sendMock,
status: "CONNECTED",
isLoadingMessages: false,
parsedEvents: [],
}));
rerender(
<MemoryRouter>
... | ```suggestion
vi.mocked(useAgentState).mockReturnValue({
```
`vi.mocked` is specifically designed to provide proper type inference without manual casting |
await user.click(displayedSuggestions[0]);
expect(sendMock).not.toHaveBeenCalled();
useWsClientMock.mockImplementation(() => ({
send: sendMock,
status: "CONNECTED",
isLoadingMessages: false,
parsedEvents: [],
}));
rerender(
<MemoryRouter>
... | @@ -344,6 +352,28 @@ describe("ChatInterface - Empty state", () => {
);
});
+describe('ChatInterface - Status Indicator', () => {
+ it("should render ChatStatusIndicator when agent is not awaiting user input / conversation is NOT ready", () => {
+ (useAgentState as unknown as ReturnType<typeof vi.fn>).mockRet... | frontend/__tests__/components/chat/chat-interface.test.tsx | 26 | TypeScript | 0.929 | suggestion | 158 | 51 | 51 | false | feat(frontend): adding status indicator and unit test | 12,111 | All-Hands-AI/OpenHands | 55,974 | Python | amanape | HeyItsChloe | Review this pull request change.
Language: TypeScript
File: frontend/__tests__/components/chat/chat-interface.test.tsx
PR Title: feat(frontend): adding status indicator and unit test
BEFORE CODE:
await user.click(displayedSuggestions[0]);
expect(sendMock).not.toHaveBeenCalled();
useWsClientMock.... | ```suggestion
vi.mocked(useAgentState).mockReturnValue({
```
`vi.mocked` is specifically designed to provide proper type inference without manual casting | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
rerender(
<MemoryRouter>
<ChatInterface />
</MemoryRouter>,
);
await waitFor(() =>
expect(sendMock).toHaveBeenCalledWith(expect.any(String)),
);
},
);
});
describe('ChatInterface - Status Indicator', () => {
it("should render ChatStatusIndicator when a... | ```suggestion
vi.mocked(useAgentState).mockReturnValue({
``` | rerender(
<MemoryRouter>
<ChatInterface />
</MemoryRouter>,
);
await waitFor(() =>
expect(sendMock).toHaveBeenCalledWith(expect.any(String)),
);
},
);
});
describe('ChatInterface - Status Indicator', () => {
it("should render ChatStatusIndicator when a... | @@ -344,6 +352,28 @@ describe("ChatInterface - Empty state", () => {
);
});
+describe('ChatInterface - Status Indicator', () => {
+ it("should render ChatStatusIndicator when agent is not awaiting user input / conversation is NOT ready", () => {
+ (useAgentState as unknown as ReturnType<typeof vi.fn>).mockRet... | frontend/__tests__/components/chat/chat-interface.test.tsx | 26 | TypeScript | 0.643 | suggestion | 64 | 51 | 51 | false | feat(frontend): adding status indicator and unit test | 12,111 | All-Hands-AI/OpenHands | 55,974 | Python | amanape | HeyItsChloe | Review this pull request change.
Language: TypeScript
File: frontend/__tests__/components/chat/chat-interface.test.tsx
PR Title: feat(frontend): adding status indicator and unit test
BEFORE CODE: rerender(
<MemoryRouter>
<ChatInterface />
</MemoryRouter>,
);
await waitFo... | ```suggestion
vi.mocked(useAgentState).mockReturnValue({
``` | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
it("passes the statusColor to the DebugStackframeDot icon", () => {
render(
<ChatStatusIndicator
status="Error"
statusColor="#FF684E"
/>
);
const icon = screen.getByTestId("debug-stackframe-dot");
expect(icon).toHaveAttribute("color", "#FF684E");
});
it("renders the ... | ```suggestion
```
Let’s avoid testing CSS, classNames, or visuals as they can change frequently with no negative effect to the underlying behavior | import { render, screen } from "@testing-library/react";
import { describe, it, expect, vi } from "vitest";
import ChatStatusIndicator from "#/components/features/chat/chat-status-indicator";
vi.mock("#/icons/debug-stackframe-dot.svg?react", () => ({
default: (props: any) => (
<svg data-testid="debug-stackframe-... | @@ -0,0 +1,52 @@
+import { render, screen } from "@testing-library/react";
+import { describe, it, expect, vi } from "vitest";
+import ChatStatusIndicator from "#/components/features/chat/chat-status-indicator";
+
+vi.mock("#/icons/debug-stackframe-dot.svg?react", () => ({
+ default: (props: any) => (
+ <svg data-t... | frontend/__tests__/components/chat-status-indicator.test.tsx | 26 | TypeScript | 0.786 | suggestion | 147 | 29 | 49 | false | feat(frontend): adding status indicator and unit test | 12,111 | All-Hands-AI/OpenHands | 55,974 | Python | amanape | HeyItsChloe | Review this pull request change.
Language: TypeScript
File: frontend/__tests__/components/chat-status-indicator.test.tsx
PR Title: feat(frontend): adding status indicator and unit test
BEFORE CODE:
it("passes the statusColor to the DebugStackframeDot icon", () => {
render(
<ChatStatusIndicator
... | ```suggestion
```
Let’s avoid testing CSS, classNames, or visuals as they can change frequently with no negative effect to the underlying behavior | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
isPausing: true,
isTask: false,
taskStatus: null,
taskDetail: null,
isStartingStatus: false,
isStopStatus: false,
curAgentState: AgentState.RUNNING,
t,
});
expect(result).toBe(I18nKey.COMMON$STOPPING);
});
it("formats task status when polling a task", () => ... | I guess we are missing i18n keys here? If so, can we add them? |
test("formatTimestamp", () => {
const morningDate = new Date("2021-10-10T10:10:10.000").toISOString();
expect(formatTimestamp(morningDate)).toBe("10/10/2021, 10:10:10");
const eveningDate = new Date("2021-10-10T22:10:10.000").toISOString();
expect(formatTimestamp(eveningDate)).toBe("10/10/2021, 22:10:10");
})... | @@ -23,3 +28,143 @@ test("formatTimestamp", () => {
const eveningDate = new Date("2021-10-10T22:10:10.000").toISOString();
expect(formatTimestamp(eveningDate)).toBe("10/10/2021, 22:10:10");
});
+
+describe("getStatusText", () => {
+ it("returns STOPPING when pausing", () => {
+ const result = getStatusText({... | frontend/__tests__/utils/utils.test.ts | 26 | TypeScript | 0.214 | question | 62 | 51 | 51 | false | feat(frontend): adding status indicator and unit test | 12,111 | All-Hands-AI/OpenHands | 55,974 | Python | amanape | HeyItsChloe | Review this pull request change.
Language: TypeScript
File: frontend/__tests__/utils/utils.test.ts
PR Title: feat(frontend): adding status indicator and unit test
BEFORE CODE: isPausing: true,
isTask: false,
taskStatus: null,
taskDetail: null,
isStartingStatus: false,
isStopStatu... | I guess we are missing i18n keys here? If so, can we add them? | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
statusColor,
}: ChatStatusIndicatorProps) {
const [displayStatus, setDisplayStatus] = useState(status);
const [fadingOut, setFadingOut] = useState(false);
useEffect(() => {
setFadingOut(true);
const timeout = setTimeout(() => {
setDisplayStatus(status);
setFadingOut(false);
}, 300);
... | ```suggestion
className={cn(
"font-normal text-[11px] leading-[20px] normal-case transition-opacity duration-900 ease-out",
fadingOut ? "opacity-0" : "opacity-100",
)}
```
You’ll need to also
```ts
import { cn } from "#/utils/utils”;
``` | status,
statusColor,
}: ChatStatusIndicatorProps) {
return (
<div
data-testid="chat-status-indicator"
className={cn(
"h-[31px] w-fit rounded-[100px] pt-[20px] pr-[16px] pb-[20px] pl-[5px] bg-[#25272D] flex items-center gap-2",
)}
>
<AnimatePresence mode="wait">
{/* ... | @@ -0,0 +1,44 @@
+import { useEffect, useState } from "react";
+import DebugStackframeDot from "#/icons/debug-stackframe-dot.svg?react";
+
+interface ChatStatusIndicatorProps {
+ status: string;
+ statusColor: string;
+}
+
+function ChatStatusIndicator({
+ status,
+ statusColor,
+}: ChatStatusIndicatorProps) {
+ c... | frontend/src/components/features/chat/chat-status-indicator.tsx | 26 | TypeScript | 0.786 | suggestion | 275 | 35 | 44 | false | feat(frontend): adding status indicator and unit test | 12,111 | All-Hands-AI/OpenHands | 55,974 | Python | amanape | HeyItsChloe | Review this pull request change.
Language: TypeScript
File: frontend/src/components/features/chat/chat-status-indicator.tsx
PR Title: feat(frontend): adding status indicator and unit test
BEFORE CODE: statusColor,
}: ChatStatusIndicatorProps) {
const [displayStatus, setDisplayStatus] = useState(status);
const... | ```suggestion
className={cn(
"font-normal text-[11px] leading-[20px] normal-case transition-opacity duration-900 ease-out",
fadingOut ? "opacity-0" : "opacity-100",
)}
```
You’ll need to also
```ts
import { cn } from "#/utils/utils”;
``` | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
import { useEffect, useState } from "react";
import DebugStackframeDot from "#/icons/debug-stackframe-dot.svg?react";
interface ChatStatusIndicatorProps {
status: string;
statusColor: string;
}
function ChatStatusIndicator({
status,
statusColor,
}: ChatStatusIndicatorProps) {
const [displayStatus, setDispla... | Though non-blocking for this PR, we have an animation library called `framer-motion` (now known as just `motion`) and they have an `AnimatePresence` component that can do the same without managing our own state:
https://motion.dev/docs/react-animate-presence | import { cn } from "@heroui/react";
import { motion, AnimatePresence } from "framer-motion";
import DebugStackframeDot from "#/icons/debug-stackframe-dot.svg?react";
interface ChatStatusIndicatorProps {
status: string;
statusColor: string;
}
function ChatStatusIndicator({
status,
statusColor,
}: ChatStatusInd... | @@ -0,0 +1,44 @@
+import { useEffect, useState } from "react";
+import DebugStackframeDot from "#/icons/debug-stackframe-dot.svg?react";
+
+interface ChatStatusIndicatorProps {
+ status: string;
+ statusColor: string;
+}
+
+function ChatStatusIndicator({
+ status,
+ statusColor,
+}: ChatStatusIndicatorProps) {
+ c... | frontend/src/components/features/chat/chat-status-indicator.tsx | 25 | TypeScript | 0.571 | suggestion | 259 | 45 | 50 | false | feat(frontend): adding status indicator and unit test | 12,111 | All-Hands-AI/OpenHands | 55,974 | Python | amanape | HeyItsChloe | Review this pull request change.
Language: TypeScript
File: frontend/src/components/features/chat/chat-status-indicator.tsx
PR Title: feat(frontend): adding status indicator and unit test
BEFORE CODE: import { useEffect, useState } from "react";
import DebugStackframeDot from "#/icons/debug-stackframe-dot.svg?react... | Though non-blocking for this PR, we have an animation library called `framer-motion` (now known as just `motion`) and they have an `AnimatePresence` component that can do the same without managing our own state:
https://motion.dev/docs/react-animate-presence | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
expect(getOrganizationMembersSpy).toHaveBeenCalledExactlyOnceWith({
orgId: "1",
});
});
it("should render the list of organization members", async () => {
await setupTestWithOrg(0);
const members = ORGS_AND_MEMBERS["1"];
const memberListItems = await screen.findAllByTestId("member-item")... | This change looks unrelated to the original issue. Was there a specific reason this was made? |
const memberListItems = await screen.findAllByTestId("member-item");
expect(memberListItems).toHaveLength(members.length);
members.forEach((member) => {
expect(screen.getByText(member.email)).toBeInTheDocument();
expect(screen.getByText(member.role)).toBeInTheDocument();
});
});
test(... | @@ -278,11 +286,23 @@ describe("Manage Organization Members Route", () => {
expect(memberListItems).toHaveLength(members.length);
members.forEach((member) => {
- expect(screen.getByText(member.email)).toBeInTheDocument();
- expect(screen.getByText(member.role)).toBeInTheDocument();
+ const ro... | frontend/__tests__/routes/manage-organization-members.test.tsx | 26 | TypeScript | 0.286 | question | 93 | 51 | 51 | false | Refactor(frontend):change the role-name user to member | 12,146 | All-Hands-AI/OpenHands | 55,974 | Python | amanape | AVBharath10 | Review this pull request change.
Language: TypeScript
File: frontend/__tests__/routes/manage-organization-members.test.tsx
PR Title: Refactor(frontend):change the role-name user to member
BEFORE CODE: expect(getOrganizationMembersSpy).toHaveBeenCalledExactlyOnceWith({
orgId: "1",
});
});
it("shou... | This change looks unrelated to the original issue. Was there a specific reason this was made? | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
<div className="flex items-center gap-2">
<span
className={cn(
"text-sm font-semibold",
status === "invited" && "text-gray-400",
)}
>
{email}
</span>
{status === "invited" && (
<span className="text-xs text-tertiary-l... | Please revert, if your objective was to render capitalized text, please look at the `capitalize` class https://tailwindcss.com/docs/text-transform
```suggestion
{role}
``` | >
{email}
</span>
{status === "invited" && (
<span className="text-xs text-tertiary-light border border-tertiary px-2 py-1 rounded-lg">
{t(I18nKey.ORG$STATUS_INVITED)}
</span>
)}
</div>
<div className="relative">
<span
... | @@ -65,9 +73,10 @@ export function OrganizationMemberListItem({
roleSelectionIsPermitted ? "cursor-pointer" : "cursor-not-allowed",
)}
>
- {role}
+ {ROLE_LABELS[role]} | frontend/src/components/features/org/organization-member-list-item.tsx | 26 | TypeScript | 0.714 | suggestion | 183 | 42 | 36 | false | Refactor(frontend):change the role-name user to member | 12,146 | All-Hands-AI/OpenHands | 55,974 | Python | amanape | AVBharath10 | Review this pull request change.
Language: TypeScript
File: frontend/src/components/features/org/organization-member-list-item.tsx
PR Title: Refactor(frontend):change the role-name user to member
BEFORE CODE: <div className="flex items-center gap-2">
<span
className={cn(
"text-sm... | Please revert, if your objective was to render capitalized text, please look at the `capitalize` class https://tailwindcss.com/docs/text-transform
```suggestion
{role}
``` | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
onClose();
};
return (
<ContextMenu
ref={menuRef}
testId="organization-member-role-context-menu"
position="bottom"
alignment="right"
className="min-h-fit mb-2 min-w-[195px] max-w-[195px] gap-0"
>
{availableRolesToChangeTo.includes("owner") && (
<ContextMenuLi... | ```suggestion
text={t(I18nKey.ORG$ROLE_OWNER)}
```
We rely on the i18n for proper localization. Your change hard codes an English value which is undesired | testId="organization-member-role-context-menu"
position="bottom"
alignment="right"
className="min-h-fit mb-2 min-w-[195px] max-w-[195px] gap-0"
>
{availableRolesToChangeTo.includes("owner") && (
<ContextMenuListItem
testId="owner-option"
onClick={(event) => ... | @@ -70,7 +76,7 @@ export function OrganizationMemberRoleContextMenu({
className="text-white pl-[2px]"
/>
}
- text={t(I18nKey.ORG$ROLE_OWNER)}
+ text={ROLE_LABELS.owner} | frontend/src/components/features/org/organization-member-role-context-menu.tsx | 26 | TypeScript | 0.786 | suggestion | 167 | 51 | 51 | false | Refactor(frontend):change the role-name user to member | 12,146 | All-Hands-AI/OpenHands | 55,974 | Python | amanape | AVBharath10 | Review this pull request change.
Language: TypeScript
File: frontend/src/components/features/org/organization-member-role-context-menu.tsx
PR Title: Refactor(frontend):change the role-name user to member
BEFORE CODE: onClose();
};
return (
<ContextMenu
ref={menuRef}
testId="organization-mem... | ```suggestion
text={t(I18nKey.ORG$ROLE_OWNER)}
```
We rely on the i18n for proper localization. Your change hard codes an English value which is undesired | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
<AdminIcon
width={16}
height={16}
className="text-white pl-[2px]"
/>
}
text={ROLE_LABELS.owner}
className="capitalize"
/>
</ContextMenuListItem>
)}
{availableRolesToChangeTo.incl... | ```suggestion
text={t(I18nKey.ORG$ROLE_ADMIN)}
``` | text={t(I18nKey.ORG$ROLE_OWNER)}
className="capitalize"
/>
</ContextMenuListItem>
)}
{availableRolesToChangeTo.includes("admin") && (
<ContextMenuListItem
testId="admin-option"
onClick={(event) => handleRoleChangeClick(event, "admin")}
... | @@ -89,20 +95,20 @@ export function OrganizationMemberRoleContextMenu({
className="text-white pl-[2px]"
/>
}
- text={t(I18nKey.ORG$ROLE_ADMIN)}
+ text={ROLE_LABELS.admin} | frontend/src/components/features/org/organization-member-role-context-menu.tsx | 26 | TypeScript | 0.571 | suggestion | 62 | 51 | 51 | false | Refactor(frontend):change the role-name user to member | 12,146 | All-Hands-AI/OpenHands | 55,974 | Python | amanape | AVBharath10 | Review this pull request change.
Language: TypeScript
File: frontend/src/components/features/org/organization-member-role-context-menu.tsx
PR Title: Refactor(frontend):change the role-name user to member
BEFORE CODE: <AdminIcon
width={16}
height={16}
cla... | ```suggestion
text={t(I18nKey.ORG$ROLE_ADMIN)}
``` | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
testId="admin-option"
onClick={(event) => handleRoleChangeClick(event, "admin")}
className={contextMenuListItemClassName}
>
<ContextMenuIconText
icon={
<AdminIcon
width={16}
height={16}
className="t... | ```suggestion
text={t(I18nKey.ORG$ROLE_USER)}
``` | <AdminIcon
width={16}
height={16}
className="text-white pl-[2px]"
/>
}
text={t(I18nKey.ORG$ROLE_ADMIN)}
className="capitalize"
/>
</ContextMenuListItem>
)}
{availableRolesToChang... | @@ -89,20 +95,20 @@ export function OrganizationMemberRoleContextMenu({
className="text-white pl-[2px]"
/>
}
- text={t(I18nKey.ORG$ROLE_ADMIN)}
+ text={ROLE_LABELS.admin}
className="capitalize"
/>
</ContextMenuListItem>
... | frontend/src/components/features/org/organization-member-role-context-menu.tsx | 26 | TypeScript | 0.643 | suggestion | 61 | 45 | 39 | false | Refactor(frontend):change the role-name user to member | 12,146 | All-Hands-AI/OpenHands | 55,974 | Python | amanape | AVBharath10 | Review this pull request change.
Language: TypeScript
File: frontend/src/components/features/org/organization-member-role-context-menu.tsx
PR Title: Refactor(frontend):change the role-name user to member
BEFORE CODE: testId="admin-option"
onClick={(event) => handleRoleChangeClick(event, "admin")... | ```suggestion
text={t(I18nKey.ORG$ROLE_USER)}
``` | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
const roleText = within(targetMember).getByText(
new RegExp(`^${expectedRoleText}$`, "i"),
);
expect(roleText).toBeInTheDocument();
await userEvent.click(roleText);
// Verify that the dropdown does not open
expectDropdownNotVisible(targetMember);
};
// Helper function to setup invite... | ```suggestion
await screen.findByRole("button", {
``` | const roleText = within(targetMember).getByText(
new RegExp(`^${expectedRoleText}$`, "i"),
);
expect(roleText).toBeInTheDocument();
await userEvent.click(roleText);
// Verify that the dropdown does not open
expectDropdownNotVisible(targetMember);
};
// Helper function to setup invite... | @@ -214,15 +214,15 @@ describe("Manage Organization Members Route", () => {
// Helper function to find invite button
const findInviteButton = async () =>
- await screen.findByRole("button", {
+ screen.findByRole("button", { | frontend/__tests__/routes/manage-organization-members.test.tsx | 26 | TypeScript | 0.571 | suggestion | 57 | 51 | 51 | false | Refactor(frontend):change the role-name user to member | 12,146 | All-Hands-AI/OpenHands | 55,974 | Python | amanape | AVBharath10 | Review this pull request change.
Language: TypeScript
File: frontend/__tests__/routes/manage-organization-members.test.tsx
PR Title: Refactor(frontend):change the role-name user to member
BEFORE CODE: const roleText = within(targetMember).getByText(
new RegExp(`^${expectedRoleText}$`, "i"),
);
exp... | ```suggestion
await screen.findByRole("button", {
``` | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
interface SelectedOrganizationState {
orgId: string | null;
}
interface SelectedOrganizationActions {
setOrgId: (orgId: string | null) => void;
}
type SelectedOrganizationStore = SelectedOrganizationState &
SelectedOrganizationActions;
const initialState: SelectedOrganizationState = {
orgId: null,
};
export... | **suggestion:** According to your code changes, the terms “Organization” and “Org” are used inconsistently. I recommend standardizing on a single term for consistency. Thank you! 🙏 | interface SelectedOrganizationState {
orgId: string | null;
}
interface SelectedOrganizationActions {
setOrgId: (orgId: string | null) => void;
}
type SelectedOrganizationStore = SelectedOrganizationState &
SelectedOrganizationActions;
const initialState: SelectedOrganizationState = {
orgId: null,
};
export... | @@ -0,0 +1,30 @@
+import { create } from "zustand";
+import { devtools } from "zustand/middleware";
+
+interface SelectedOrganizationState {
+ orgId: string | null;
+}
+
+interface SelectedOrganizationActions {
+ setOrgId: (orgId: string | null) => void;
+}
+
+type SelectedOrganizationStore = SelectedOrganizationStat... | frontend/src/stores/selected-organization-store.ts | 26 | TypeScript | 0.429 | suggestion | 181 | 28 | 28 | false | refactor(frontend): migrate selected org ID to Zustand | 12,153 | All-Hands-AI/OpenHands | 55,974 | Python | hieptl | smosco | Review this pull request change.
Language: TypeScript
File: frontend/src/stores/selected-organization-store.ts
PR Title: refactor(frontend): migrate selected org ID to Zustand
BEFORE CODE: interface SelectedOrganizationState {
orgId: string | null;
}
interface SelectedOrganizationActions {
setOrgId: (orgId: st... | **suggestion:** According to your code changes, the terms “Organization” and “Org” are used inconsistently. I recommend standardizing on a single term for consistency. Thank you! 🙏 | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
import { useRevalidator } from "react-router";
import { useSelectedOrganizationStore } from "#/stores/selected-organization-store";
export const useSelectedOrganizationId = () => {
const revalidator = useRevalidator();
const { organizationId: orgId, setOrganizationId: setOrgIdStore } =
useSelectedOrganizationS... | **suggestion:** This line can be updated accordingly, as we have decided to use the term ‘Organization’ in our code. Therefore, we should consistently use this term. Thank you! 🙏
```
const { organizationId: currentOrganizationId, setOrganizationId: setOrganizationIdStore } =
useSelectedOrganizationStore();
``` | import { useRevalidator } from "react-router";
import { useSelectedOrganizationStore } from "#/stores/selected-organization-store";
export const useSelectedOrganizationId = () => {
const revalidator = useRevalidator();
const { organizationId, setOrganizationId: setOrganizationIdStore } =
useSelectedOrganizatio... | @@ -3,7 +3,8 @@ import { useSelectedOrganizationStore } from "#/stores/selected-organization-sto
export const useSelectedOrganizationId = () => {
const revalidator = useRevalidator();
- const { orgId, setOrgId: setOrgIdStore } = useSelectedOrganizationStore();
+ const { organizationId: orgId, setOrganizationId:... | frontend/src/context/use-selected-organization.ts | 7 | TypeScript | 0.857 | suggestion | 317 | 18 | 18 | false | hotfix(frontend): org naming consistency | 12,164 | All-Hands-AI/OpenHands | 55,974 | Python | hieptl | amanape | Review this pull request change.
Language: TypeScript
File: frontend/src/context/use-selected-organization.ts
PR Title: hotfix(frontend): org naming consistency
BEFORE CODE: import { useRevalidator } from "react-router";
import { useSelectedOrganizationStore } from "#/stores/selected-organization-store";
export co... | **suggestion:** This line can be updated accordingly, as we have decided to use the term ‘Organization’ in our code. Therefore, we should consistently use this term. Thank you! 🙏
```
const { organizationId: currentOrganizationId, setOrganizationId: setOrganizationIdStore } =
useSelectedOrganizationStore();
``` | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
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", () => {
const { result } = renderH... | **suggestion:** It appears that the test name should also be updated. Thank you! 🙏 | 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 organizationId", () => {
const { result } ... | @@ -5,33 +5,33 @@ import { useSelectedOrganizationStore } from "#/stores/selected-organization-sto
describe("useSelectedOrganizationStore", () => {
it("should have null as initial orgId", () => { | frontend/__tests__/stores/selected-organization-store.test.ts | 6 | TypeScript | 0.286 | suggestion | 83 | 31 | 31 | false | hotfix(frontend): org naming consistency | 12,164 | All-Hands-AI/OpenHands | 55,974 | Python | hieptl | amanape | Review this pull request change.
Language: TypeScript
File: frontend/__tests__/stores/selected-organization-store.test.ts
PR Title: hotfix(frontend): org naming consistency
BEFORE CODE: import { act, renderHook } from "@testing-library/react";
import { describe, expect, it } from "vitest";
import { useSelectedOrgan... | **suggestion:** It appears that the test name should also be updated. Thank you! 🙏 | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
act(() => {
result.current.setOrganizationId("org-123");
});
expect(result.current.organizationId).toBe("org-123");
act(() => {
result.current.setOrganizationId(null);
});
expect(result.current.organizationId).toBeNull();
});
it("should share state across multiple hook instan... | **suggestion:** We could consider renaming the mocked data; however, I will follow your decision on this. Thank you! 🙏 | act(() => {
result.current.setOrganizationId("org-123");
});
expect(result.current.organizationId).toBe("org-123");
act(() => {
result.current.setOrganizationId(null);
});
expect(result.current.organizationId).toBeNull();
});
it("should share state across multiple hook instan... | @@ -43,9 +43,9 @@ describe("useSelectedOrganizationStore", () => {
);
act(() => {
- result1.current.setOrgId("shared-org");
+ result1.current.setOrganizationId("shared-org");
});
- expect(result2.current.orgId).toBe("shared-org");
+ expect(result2.current.organizationId).toBe("shared-... | frontend/__tests__/stores/selected-organization-store.test.ts | 26 | TypeScript | 0.429 | suggestion | 119 | 29 | 29 | false | hotfix(frontend): org naming consistency | 12,164 | All-Hands-AI/OpenHands | 55,974 | Python | hieptl | amanape | Review this pull request change.
Language: TypeScript
File: frontend/__tests__/stores/selected-organization-store.test.ts
PR Title: hotfix(frontend): org naming consistency
BEFORE CODE: act(() => {
result.current.setOrganizationId("org-123");
});
expect(result.current.organizationId).toBe("org-12... | **suggestion:** We could consider renaming the mocked data; however, I will follow your decision on this. Thank you! 🙏 | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
register_callback_processor(conversation_id, processor)
logger.info(
f'[Jira DC] Created callback processor for conversation {conversation_id}'
)
# Send initial response
msg_info = jira_dc_view.get_response_msg()
exce... | @OpenHands please revert this accidental changes to `msg_info` | # Register the callback processor
register_callback_processor(conversation_id, processor)
logger.info(
f'[Jira DC] Created callback processor for conversation {conversation_id}'
)
# Send initial response
msg_in... | @@ -397,11 +401,15 @@ async def start_job(self, jira_dc_view: JiraDcViewInterface):
logger.warning(f'[Jira DC] LLM authentication error: {str(e)}')
msg_info = f'Please set a valid LLM API key in [OpenHands Cloud]({HOST_URL}) before starting a job.'
+ except SessionExpiredError as e:
+... | enterprise/integrations/jira_dc/jira_dc_manager.py | 26 | Python | 0.429 | suggestion | 62 | 51 | 51 | false | Handle expired Keycloak session with user-friendly error message | 12,168 | All-Hands-AI/OpenHands | 55,974 | Python | xingyaoww | xingyaoww | Review this pull request change.
Language: Python
File: enterprise/integrations/jira_dc/jira_dc_manager.py
PR Title: Handle expired Keycloak session with user-friendly error message
BEFORE CODE: register_callback_processor(conversation_id, processor)
logger.info(
... | @OpenHands please revert this accidental changes to `msg_info` | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
# Combine messages: include solvability report with "I'm on it!" if successful
if solvability_summary:
msg_info = f'{base_msg}\n\n{solvability_summary}'
else:
msg_info = base_msg
except MissingSettingsError as e:
... | **suggestion:** This message is duplicated across files related to Git providers. Could we create a shared function to reuse this message across those files? | base_msg = f"I'm on it! {user_info.username} can [track my progress at all-hands.dev]({conversation_link})"
# Combine messages: include solvability report with "I'm on it!" if successful
if solvability_summary:
msg_info = f'{base_msg}\n\n{solvability_s... | @@ -342,6 +346,13 @@ async def start_job(self, github_view: ResolverViewInterface):
msg_info = f'@{user_info.username} please set a valid LLM API key in [OpenHands Cloud]({HOST_URL}) before starting a job.'
+ except SessionExpiredError as e:
+ logger.warning(
+ ... | enterprise/integrations/github/github_manager.py | 26 | Python | 0.429 | refactor | 157 | 42 | 43 | false | Handle expired Keycloak session with user-friendly error message | 12,168 | All-Hands-AI/OpenHands | 55,974 | Python | hieptl | xingyaoww | Review this pull request change.
Language: Python
File: enterprise/integrations/github/github_manager.py
PR Title: Handle expired Keycloak session with user-friendly error message
BEFORE CODE: # Combine messages: include solvability report with "I'm on it!" if successful
if solvabili... | **suggestion:** This message is duplicated across files related to Git providers. Could we create a shared function to reuse this message across those files? | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
processor = JiraCallbackProcessor(
issue_key=jira_view.job_context.issue_key,
workspace_name=jira_view.jira_workspace.name,
)
# Register the callback processor
register_callback_processor(conversation_id, processor)... | **suggestion:** This message is duplicated across files related to Jira and Linear. Could we create a shared function to reuse this message across those files? | if isinstance(jira_view, JiraNewConversationView):
processor = JiraCallbackProcessor(
issue_key=jira_view.job_context.issue_key,
workspace_name=jira_view.jira_workspace.name,
)
# Register the callback processor
... | @@ -380,6 +384,10 @@ async def start_job(self, jira_view: JiraViewInterface):
logger.warning(f'[Jira] LLM authentication error: {str(e)}')
msg_info = f'Please set a valid LLM API key in [OpenHands Cloud]({HOST_URL}) before starting a job.'
+ except SessionExpiredError as e:
+ ... | enterprise/integrations/jira/jira_manager.py | 26 | Python | 0.429 | refactor | 159 | 51 | 51 | false | Handle expired Keycloak session with user-friendly error message | 12,168 | All-Hands-AI/OpenHands | 55,974 | Python | hieptl | xingyaoww | Review this pull request change.
Language: Python
File: enterprise/integrations/jira/jira_manager.py
PR Title: Handle expired Keycloak session with user-friendly error message
BEFORE CODE: processor = JiraCallbackProcessor(
issue_key=jira_view.job_context.issue_key,
... | **suggestion:** This message is duplicated across files related to Jira and Linear. Could we create a shared function to reuse this message across those files? | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
from abc import ABC, abstractmethod
from enum import Enum
from typing import Any, ClassVar, Protocol
class AppMode(Enum):
OSS = 'oss'
SAAS = 'saas'
class SessionMiddlewareInterface(Protocol):
"""Protocol for session middleware classes."""
pass
class ServerConfigInterface(ABC):
CONFIG_PATH: Cl... | I like to think that maybe the whole `openhands/server/` module will be obsoleted, but maybe `types.py` stays for V1? If not, another spot might be better
Just a tiny thought in passing, nothing big 😅 | ATTACH_SESSION_MIDDLEWARE_PATH: ClassVar[str]
@abstractmethod
def verify_config(self) -> None:
"""Verify configuration settings."""
raise NotImplementedError
@abstractmethod
def get_config(self) -> dict[str, Any]:
"""Configure attributes for frontend"""
raise NotImp... | @@ -42,3 +42,9 @@ class LLMAuthenticationError(ValueError):
"""Raised when there is an issue with LLM authentication."""
pass
+
+
+class SessionExpiredError(ValueError): | openhands/server/types.py | 26 | Python | 0.786 | suggestion | 204 | 51 | 30 | false | Handle expired Keycloak session with user-friendly error message | 12,168 | All-Hands-AI/OpenHands | 55,974 | Python | enyst | xingyaoww | Review this pull request change.
Language: Python
File: openhands/server/types.py
PR Title: Handle expired Keycloak session with user-friendly error message
BEFORE CODE: from abc import ABC, abstractmethod
from enum import Enum
from typing import Any, ClassVar, Protocol
class AppMode(Enum):
OSS = 'oss'
SA... | I like to think that maybe the whole `openhands/server/` module will be obsoleted, but maybe `types.py` stays for V1? If not, another spot might be better
Just a tiny thought in passing, nothing big 😅 | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
import { ConversationStatus } from "#/types/conversation-status";
import { cn, getConversationStatusLabel } from "#/utils/utils";
import { I18nKey } from "#/i18n/declaration";
import { StyledTooltip } from "#/components/shared/buttons/styled-tooltip";
interface ConversationStatusIndicatorProps {
conversationStatus: ... | Keep the comments that you removed here for now | import { ConversationStatus } from "#/types/conversation-status";
import { cn, getConversationStatusLabel } from "#/utils/utils";
import { I18nKey } from "#/i18n/declaration";
import { StyledTooltip } from "#/components/shared/buttons/styled-tooltip";
interface ConversationStatusIndicatorProps {
conversationStatus: ... | @@ -17,15 +17,15 @@ export function ConversationStatusIndicator({
const conversationStatusBackgroundColor = useMemo(() => {
switch (conversationStatus) {
case "STOPPED":
- return "bg-[#3C3C49]"; // Inactive/stopped - grey
+ return "bg-[#3C3C49]";
case "RUNNING":
- return "bg-[... | frontend/src/components/features/home/recent-conversations/conversation-status-indicator.tsx | 26 | TypeScript | 0.143 | suggestion | 47 | 50 | 50 | false | fix: prevent nested buttons in tooltip button | 12,177 | All-Hands-AI/OpenHands | 55,974 | Python | amanape | AVBharath10 | Review this pull request change.
Language: TypeScript
File: frontend/src/components/features/home/recent-conversations/conversation-status-indicator.tsx
PR Title: fix: prevent nested buttons in tooltip button
BEFORE CODE: import { ConversationStatus } from "#/types/conversation-status";
import { cn, getConversation... | Keep the comments that you removed here for now | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
import { NavLink, useLocation } from "react-router";
import { useTranslation } from "react-i18next";
import { I18nKey } from "#/i18n/declaration";
import { StyledTooltip } from "#/components/shared/buttons/styled-tooltip";
import PlusIcon from "#/icons/u-plus.svg?react";
interface NewProjectButtonProps {
disabled?: ... | Something odd here, we didn't have this background color on the + icon before:
<img width="64" height="218" alt="Image" src="https://github.com/user-attachments/assets/1f0ce20c-8d1b-4a55-a327-299f94ac37c7" /> | import { NavLink } from "react-router";
import { useTranslation } from "react-i18next";
import { I18nKey } from "#/i18n/declaration";
import { StyledTooltip } from "#/components/shared/buttons/styled-tooltip";
import PlusIcon from "#/icons/u-plus.svg?react";
import { cn } from "#/utils/utils";
interface NewProjectButt... | frontend/src/components/shared/buttons/new-project-button.tsx | 1 | TypeScript | 0.5 | suggestion | 209 | 26 | 26 | false | fix: prevent nested buttons in tooltip button | 12,177 | All-Hands-AI/OpenHands | 55,974 | Python | amanape | AVBharath10 | Review this pull request change.
Language: TypeScript
File: frontend/src/components/shared/buttons/new-project-button.tsx
PR Title: fix: prevent nested buttons in tooltip button
BEFORE CODE: import { NavLink, useLocation } from "react-router";
import { useTranslation } from "react-i18next";
import { I18nKey } from ... | Something odd here, we didn't have this background color on the + icon before:
<img width="64" height="218" alt="Image" src="https://github.com/user-attachments/assets/1f0ce20c-8d1b-4a55-a327-299f94ac37c7" /> | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. | |
interface NewProjectButtonProps {
disabled?: boolean;
}
export function NewProjectButton({ disabled = false }: NewProjectButtonProps) {
const { pathname } = useLocation();
const { t } = useTranslation();
const startNewProject = t(I18nKey.CONVERSATION$START_NEW);
return (
<StyledTooltip content={startN... | ```suggestion
className={cn("button-base inline-flex items-center justify-center", {
"pointer-events-none opacity-50": disabled,
})}
```
Use our `cn` util: https://github.com/OpenHands/OpenHands/blob/b5758b160415455976de704e0ead4567b0c74c2d/frontend/src/utils/utils.ts#L11 | import { cn } from "#/utils/utils";
interface NewProjectButtonProps {
disabled?: boolean;
}
export function NewProjectButton({ disabled = false }: NewProjectButtonProps) {
const { t } = useTranslation();
const startNewProject = t(I18nKey.CONVERSATION$START_NEW);
return (
<StyledTooltip
content={st... | @@ -10,24 +10,32 @@ interface NewProjectButtonProps {
export function NewProjectButton({ disabled = false }: NewProjectButtonProps) {
const { pathname } = useLocation();
-
const { t } = useTranslation();
const startNewProject = t(I18nKey.CONVERSATION$START_NEW);
return (
- <TooltipButton
- to... | frontend/src/components/shared/buttons/new-project-button.tsx | 26 | TypeScript | 0.857 | suggestion | 299 | 37 | 37 | false | fix: prevent nested buttons in tooltip button | 12,177 | All-Hands-AI/OpenHands | 55,974 | Python | amanape | AVBharath10 | Review this pull request change.
Language: TypeScript
File: frontend/src/components/shared/buttons/new-project-button.tsx
PR Title: fix: prevent nested buttons in tooltip button
BEFORE CODE:
interface NewProjectButtonProps {
disabled?: boolean;
}
export function NewProjectButton({ disabled = false }: NewProject... | ```suggestion
className={cn("button-base inline-flex items-center justify-center", {
"pointer-events-none opacity-50": disabled,
})}
```
Use our `cn` util: https://github.com/OpenHands/OpenHands/blob/b5758b160415455976de704e0ead4567b0c74c2d/frontend/src/utils/utils.ts#L11 | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
import { OHEvent } from "#/stores/use-event-store";
import { isActionOrObservation, isSystemMessage } from "#/types/core/guards";
import { ChatCompletionToolParam } from "#/types/v1/core";
import {
isSystemPromptEvent,
isV0Event,
isV1Event,
} from "#/types/v1/type-guards";
export interface SystemMessageForModal ... | Please translate comments to English, thank you! | import { OHEvent } from "#/stores/use-event-store";
import { isActionOrObservation, isSystemMessage } from "#/types/core/guards";
import { ChatCompletionToolParam } from "#/types/v1/core";
import {
isSystemPromptEvent,
isV0Event,
isV1Event,
} from "#/types/v1/type-guards";
export interface SystemMessageForModal ... | @@ -0,0 +1,48 @@
+import { OHEvent } from "#/stores/use-event-store";
+import { isActionOrObservation, isSystemMessage } from "#/types/core/guards";
+import { ChatCompletionToolParam } from "#/types/v1/core";
+import {
+ isSystemPromptEvent,
+ isV0Event,
+ isV1Event,
+} from "#/types/v1/type-guards";
+
+export inter... | frontend/src/utils/system-message-adapter.ts | 21 | TypeScript | 0.071 | suggestion | 48 | 46 | 46 | false | fix(frontend): Agent Tools & Metadata not available for V1 conversations | 12,180 | All-Hands-AI/OpenHands | 55,974 | Python | amanape | kub938 | Review this pull request change.
Language: TypeScript
File: frontend/src/utils/system-message-adapter.ts
PR Title: fix(frontend): Agent Tools & Metadata not available for V1 conversations
BEFORE CODE: import { OHEvent } from "#/stores/use-event-store";
import { isActionOrObservation, isSystemMessage } from "#/type... | Please translate comments to English, thank you! | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
import { describe, it, expect, vi } from "vitest";
import { render, screen } from "@testing-library/react";
import React from "react";
import { adaptSystemMessage } from "#/utils/system-message-adapter";
import { EventState } from "#/stores/use-event-store";
import { SystemMessageModal } from "#/components/features/con... | Please translate comments to English, thank you! | import { describe, it, expect, vi } from "vitest";
import { render, screen } from "@testing-library/react";
import React from "react";
import { adaptSystemMessage } from "#/utils/system-message-adapter";
import { EventState } from "#/stores/use-event-store";
import { SystemMessageModal } from "#/components/features/con... | @@ -0,0 +1,71 @@
+import { describe, it, expect, vi } from "vitest";
+import { render, screen } from "@testing-library/react";
+import React from "react";
+import { adaptSystemMessage } from "#/utils/system-message-adapter";
+import { EventState } from "#/stores/use-event-store";
+import { SystemMessageModal } from "#/... | frontend/__tests__/components/context-menu/tools-context-menu.test.tsx | 10 | TypeScript | 0.071 | suggestion | 48 | 35 | 35 | false | fix(frontend): Agent Tools & Metadata not available for V1 conversations | 12,180 | All-Hands-AI/OpenHands | 55,974 | Python | amanape | kub938 | Review this pull request change.
Language: TypeScript
File: frontend/__tests__/components/context-menu/tools-context-menu.test.tsx
PR Title: fix(frontend): Agent Tools & Metadata not available for V1 conversations
BEFORE CODE: import { describe, it, expect, vi } from "vitest";
import { render, screen } from "@test... | Please translate comments to English, thank you! | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
REQUIRE_PAYMENT = os.environ.get('REQUIRE_PAYMENT', '0') in ('1', 'true')
SLACK_CLIENT_ID = os.environ.get('SLACK_CLIENT_ID', None)
SLACK_CLIENT_SECRET = os.environ.get('SLACK_CLIENT_SECRET', None)
SLACK_SIGNING_SECRET = os.environ.get('SLACK_SIGNING_SECRET', None)
SLACK_WEBHOOKS_ENABLED = os.environ.get('SLACK_WEBHOO... | ```suggestion
if 'litellm' in model_name:
``` | REQUIRE_PAYMENT = os.environ.get('REQUIRE_PAYMENT', '0') in ('1', 'true')
SLACK_CLIENT_ID = os.environ.get('SLACK_CLIENT_ID', None)
SLACK_CLIENT_SECRET = os.environ.get('SLACK_CLIENT_SECRET', None)
SLACK_SIGNING_SECRET = os.environ.get('SLACK_SIGNING_SECRET', None)
SLACK_WEBHOOKS_ENABLED = os.environ.get('SLACK_WEBHOO... | @@ -73,36 +73,22 @@
def build_litellm_proxy_model_path(model_name: str) -> str:
- """
- Build the LiteLLM proxy model path based on environment and model name.
-
- This utility constructs the full model path for LiteLLM proxy based on:
- - Environment type (staging vs prod)
- - The provided model na... | enterprise/server/constants.py | 26 | Python | 0.429 | suggestion | 49 | 38 | 38 | false | Remove prod/ prefix from litellm proxy model path | 12,200 | All-Hands-AI/OpenHands | 55,974 | Python | xingyaoww | xingyaoww | Review this pull request change.
Language: Python
File: enterprise/server/constants.py
PR Title: Remove prod/ prefix from litellm proxy model path
BEFORE CODE: REQUIRE_PAYMENT = os.environ.get('REQUIRE_PAYMENT', '0') in ('1', 'true')
SLACK_CLIENT_ID = os.environ.get('SLACK_CLIENT_ID', None)
SLACK_CLIENT_SECRET = o... | ```suggestion
if 'litellm' in model_name:
``` | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
Args:
byor_key: The BYOR key to verify
user_id: The user ID for logging purposes
Returns:
True if the key is valid, False otherwise
"""
if not (LITE_LLM_API_URL and byor_key):
return False
try:
async with httpx.AsyncClient(
verify=httpx_verify_op... | would we get a response code like this or would a `HTTPStatusCode` error be thrown instead? |
async def verify_byor_key_in_litellm(byor_key: str, user_id: str) -> bool:
"""Verify that a BYOR key is valid in LiteLLM by making a lightweight API call.
Args:
byor_key: The BYOR key to verify
user_id: The user ID for logging purposes
Returns:
True if the key is verified as valid... | @@ -112,6 +112,82 @@ async def generate_byor_key(user_id: str) -> str | None:
return None
+async def verify_byor_key_in_litellm(byor_key: str, user_id: str) -> bool:
+ """Verify that a BYOR key is valid in LiteLLM by making a lightweight API call.
+
+ Args:
+ byor_key: The BYOR key to verify
+... | enterprise/server/routes/api_keys.py | 26 | Python | 0.571 | question | 91 | 51 | 51 | false | fix(backend): invalid api key | 12,217 | All-Hands-AI/OpenHands | 55,974 | Python | malhotra5 | hieptl | Review this pull request change.
Language: Python
File: enterprise/server/routes/api_keys.py
PR Title: fix(backend): invalid api key
BEFORE CODE: Args:
byor_key: The BYOR key to verify
user_id: The user ID for logging purposes
Returns:
True if the key is valid, False otherwise
"... | would we get a response code like this or would a `HTTPStatusCode` error be thrown instead? | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
True if the key is valid, False otherwise
"""
if not (LITE_LLM_API_URL and byor_key):
return False
try:
async with httpx.AsyncClient(
verify=httpx_verify_option(),
timeout=5.0, # Short timeout for lightweight verification
) as client:
# M... | Would `response.is_success` make more sense here? (Just as a general principle - it means that we don't cut off other responses like 301, 201, etc...) | byor_key: The BYOR key to verify
user_id: The user ID for logging purposes
Returns:
True if the key is verified as valid, False if verification fails or key is invalid.
Returns False on network errors/timeouts to ensure we don't return potentially invalid keys.
"""
if not (L... | @@ -112,6 +112,82 @@ async def generate_byor_key(user_id: str) -> str | None:
return None
+async def verify_byor_key_in_litellm(byor_key: str, user_id: str) -> bool:
+ """Verify that a BYOR key is valid in LiteLLM by making a lightweight API call.
+
+ Args:
+ byor_key: The BYOR key to verify
+... | enterprise/server/routes/api_keys.py | 26 | Python | 0.5 | suggestion | 150 | 51 | 51 | false | fix(backend): invalid api key | 12,217 | All-Hands-AI/OpenHands | 55,974 | Python | tofarr | hieptl | Review this pull request change.
Language: Python
File: enterprise/server/routes/api_keys.py
PR Title: fix(backend): invalid api key
BEFORE CODE: True if the key is valid, False otherwise
"""
if not (LITE_LLM_API_URL and byor_key):
return False
try:
async with httpx.AsyncClient(... | Would `response.is_success` make more sense here? (Just as a general principle - it means that we don't cut off other responses like 301, 201, etc...) | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
renderWithProviders(
<MemoryRouter>
<ChatInterface />
</MemoryRouter>,
);
// Helper function to render with QueryClientProvider and Router (for newer tests)
const renderWithQueryClient = (
ui: React.ReactElement,
queryClient: QueryClient,
route = "/test-conversation-id",
) =>
render(
<Que... | ```suggestion
vi.mocked(useConversationId).mockReturnValue({
```
Type helper to avoid casting, see more at https://vitest.dev/api/vi.html#vi-mocked | renderWithProviders(
<MemoryRouter>
<ChatInterface />
</MemoryRouter>,
);
// Helper function to render with QueryClientProvider and Router (for newer tests)
const renderWithQueryClient = (
ui: React.ReactElement,
queryClient: QueryClient,
route = "/test-conversation-id",
) =>
render(
<Que... | @@ -87,13 +77,26 @@ const renderChatInterface = (messages: Message[]) =>
const renderWithQueryClient = (
ui: React.ReactElement,
queryClient: QueryClient,
+ route = "/test-conversation-id",
) =>
render(
<QueryClientProvider client={queryClient}>
- <MemoryRouter>{ui}</MemoryRouter>
+ <MemoryRo... | frontend/__tests__/components/chat/chat-interface.test.tsx | 26 | TypeScript | 0.929 | refactor | 150 | 51 | 51 | false | feat: add chat message skeletons and improve routing stability | 12,223 | All-Hands-AI/OpenHands | 55,974 | Python | amanape | Ryanakml | Review this pull request change.
Language: TypeScript
File: frontend/__tests__/components/chat/chat-interface.test.tsx
PR Title: feat: add chat message skeletons and improve routing stability
BEFORE CODE: renderWithProviders(
<MemoryRouter>
<ChatInterface />
</MemoryRouter>,
);
// Helper function... | ```suggestion
vi.mocked(useConversationId).mockReturnValue({
```
Type helper to avoid casting, see more at https://vitest.dev/api/vi.html#vi-mocked | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
import { useEffect } from "react";
import { useParams } from "react-router";
import { useUserConversation } from "./use-user-conversation";
import ConversationService from "#/api/conversation-service/conversation-service.api";
export const useActiveConversation = () => {
const { conversationId } = useParams<{ conver... | Also unclear as to why these changes were necessary | import { useEffect } from "react";
import { useConversationId } from "#/hooks/use-conversation-id";
import { useUserConversation } from "./use-user-conversation";
import ConversationService from "#/api/conversation-service/conversation-service.api";
export const useActiveConversation = () => {
const { conversationId... | frontend/src/hooks/query/use-active-conversation.ts | 1 | TypeScript | 0.286 | suggestion | 51 | 26 | 26 | false | feat: add chat message skeletons and improve routing stability | 12,223 | All-Hands-AI/OpenHands | 55,974 | Python | amanape | Ryanakml | Review this pull request change.
Language: TypeScript
File: frontend/src/hooks/query/use-active-conversation.ts
PR Title: feat: add chat message skeletons and improve routing stability
BEFORE CODE: import { useEffect } from "react";
import { useParams } from "react-router";
import { useUserConversation } from "./us... | Also unclear as to why these changes were necessary | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. | |
import { useEffect } from "react";
import { useNavigate, useParams } from "react-router";
import { useQuery } from "@tanstack/react-query";
import V1ConversationService from "#/api/conversation-service/v1-conversation-service.api";
/**
* Hook that polls V1 conversation start tasks and navigates when ready.
*
* This... | Unclear why these changes were required | import { useEffect } from "react";
import { useNavigate } from "react-router";
import { useQuery } from "@tanstack/react-query";
import V1ConversationService from "#/api/conversation-service/v1-conversation-service.api";
import { useConversationId } from "#/hooks/use-conversation-id";
/**
* Hook that polls V1 convers... | frontend/src/hooks/query/use-task-polling.ts | 1 | TypeScript | 0.143 | suggestion | 39 | 26 | 26 | false | feat: add chat message skeletons and improve routing stability | 12,223 | All-Hands-AI/OpenHands | 55,974 | Python | amanape | Ryanakml | Review this pull request change.
Language: TypeScript
File: frontend/src/hooks/query/use-task-polling.ts
PR Title: feat: add chat message skeletons and improve routing stability
BEFORE CODE: import { useEffect } from "react";
import { useNavigate, useParams } from "react-router";
import { useQuery } from "@tanstack... | Unclear why these changes were required | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. | |
}
// NOTE: conversation?.status is intentionally NOT in dependencies
// We only want to run when conversation ID changes, not when status changes
// This prevents duplicate calls when stale cache data is replaced with fresh data
}, [
conversation?.conversation_id,
isFetched,
isAuthed,
... | **question:** Adding the <title> tag to the root layout does not affect the conversation page? Could you clarify why it was necessary to include the <title> tag in this location? Thank you! 🙏 | // We only want to run when conversation ID changes, not when status changes
// This prevents duplicate calls when stale cache data is replaced with fresh data
}, [
conversation?.conversation_id,
isFetched,
isAuthed,
isStarting,
providers,
startConversation,
navigate,
refetch,
... | @@ -159,6 +156,7 @@ function AppContent() {
data-testid="app-route"
className="p-3 md:p-0 flex flex-col h-full gap-3"
>
+ <title>{appTitle}</title> | frontend/src/routes/conversation.tsx | 26 | TypeScript | 0.429 | suggestion | 192 | 51 | 51 | false | feat(frontend): create `useAppTitle` hook for dynamic document titles | 12,224 | All-Hands-AI/OpenHands | 55,974 | Python | hieptl | amanape | Review this pull request change.
Language: TypeScript
File: frontend/src/routes/conversation.tsx
PR Title: feat(frontend): create `useAppTitle` hook for dynamic document titles
BEFORE CODE: }
// NOTE: conversation?.status is intentionally NOT in dependencies
// We only want to run when conversation ID c... | **question:** Adding the <title> tag to the root layout does not affect the conversation page? Could you clarify why it was necessary to include the <title> tag in this location? Thank you! 🙏 | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
return (
<div
data-testid="conversation-card-skeleton"
className="relative h-auto w-full p-3.5 border-b border-neutral-600"
>
{/* Header */}
<div className="flex items-center justify-between w-full">
{/* Left: status + title */}
<div className="flex items-center gap-2 w... | **suggestion:** Could you please remove the comments here for now? It appears that similar comments are not included in other skeleton files. Thank you! 🙏 | import React from "react";
export function ConversationCardSkeleton() {
return (
<div
data-testid="conversation-card-skeleton"
className="relative h-auto w-full p-3.5 border-b border-neutral-600"
>
<div className="flex items-center justify-between w-full">
<div className="flex items... | @@ -0,0 +1,34 @@
+import React from "react";
+
+export function ConversationCardSkeleton() {
+ return (
+ <div
+ data-testid="conversation-card-skeleton"
+ className="relative h-auto w-full p-3.5 border-b border-neutral-600"
+ >
+ {/* Header */}
+ <div className="flex items-center justify-bet... | frontend/src/components/features/conversation-panel/conversation-card/conversation-card-skeleton.tsx | 26 | TypeScript | 0.429 | suggestion | 155 | 32 | 25 | false | Replace conversation loading spinner with skeleton cards | 12,230 | All-Hands-AI/OpenHands | 55,974 | Python | hieptl | adithya-naik | Review this pull request change.
Language: TypeScript
File: frontend/src/components/features/conversation-panel/conversation-card/conversation-card-skeleton.tsx
PR Title: Replace conversation loading spinner with skeleton cards
BEFORE CODE: return (
<div
data-testid="conversation-card-skeleton"
cl... | **suggestion:** Could you please remove the comments here for now? It appears that similar comments are not included in other skeleton files. Thank you! 🙏 | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
},
);
}
};
const handleConfirmStop = () => {
if (selectedConversationId) {
pauseConversationSandbox({
conversationId: selectedConversationId,
version: selectedConversationVersion,
});
}
};
return (
<div
ref={(node) => {
// TODO: Combine b... | **suggestion:** I believe we should add additional tests in this case. The conversation card skeleton should only be rendered when conversations are being fetched or when the list of conversations is empty. Thank you! 🙏 | },
);
}
};
const handleConfirmStop = () => {
if (selectedConversationId) {
pauseConversationSandbox({
conversationId: selectedConversationId,
version: selectedConversationVersion,
});
}
};
return (
<div
ref={(node) => {
// TODO: Combine b... | @@ -140,10 +141,13 @@ export function ConversationPanel({ onClose }: ConversationPanelProps) {
className="w-full md:w-[400px] h-full border border-[#525252] bg-[#25272D] rounded-lg overflow-y-auto absolute custom-scrollbar-always"
>
{isFetching && conversations.length === 0 && ( | frontend/src/components/features/conversation-panel/conversation-panel.tsx | 26 | TypeScript | 0.5 | suggestion | 220 | 51 | 51 | false | Replace conversation loading spinner with skeleton cards | 12,230 | All-Hands-AI/OpenHands | 55,974 | Python | hieptl | adithya-naik | Review this pull request change.
Language: TypeScript
File: frontend/src/components/features/conversation-panel/conversation-panel.tsx
PR Title: Replace conversation loading spinner with skeleton cards
BEFORE CODE: },
);
}
};
const handleConfirmStop = () => {
if (selectedConversationId) {... | **suggestion:** I believe we should add additional tests in this case. The conversation card skeleton should only be rendered when conversations are being fetched or when the list of conversations is empty. Thank you! 🙏 | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
import React from "react";
export function ConversationCardSkeleton() {
return (
<div
data-testid="conversation-card-skeleton"
className="relative h-auto w-full p-3.5 border-b border-neutral-600"
>
<div className="flex items-center justify-between w-full">
<div className="flex items... | ```suggestion
```
The actual component here is an ellipses, not a circle. I’d prefer to remove this | import React from "react";
export function ConversationCardSkeleton() {
return (
<div
data-testid="conversation-card-skeleton"
className="relative h-auto w-full p-3.5 border-b border-neutral-600"
>
<div className="flex items-center justify-between w-full">
<div className="flex items... | @@ -0,0 +1,22 @@
+import React from "react";
+
+export function ConversationCardSkeleton() {
+ return (
+ <div
+ data-testid="conversation-card-skeleton"
+ className="relative h-auto w-full p-3.5 border-b border-neutral-600"
+ >
+ <div className="flex items-center justify-between w-full">
+ ... | frontend/src/components/features/conversation-panel/conversation-card/conversation-card-skeleton.tsx | 14 | TypeScript | 0.786 | refactor | 100 | 23 | 25 | false | Replace conversation loading spinner with skeleton cards | 12,230 | All-Hands-AI/OpenHands | 55,974 | Python | amanape | adithya-naik | Review this pull request change.
Language: TypeScript
File: frontend/src/components/features/conversation-panel/conversation-card/conversation-card-skeleton.tsx
PR Title: Replace conversation loading spinner with skeleton cards
BEFORE CODE: import React from "react";
export function ConversationCardSkeleton() {
... | ```suggestion
```
The actual component here is an ellipses, not a circle. I’d prefer to remove this | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
import React from "react";
export function ConversationCardSkeleton() {
return (
<div
data-testid="conversation-card-skeleton"
className="relative h-auto w-full p-3.5 border-b border-neutral-600"
>
<div className="flex items-center justify-between w-full">
<div className="flex items... | ```suggestion
<div className="skeleton-round h-1.5 w-1.5" />
```
More representative of the actual size of the indicator | import React from "react";
export function ConversationCardSkeleton() {
return (
<div
data-testid="conversation-card-skeleton"
className="relative h-auto w-full p-3.5 border-b border-neutral-600"
>
<div className="flex items-center justify-between w-full">
<div className="flex items... | @@ -0,0 +1,22 @@
+import React from "react";
+
+export function ConversationCardSkeleton() {
+ return (
+ <div
+ data-testid="conversation-card-skeleton"
+ className="relative h-auto w-full p-3.5 border-b border-neutral-600"
+ >
+ <div className="flex items-center justify-between w-full">
+ ... | frontend/src/components/features/conversation-panel/conversation-card/conversation-card-skeleton.tsx | 11 | TypeScript | 0.714 | suggestion | 131 | 23 | 25 | false | Replace conversation loading spinner with skeleton cards | 12,230 | All-Hands-AI/OpenHands | 55,974 | Python | amanape | adithya-naik | Review this pull request change.
Language: TypeScript
File: frontend/src/components/features/conversation-panel/conversation-card/conversation-card-skeleton.tsx
PR Title: Replace conversation loading spinner with skeleton cards
BEFORE CODE: import React from "react";
export function ConversationCardSkeleton() {
... | ```suggestion
<div className="skeleton-round h-1.5 w-1.5" />
```
More representative of the actual size of the indicator | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
import React from "react";
export function ConversationCardSkeleton() {
return (
<div
data-testid="conversation-card-skeleton"
className="relative h-auto w-full p-3.5 border-b border-neutral-600"
>
<div className="flex items-center justify-between w-full">
<div className="flex items... | ```suggestion
<div className="flex justify-between">
<div className="skeleton h-3 w-1/4 rounded" />
<div className="skeleton h-3 w-8 rounded" />
</div>
```
Skeleton for the timestamp | import React from "react";
export function ConversationCardSkeleton() {
return (
<div
data-testid="conversation-card-skeleton"
className="relative h-auto w-full p-3.5 border-b border-neutral-600"
>
<div className="flex items-center justify-between w-full">
<div className="flex items... | @@ -0,0 +1,22 @@
+import React from "react";
+
+export function ConversationCardSkeleton() {
+ return (
+ <div
+ data-testid="conversation-card-skeleton"
+ className="relative h-auto w-full p-3.5 border-b border-neutral-600"
+ >
+ <div className="flex items-center justify-between w-full">
+ ... | frontend/src/components/features/conversation-panel/conversation-card/conversation-card-skeleton.tsx | 18 | TypeScript | 0.786 | suggestion | 219 | 23 | 25 | false | Replace conversation loading spinner with skeleton cards | 12,230 | All-Hands-AI/OpenHands | 55,974 | Python | amanape | adithya-naik | Review this pull request change.
Language: TypeScript
File: frontend/src/components/features/conversation-panel/conversation-card/conversation-card-skeleton.tsx
PR Title: Replace conversation loading spinner with skeleton cards
BEFORE CODE: import React from "react";
export function ConversationCardSkeleton() {
... | ```suggestion
<div className="flex justify-between">
<div className="skeleton h-3 w-1/4 rounded" />
<div className="skeleton h-3 w-8 rounded" />
</div>
```
Skeleton for the timestamp | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
# IMPORTANT: LEGACY V0 CODE
# This file is part of the legacy (V0) implementation of OpenHands and will be removed soon as we complete the migration to V1.
# OpenHands V1 uses the Software Agent SDK for the agentic core and runs a new application server. Please refer to:
# - V1 agentic core (SDK): https://github.com/... | We could give up this one. TBH I'm not terribly fond of new env vars, I think maybe we have too many already... | # IMPORTANT: LEGACY V0 CODE
# This file is part of the legacy (V0) implementation of OpenHands and will be removed soon as we complete the migration to V1.
# OpenHands V1 uses the Software Agent SDK for the agentic core and runs a new application server. Please refer to:
# - V1 agentic core (SDK): https://github.com/... | @@ -9,13 +9,15 @@
import os
from openhands.core.logger import openhands_logger as logger
-from openhands.server.types import AppMode, ServerConfigInterface
+from openhands.server.types import ServerConfigInterface, parse_app_mode
from openhands.utils.import_utils import get_impl
class ServerConfig(ServerConfi... | openhands/server/config/server_config.py | 20 | Python | 0.429 | suggestion | 111 | 45 | 45 | false | Clarify OpenHands naming (replace “OSS” wording in docs and backend) | 12,235 | All-Hands-AI/OpenHands | 55,974 | Python | enyst | enyst | Review this pull request change.
Language: Python
File: openhands/server/config/server_config.py
PR Title: Clarify OpenHands naming (replace “OSS” wording in docs and backend)
BEFORE CODE: # IMPORTANT: LEGACY V0 CODE
# This file is part of the legacy (V0) implementation of OpenHands and will be removed soon as we c... | We could give up this one. TBH I'm not terribly fond of new env vars, I think maybe we have too many already... | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
import { render, screen, waitFor } from "@testing-library/react";
import { createRoutesStub } from "react-router";
import { beforeEach, describe, expect, it, vi } from "vitest";
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
import userEvent from "@testing-library/user-event";
import i18next ... | This is supposed to represent the mock response values of the app locally and not on the cloud, now it looks like it represents the response value for ALL modes | import { render, screen, waitFor } from "@testing-library/react";
import { createRoutesStub } from "react-router";
import { beforeEach, describe, expect, it, vi } from "vitest";
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
import userEvent from "@testing-library/user-event";
import i18next ... | @@ -15,7 +15,7 @@ import * as ToastHandlers from "#/utils/custom-toast-handlers";
import { SecretsService } from "#/api/secrets-service";
import { integrationService } from "#/api/integration-service/integration-service.api";
-const VALID_OSS_CONFIG: GetConfigResponse = {
+const VALID_OPENHANDS_CONFIG: GetConfigRes... | frontend/__tests__/routes/git-settings.test.tsx | 18 | TypeScript | 0.357 | suggestion | 160 | 43 | 43 | false | Clarify OpenHands naming (replace “OSS” wording in docs and backend) | 12,235 | All-Hands-AI/OpenHands | 55,974 | Python | amanape | enyst | Review this pull request change.
Language: TypeScript
File: frontend/__tests__/routes/git-settings.test.tsx
PR Title: Clarify OpenHands naming (replace “OSS” wording in docs and backend)
BEFORE CODE: import { render, screen, waitFor } from "@testing-library/react";
import { createRoutesStub } from "react-router";
i... | This is supposed to represent the mock response values of the app locally and not on the cloud, now it looks like it represents the response value for ALL modes | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
export function UserActions({ onLogout, user, isLoading }: UserActionsProps) {
const [accountContextMenuIsVisible, setAccountContextMenuIsVisible] =
React.useState(false);
const { data: config } = useConfig();
// Use the shared hook to determine if user actions should be shown
const shouldShowUserActions ... | This looks more confusing now since the constant was representing the app mode | export function UserActions({ onLogout, user, isLoading }: UserActionsProps) {
const [accountContextMenuIsVisible, setAccountContextMenuIsVisible] =
React.useState(false);
const { data: config } = useConfig();
// Use the shared hook to determine if user actions should be shown
const shouldShowUserActions ... | @@ -36,11 +36,11 @@ export function UserActions({ onLogout, user, isLoading }: UserActionsProps) {
closeAccountMenu();
};
- const isOSS = config?.APP_MODE === "oss";
+ const isOpenHandsMode = config?.APP_MODE === "oss"; | frontend/src/components/features/sidebar/user-actions.tsx | 26 | TypeScript | 0.214 | suggestion | 78 | 51 | 51 | false | Clarify OpenHands naming (replace “OSS” wording in docs and backend) | 12,235 | All-Hands-AI/OpenHands | 55,974 | Python | amanape | enyst | Review this pull request change.
Language: TypeScript
File: frontend/src/components/features/sidebar/user-actions.tsx
PR Title: Clarify OpenHands naming (replace “OSS” wording in docs and backend)
BEFORE CODE: export function UserActions({ onLogout, user, isLoading }: UserActionsProps) {
const [accountContextMenu... | This looks more confusing now since the constant was representing the app mode | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
import { useParams } from "react-router";
import { useConfig } from "#/hooks/query/use-config";
import { useUserConversation } from "#/hooks/query/use-user-conversation";
const APP_TITLE_OPENHANDS = "OpenHands";
const APP_TITLE_SAAS = "OpenHands Cloud";
/**
* Hook that returns the appropriate document title based on... | This is a little more confusing now. | import { useParams } from "react-router";
import { useConfig } from "#/hooks/query/use-config";
import { useUserConversation } from "#/hooks/query/use-user-conversation";
const APP_TITLE_OSS = "OpenHands";
const APP_TITLE_SAAS = "OpenHands Cloud";
/**
* Hook that returns the appropriate document title based on APP_M... | @@ -2,7 +2,7 @@ import { useParams } from "react-router";
import { useConfig } from "#/hooks/query/use-config";
import { useUserConversation } from "#/hooks/query/use-user-conversation";
-const APP_TITLE_OSS = "OpenHands";
+const APP_TITLE_OPENHANDS = "OpenHands";
const APP_TITLE_SAAS = "OpenHands Cloud"; | frontend/src/hooks/use-app-title.ts | 6 | TypeScript | 0.071 | suggestion | 36 | 28 | 27 | false | Clarify OpenHands naming (replace “OSS” wording in docs and backend) | 12,235 | All-Hands-AI/OpenHands | 55,974 | Python | amanape | enyst | Review this pull request change.
Language: TypeScript
File: frontend/src/hooks/use-app-title.ts
PR Title: Clarify OpenHands naming (replace “OSS” wording in docs and backend)
BEFORE CODE: import { useParams } from "react-router";
import { useConfig } from "#/hooks/query/use-config";
import { useUserConversation } f... | This is a little more confusing now. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
import { useTranslation } from "react-i18next";
import React from "react";
import { FileDiffViewer } from "#/components/features/diff-viewer/file-diff-viewer";
import { retrieveAxiosErrorMessage } from "#/utils/retrieve-axios-error-message";
import { useUnifiedGetGitChanges } from "#/hooks/query/use-unified-get-git-cha... | **suggestion:** Could we move this component into a separate file and add tests to cover it? | import { useTranslation } from "react-i18next";
import React from "react";
import { FileDiffViewer } from "#/components/features/diff-viewer/file-diff-viewer";
import { EmptyChangesMessage } from "#/components/features/diff-viewer/empty-changes-message";
import { retrieveAxiosErrorMessage } from "#/utils/retrieve-axios... | @@ -19,6 +20,19 @@ function StatusMessage({ children }: React.PropsWithChildren) {
);
}
+function EmptyChangesMessage() { | frontend/src/routes/changes-tab.tsx | 23 | TypeScript | 0.286 | refactor | 92 | 48 | 48 | false | feat: add empty state to Changes tab with icon and message | 12,237 | All-Hands-AI/OpenHands | 55,974 | Python | hieptl | naaa760 | Review this pull request change.
Language: TypeScript
File: frontend/src/routes/changes-tab.tsx
PR Title: feat: add empty state to Changes tab with icon and message
BEFORE CODE: import { useTranslation } from "react-i18next";
import React from "react";
import { FileDiffViewer } from "#/components/features/diff-view... | **suggestion:** Could we move this component into a separate file and add tests to cover it? | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
import { useTranslation } from "react-i18next";
import { FaCodeCompare } from "react-icons/fa6";
import { I18nKey } from "#/i18n/declaration";
export function EmptyChangesMessage() {
const { t } = useTranslation();
return (
<div className="flex flex-col items-center justify-center w-full h-full p-10 gap-4">
... | ```suggestion
<FaCodeCompare size={100} className="text-[#A1A1A1]" />
``` | import { useTranslation } from "react-i18next";
import { FaCodeCompare } from "react-icons/fa6";
import { I18nKey } from "#/i18n/declaration";
export function EmptyChangesMessage() {
const { t } = useTranslation();
return (
<div className="flex flex-col items-center justify-center w-full h-full p-10 gap-4">
... | @@ -0,0 +1,16 @@
+import { useTranslation } from "react-i18next";
+import { FaCodeCompare } from "react-icons/fa6";
+import { I18nKey } from "#/i18n/declaration";
+
+export function EmptyChangesMessage() {
+ const { t } = useTranslation();
+
+ return (
+ <div className="flex flex-col items-center justify-center w-... | frontend/src/components/features/diff-viewer/empty-changes-message.tsx | 10 | TypeScript | 0.571 | suggestion | 79 | 17 | 17 | false | feat: add empty state to Changes tab with icon and message | 12,237 | All-Hands-AI/OpenHands | 55,974 | Python | amanape | naaa760 | Review this pull request change.
Language: TypeScript
File: frontend/src/components/features/diff-viewer/empty-changes-message.tsx
PR Title: feat: add empty state to Changes tab with icon and message
BEFORE CODE: import { useTranslation } from "react-i18next";
import { FaCodeCompare } from "react-icons/fa6";
import... | ```suggestion
<FaCodeCompare size={100} className="text-[#A1A1A1]" />
``` | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
Returns:
The single matching event, or None if no events found
Raises:
AssertionError: If more than one event is returned or type doesn't match
"""
events = list(
event_store.search_events(
filter=event_filter,
limit=1,
reverse=True,
... | Do we need this check here? The search api should ensure the event types returned are the expected ones | return result
def get_last_user_msg(event_store: EventStoreABC) -> list[MessageAction]:
events = list(
event_store.search_events(
filter=EventFilter(
source=EventSource.USER,
include_types=(MessageAction,),
),
limit=1,
rev... | @@ -200,21 +203,72 @@ def get_summary_for_agent_state(
return unknown_error_msg
+def _search_single_event(
+ event_store: EventStoreABC,
+ event_filter: EventFilter,
+ expected_types: type[T] | tuple[type[T], ...],
+ start_id: int = 0,
+) -> T | None:
+ """Search for a single event matching the ... | enterprise/integrations/utils.py | 26 | Python | 0.571 | question | 103 | 51 | 51 | false | fix: replace deprecated get_matching_events with search_events | 12,249 | All-Hands-AI/OpenHands | 55,974 | Python | malhotra5 | neubig | Review this pull request change.
Language: Python
File: enterprise/integrations/utils.py
PR Title: fix: replace deprecated get_matching_events with search_events
BEFORE CODE:
Returns:
The single matching event, or None if no events found
Raises:
AssertionError: If more than one event is re... | Do we need this check here? The search api should ensure the event types returned are the expected ones | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
)
if not local_deploy:
# Get user info to add to litellm
token_manager = TokenManager()
keycloak_user_info = (
await token_manager.get_user_info_from_user_id(self.user_id) or {}
)
async with httpx.AsyncClient(
... | ```suggestion
# LiteLLM v1.80+ returns 404 for non-existent users (previously returned empty user_info)
``` | )
if not local_deploy:
# Get user info to add to litellm
token_manager = TokenManager()
keycloak_user_info = (
await token_manager.get_user_info_from_user_id(self.user_id) or {}
)
async with httpx.AsyncClient(
... | @@ -285,14 +285,29 @@ async def update_settings_with_litellm_default(
'x-goog-api-key': LITE_LLM_API_KEY,
},
) as client:
- # Get the previous max budget to prevent accidental loss
- # In Litellm a get always succeeds, regardless of whethe... | enterprise/storage/saas_settings_store.py | 26 | Python | 0.786 | suggestion | 123 | 51 | 51 | false | fix: Handle LiteLLM v1.80+ 404 response for new users | 12,250 | All-Hands-AI/OpenHands | 55,974 | Python | malhotra5 | neubig | Review this pull request change.
Language: Python
File: enterprise/storage/saas_settings_store.py
PR Title: fix: Handle LiteLLM v1.80+ 404 response for new users
BEFORE CODE: )
if not local_deploy:
# Get user info to add to litellm
token_manager = TokenManager()
... | ```suggestion
# LiteLLM v1.80+ returns 404 for non-existent users (previously returned empty user_info)
``` | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
@pytest.mark.asyncio
async def test_update_settings_with_litellm_default_error(settings_store):
with patch(
'server.auth.token_manager.TokenManager.get_user_info_from_user_id',
AsyncMock(return_value={'email': 'duplicate@example.com'}),
):
with patch('httpx.AsyncClient') as mock_client... | NIT: maybe we parameterize this test with different response codes and assert the expected downstream behavior | settings = await settings_store.update_settings_with_litellm_default(settings)
@pytest.mark.asyncio
async def test_update_settings_with_litellm_default_error(settings_store):
with patch(
'server.auth.token_manager.TokenManager.get_user_info_from_user_id',
AsyncMock(return_value={'email': '... | @@ -335,6 +335,55 @@ async def test_update_settings_with_litellm_default_error(settings_store):
assert settings is None
+@pytest.mark.asyncio
+async def test_update_settings_with_litellm_default_handles_404_for_new_user( | enterprise/tests/unit/test_saas_settings_store.py | 26 | Python | 0.357 | nitpick | 111 | 51 | 51 | false | fix: Handle LiteLLM v1.80+ 404 response for new users | 12,250 | All-Hands-AI/OpenHands | 55,974 | Python | malhotra5 | neubig | Review this pull request change.
Language: Python
File: enterprise/tests/unit/test_saas_settings_store.py
PR Title: fix: Handle LiteLLM v1.80+ 404 response for new users
BEFORE CODE:
@pytest.mark.asyncio
async def test_update_settings_with_litellm_default_error(settings_store):
with patch(
'server.aut... | NIT: maybe we parameterize this test with different response codes and assert the expected downstream behavior | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
depends_on: Union[str, Sequence[str], None] = None
def upgrade() -> None:
"""Upgrade schema.
1. Update existing users with condenser_max_size=120 to 240
2. Add condenser_keep_first column
3. Set condenser_keep_first=4 for existing users who had the old defaults
"""
# Update existing rows wher... | @OpenHands if we don't add this column, it will respect the SDK default right? In this case, let's just bump 120 to 240 and keep the default for keep_first | depends_on: Union[str, Sequence[str], None] = None
def upgrade() -> None:
"""Upgrade schema.
Update existing users with condenser_max_size=120 or NULL to 240.
This covers both users who had the old default (120) explicitly set
and users who had NULL (which defaulted to 120 in the application code).
... | @@ -0,0 +1,70 @@
+"""bump condenser defaults: max_size 120->240, add keep_first column with default 4
+
+Revision ID: 086
+Revises: 085
+Create Date: 2026-01-05
+
+"""
+
+from typing import Sequence, Union
+
+import sqlalchemy as sa
+from alembic import op
+from sqlalchemy.sql import column, table
+
+# revision identif... | enterprise/migrations/versions/086_bump_condenser_defaults.py | 26 | Python | 0.357 | suggestion | 155 | 51 | 44 | false | Bump condenser defaults: max_size 120->240 | 12,267 | All-Hands-AI/OpenHands | 55,974 | Python | xingyaoww | xingyaoww | Review this pull request change.
Language: Python
File: enterprise/migrations/versions/086_bump_condenser_defaults.py
PR Title: Bump condenser defaults: max_size 120->240
BEFORE CODE: depends_on: Union[str, Sequence[str], None] = None
def upgrade() -> None:
"""Upgrade schema.
1. Update existing users wit... | @OpenHands if we don't add this column, it will respect the SDK default right? In this case, let's just bump 120 to 240 and keep the default for keep_first | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
credits = await OrgService.get_org_credits(user_id, org.id)
return OrgResponse(
id=str(org.id),
name=org.name,
contact_name=org.contact_name,
contact_email=org.contact_email,
conversation_expiration=org.conversation_expiration,
age... | There is a lot in here - I think we should add a helper method into the models which may be used to convert an org and credits (nullable) into an OrgResponse. It would result in less duplication between PRs. | logger.exception(
'Unexpected error creating organization',
extra={'user_id': user_id, 'error': str(e)},
)
raise HTTPException(
status_code=status.HTTP_500_INTERNAL_SERVER_ERROR,
detail='An unexpected error occurred',
)
@org_router.get('/... | @@ -115,3 +119,84 @@ async def create_org(
status_code=status.HTTP_500_INTERNAL_SERVER_ERROR,
detail='An unexpected error occurred',
)
+
+
+@org_router.get('/{org_id}', response_model=OrgResponse, status_code=status.HTTP_200_OK)
+async def get_org(
+ org_id: UUID,
+ user_id: str... | enterprise/server/routes/orgs.py | 26 | Python | 0.643 | refactor | 207 | 42 | 51 | false | feat(backend): develop get /api/organizations/{orgid} api | 12,274 | All-Hands-AI/OpenHands | 55,974 | Python | tofarr | hieptl | Review this pull request change.
Language: Python
File: enterprise/server/routes/orgs.py
PR Title: feat(backend): develop get /api/organizations/{orgid} api
BEFORE CODE: credits = await OrgService.get_org_credits(user_id, org.id)
return OrgResponse(
id=str(org.id),
name=org.... | There is a lot in here - I think we should add a helper method into the models which may be used to convert an org and credits (nullable) into an OrgResponse. It would result in less duplication between PRs. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
mock_request = MagicMock()
mock_db_session = AsyncMock()
# Create the injector
injector = GoogleCloudSharedEventServiceInjector()
injector.bucket_name = 'test-bucket'
# Mock the get_db_session context manager
mock_db_context = AsyncMock()
mock_db_context... | **question:** Would it be possible to avoid using nested patch? Thank you! 🙏 |
async def test_injector_creates_sql_shared_conversation_info_service(self):
"""Test that the injector creates SQLSharedConversationInfoService with db_session."""
mock_state = MagicMock()
mock_request = MagicMock()
mock_db_session = AsyncMock()
# Create the injector
... | @@ -363,3 +365,222 @@ async def test_search_shared_events_with_all_parameters(
page_id='current_page',
limit=50,
)
+
+
+class TestGoogleCloudSharedEventServiceGetEventService:
+ """Test cases for GoogleCloudSharedEventService.get_event_service method."""
+
+ async def test_get_e... | enterprise/tests/unit/test_sharing/test_sharing_shared_event_service.py | 26 | Python | 0.286 | suggestion | 77 | 51 | 51 | false | Fix GoogleCloudSharedEventServiceInjector missing bucket_name field and add tests | 12,280 | All-Hands-AI/OpenHands | 55,974 | Python | hieptl | tofarr | Review this pull request change.
Language: Python
File: enterprise/tests/unit/test_sharing/test_sharing_shared_event_service.py
PR Title: Fix GoogleCloudSharedEventServiceInjector missing bucket_name field and add tests
BEFORE CODE: mock_request = MagicMock()
mock_db_session = AsyncMock()
#... | **question:** Would it be possible to avoid using nested patch? Thank you! 🙏 | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
import { describe, it, expect, beforeEach, afterEach, vi } from "vitest";
import {
extractBaseHost,
extractPathPrefix,
buildHttpBaseUrl,
buildWebSocketUrl,
} from "@/utils/websocket-url";
describe("websocket-url utilities", () => {
// Mock window.location for tests
const originalLocation = window.location;... | ```suggestion
beforeEach(() => {
vi.stubGlobal("location", {
host: "localhost:3001",
protocol: "https:",
});
});
afterEach(() => {
vi.unstubAllGlobals();
});
```
See https://vitest.dev/api/vi.html#vi-stubglobal | import { describe, it, expect, beforeEach, afterEach, vi } from "vitest";
import {
extractBaseHost,
extractPathPrefix,
buildHttpBaseUrl,
buildWebSocketUrl,
} from "#/utils/websocket-url";
describe("websocket-url utilities", () => {
beforeEach(() => {
vi.stubGlobal("location", {
host: "localhost:300... | @@ -0,0 +1,216 @@
+import { describe, it, expect, beforeEach, afterEach, vi } from "vitest";
+import {
+ extractBaseHost,
+ extractPathPrefix,
+ buildHttpBaseUrl,
+ buildWebSocketUrl,
+} from "@/utils/websocket-url";
+
+describe("websocket-url utilities", () => {
+ // Mock window.location for tests
+ const origin... | frontend/__tests__/utils/websocket-url.test.ts | 25 | TypeScript | 0.786 | suggestion | 244 | 50 | 50 | false | fix(frontend): preserve path prefix in WebSocket URL for proxy deployments | 12,284 | All-Hands-AI/OpenHands | 55,974 | Python | amanape | zxkane | Review this pull request change.
Language: TypeScript
File: frontend/__tests__/utils/websocket-url.test.ts
PR Title: fix(frontend): preserve path prefix in WebSocket URL for proxy deployments
BEFORE CODE: import { describe, it, expect, beforeEach, afterEach, vi } from "vitest";
import {
extractBaseHost,
extract... | ```suggestion
beforeEach(() => {
vi.stubGlobal("location", {
host: "localhost:3001",
protocol: "https:",
});
});
afterEach(() => {
vi.unstubAllGlobals();
});
```
See https://vitest.dev/api/vi.html#vi-stubglobal | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
it("should extract host from proxy deployment URL", () => {
const result = extractBaseHost(
"https://openhands.example.com/runtime/55313/api/conversations/abc123",
);
expect(result).toBe("openhands.example.com");
});
it("should return window.location.host for relative URLs", () =>... | All three test the same fallback behavior. Merge into:
```suggestion
it("should return window.location.host for null, undefined, or invalid URL", () => {
expect(extractBaseHost(null)).toBe("localhost:3001");
expect(extractBaseHost(undefined)).toBe("localhost:3001");
expect(extractBaseHost("not-a-... |
it("should return window.location.host for relative URLs", () => {
const result = extractBaseHost("/api/conversations/123");
expect(result).toBe("localhost:3001");
});
it("should return window.location.host for null, undefined, or invalid URL", () => {
expect(extractBaseHost(null)).toBe(... | @@ -0,0 +1,216 @@
+import { describe, it, expect, beforeEach, afterEach, vi } from "vitest";
+import {
+ extractBaseHost,
+ extractPathPrefix,
+ buildHttpBaseUrl,
+ buildWebSocketUrl,
+} from "@/utils/websocket-url";
+
+describe("websocket-url utilities", () => {
+ // Mock window.location for tests
+ const origin... | frontend/__tests__/utils/websocket-url.test.ts | 26 | TypeScript | 1 | refactor | 368 | 51 | 51 | false | fix(frontend): preserve path prefix in WebSocket URL for proxy deployments | 12,284 | All-Hands-AI/OpenHands | 55,974 | Python | amanape | zxkane | Review this pull request change.
Language: TypeScript
File: frontend/__tests__/utils/websocket-url.test.ts
PR Title: fix(frontend): preserve path prefix in WebSocket URL for proxy deployments
BEFORE CODE: it("should extract host from proxy deployment URL", () => {
const result = extractBaseHost(
"... | All three test the same fallback behavior. Merge into:
```suggestion
it("should return window.location.host for null, undefined, or invalid URL", () => {
expect(extractBaseHost(null)).toBe("localhost:3001");
expect(extractBaseHost(undefined)).toBe("localhost:3001");
expect(extractBaseHost("not-a-... | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
// This test ensures the function handles URLs where the path ends with /
const result = extractPathPrefix(
"https://example.com/runtime/55313/api/conversations/123",
);
expect(result).not.toMatch(/\/$/);
});
it("should return empty string for relative URLs", () => {
const... | ```suggestion
it("should return empty string for relative URLs, null, undefined, or invalid URL", () => {
expect(extractPathPrefix("/api/conversations/123")).toBe("");
expect(extractPathPrefix(null)).toBe("");
expect(extractPathPrefix(undefined)).toBe("");
expect(extractPathPrefix("not-a-val... | describe("buildHttpBaseUrl", () => {
it("should build HTTP URL without path prefix", () => {
const result = buildHttpBaseUrl(
"https://example.com/api/conversations/123",
);
expect(result).toBe("https://example.com");
});
it("should build HTTP URL with path prefix for proxy depl... | @@ -0,0 +1,216 @@
+import { describe, it, expect, beforeEach, afterEach, vi } from "vitest";
+import {
+ extractBaseHost,
+ extractPathPrefix,
+ buildHttpBaseUrl,
+ buildWebSocketUrl,
+} from "@/utils/websocket-url";
+
+describe("websocket-url utilities", () => {
+ // Mock window.location for tests
+ const origin... | frontend/__tests__/utils/websocket-url.test.ts | 26 | TypeScript | 1 | refactor | 351 | 51 | 51 | false | fix(frontend): preserve path prefix in WebSocket URL for proxy deployments | 12,284 | All-Hands-AI/OpenHands | 55,974 | Python | amanape | zxkane | Review this pull request change.
Language: TypeScript
File: frontend/__tests__/utils/websocket-url.test.ts
PR Title: fix(frontend): preserve path prefix in WebSocket URL for proxy deployments
BEFORE CODE: // This test ensures the function handles URLs where the path ends with /
const result = extractPat... | ```suggestion
it("should return empty string for relative URLs, null, undefined, or invalid URL", () => {
expect(extractPathPrefix("/api/conversations/123")).toBe("");
expect(extractPathPrefix(null)).toBe("");
expect(extractPathPrefix(undefined)).toBe("");
expect(extractPathPrefix("not-a-val... | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
it("should return empty string for relative URLs", () => {
const result = extractPathPrefix("/api/conversations/123");
expect(result).toBe("");
});
it("should return empty string for null", () => {
const result = extractPathPrefix(null);
expect(result).toBe("");
});
it("sho... | ```suggestion
```
Looks like a duplicate of `"should return empty string for URL without path prefix”`? |
it("should build HTTP URL with path prefix for proxy deployment", () => {
const result = buildHttpBaseUrl(
"https://openhands.example.com/runtime/55313/api/conversations/abc123",
);
expect(result).toBe("https://openhands.example.com/runtime/55313");
});
it("should use http protoc... | @@ -0,0 +1,216 @@
+import { describe, it, expect, beforeEach, afterEach, vi } from "vitest";
+import {
+ extractBaseHost,
+ extractPathPrefix,
+ buildHttpBaseUrl,
+ buildWebSocketUrl,
+} from "@/utils/websocket-url";
+
+describe("websocket-url utilities", () => {
+ // Mock window.location for tests
+ const origin... | frontend/__tests__/utils/websocket-url.test.ts | 26 | TypeScript | 0.786 | refactor | 104 | 51 | 51 | false | fix(frontend): preserve path prefix in WebSocket URL for proxy deployments | 12,284 | All-Hands-AI/OpenHands | 55,974 | Python | amanape | zxkane | Review this pull request change.
Language: TypeScript
File: frontend/__tests__/utils/websocket-url.test.ts
PR Title: fix(frontend): preserve path prefix in WebSocket URL for proxy deployments
BEFORE CODE: it("should return empty string for relative URLs", () => {
const result = extractPathPrefix("/api/con... | ```suggestion
```
Looks like a duplicate of `"should return empty string for URL without path prefix”`? | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
);
expect(result).toBe("http://localhost:3000");
});
it("should fallback to window.location for null URL", () => {
const result = buildHttpBaseUrl(null);
expect(result).toBe("https://localhost:3001");
});
});
describe("buildWebSocketUrl", () => {
it("should return null when... | ```suggestion
it("should return null when conversationId is undefined or empty", () => {
expect(
buildWebSocketUrl(
undefined,
"https://example.com/api/conversations/123",
),
).toBeNull();
expect(
buildWebSocketUrl("", "https://example.com/api/conversati... | it("should build WebSocket URL with path prefix for proxy deployment", () => {
const result = buildWebSocketUrl(
"abc123",
"https://openhands.example.com/runtime/55313/api/conversations/abc123",
);
expect(result).toBe(
"wss://openhands.example.com/runtime/55313/sockets/even... | @@ -0,0 +1,216 @@
+import { describe, it, expect, beforeEach, afterEach, vi } from "vitest";
+import {
+ extractBaseHost,
+ extractPathPrefix,
+ buildHttpBaseUrl,
+ buildWebSocketUrl,
+} from "@/utils/websocket-url";
+
+describe("websocket-url utilities", () => {
+ // Mock window.location for tests
+ const origin... | frontend/__tests__/utils/websocket-url.test.ts | 26 | TypeScript | 1 | suggestion | 362 | 51 | 40 | false | fix(frontend): preserve path prefix in WebSocket URL for proxy deployments | 12,284 | All-Hands-AI/OpenHands | 55,974 | Python | amanape | zxkane | Review this pull request change.
Language: TypeScript
File: frontend/__tests__/utils/websocket-url.test.ts
PR Title: fix(frontend): preserve path prefix in WebSocket URL for proxy deployments
BEFORE CODE: );
expect(result).toBe("http://localhost:3000");
});
it("should fallback to window.locatio... | ```suggestion
it("should return null when conversationId is undefined or empty", () => {
expect(
buildWebSocketUrl(
undefined,
"https://example.com/api/conversations/123",
),
).toBeNull();
expect(
buildWebSocketUrl("", "https://example.com/api/conversati... | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
"",
"https://example.com/api/conversations/123",
);
expect(result).toBeNull();
});
it("should build WebSocket URL without path prefix", () => {
const result = buildWebSocketUrl(
"conv-123",
"https://example.com/api/conversations/conv-123",
);
expect... | ```suggestion
vi.stubGlobal("location", {
host: "localhost:3001",
protocol: "http:",
});
``` | import { describe, it, expect, beforeEach, afterEach, vi } from "vitest";
import {
extractBaseHost,
extractPathPrefix,
buildHttpBaseUrl,
buildWebSocketUrl,
} from "#/utils/websocket-url";
describe("websocket-url utilities", () => {
beforeEach(() => {
vi.stubGlobal("location", {
host: "localhost:300... | @@ -0,0 +1,216 @@
+import { describe, it, expect, beforeEach, afterEach, vi } from "vitest";
+import {
+ extractBaseHost,
+ extractPathPrefix,
+ buildHttpBaseUrl,
+ buildWebSocketUrl,
+} from "@/utils/websocket-url";
+
+describe("websocket-url utilities", () => {
+ // Mock window.location for tests
+ const origin... | frontend/__tests__/utils/websocket-url.test.ts | 26 | TypeScript | 0.714 | suggestion | 121 | 50 | 186 | false | fix(frontend): preserve path prefix in WebSocket URL for proxy deployments | 12,284 | All-Hands-AI/OpenHands | 55,974 | Python | amanape | zxkane | Review this pull request change.
Language: TypeScript
File: frontend/__tests__/utils/websocket-url.test.ts
PR Title: fix(frontend): preserve path prefix in WebSocket URL for proxy deployments
BEFORE CODE: "",
"https://example.com/api/conversations/123",
);
expect(result).toBeNull();
... | ```suggestion
vi.stubGlobal("location", {
host: "localhost:3001",
protocol: "http:",
});
``` | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
it("should handle URL with only root path before /api/conversations", () => {
const result = extractPathPrefix(
"https://example.com/api/conversations/123",
);
expect(result).toBe("");
});
});
describe("buildHttpBaseUrl", () => {
it("should build HTTP URL without path prefix"... | ```suggestion
vi.stubGlobal("location", {
host: "localhost:3001",
protocol: "http:",
});
``` |
it("should fallback to window.location for null URL", () => {
const result = buildHttpBaseUrl(null);
expect(result).toBe("https://localhost:3001");
});
});
describe("buildWebSocketUrl", () => {
it("should return null when conversationId is undefined or empty", () => {
expect(
... | @@ -0,0 +1,216 @@
+import { describe, it, expect, beforeEach, afterEach, vi } from "vitest";
+import {
+ extractBaseHost,
+ extractPathPrefix,
+ buildHttpBaseUrl,
+ buildWebSocketUrl,
+} from "@/utils/websocket-url";
+
+describe("websocket-url utilities", () => {
+ // Mock window.location for tests
+ const origin... | frontend/__tests__/utils/websocket-url.test.ts | 26 | TypeScript | 0.714 | suggestion | 121 | 51 | 51 | false | fix(frontend): preserve path prefix in WebSocket URL for proxy deployments | 12,284 | All-Hands-AI/OpenHands | 55,974 | Python | amanape | zxkane | Review this pull request change.
Language: TypeScript
File: frontend/__tests__/utils/websocket-url.test.ts
PR Title: fix(frontend): preserve path prefix in WebSocket URL for proxy deployments
BEFORE CODE:
it("should handle URL with only root path before /api/conversations", () => {
const result = extract... | ```suggestion
vi.stubGlobal("location", {
host: "localhost:3001",
protocol: "http:",
});
``` | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
const CONVERSATION_STORAGE_KEYS = [
"conversation-selected-tab-",
"conversation-right-panel-shown-",
"conversation-unpinned-tabs-",
];
export function clearConversationLocalStorage(conversationId: string) {
try {
CONVERSATION_STORAGE_KEYS.forEach((prefix) => {
localStorage.removeItem(`${prefix}${conv... | **suggestion:** It appears these strings are used in multiple places within the codebase. We could consider defining them as shared constants to improve consistency and maintainability. Thank you! 🙏
```ts
export LOCAL_STORAGE_KEYS={
CONVERSATION_SELECTED_TAB: "conversation-selected-tab"
...
}
```
```ts
const CO... | import { useState } from "react";
import type { ConversationTab } from "#/stores/conversation-store";
export const LOCAL_STORAGE_KEYS = {
CONVERSATION_STATE: "conversation-state",
} as const;
/**
* Consolidated conversation state stored in a single localStorage key.
*/
export interface ConversationState {
selec... | @@ -0,0 +1,43 @@
+const CONVERSATION_STORAGE_KEYS = [
+ "conversation-selected-tab-",
+ "conversation-right-panel-shown-",
+ "conversation-unpinned-tabs-",
+]; | frontend/src/utils/conversation-local-storage.ts | 5 | TypeScript | 0.857 | suggestion | 527 | 30 | 30 | false | fix: clean up conversation localStorage on delete and migration | 12,300 | All-Hands-AI/OpenHands | 55,974 | Python | hieptl | mo-abdulai | Review this pull request change.
Language: TypeScript
File: frontend/src/utils/conversation-local-storage.ts
PR Title: fix: clean up conversation localStorage on delete and migration
BEFORE CODE: const CONVERSATION_STORAGE_KEYS = [
"conversation-selected-tab-",
"conversation-right-panel-shown-",
"conversation... | **suggestion:** It appears these strings are used in multiple places within the codebase. We could consider defining them as shared constants to improve consistency and maintainability. Thank you! 🙏
```ts
export LOCAL_STORAGE_KEYS={
CONVERSATION_SELECTED_TAB: "conversation-selected-tab"
...
}
```
```ts
const CO... | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
);
// Optimistically populate individual conversation caches
result.results.forEach((conversation) => {
queryClient.setQueryData(
["user", "conversation", conversation.conversation_id],
conversation,
);
});
return result;
},
enabled: !!userIsAu... | My concern with this is that it will always clear up keys for the second page of the paginated query.
1. Fetch first page
2. Trigger effect
3. Second page keys are not found in first page data
4. Clears second page keys
Let’s remove this effect and just ensure `clearConversationLocalStorage` is called in `useDeleteCo... | import { useInfiniteQuery, useQueryClient } from "@tanstack/react-query";
import ConversationService from "#/api/conversation-service/conversation-service.api";
import { useIsAuthed } from "./use-is-authed";
export const usePaginatedConversations = (limit: number = 20) => {
const { data: userIsAuthenticated } = useI... | @@ -28,4 +30,16 @@ export const usePaginatedConversations = (limit: number = 20) => {
getNextPageParam: (lastPage) => lastPage.next_page_id,
initialPageParam: undefined as string | undefined,
});
+
+ useEffect(() => {
+ if (!query.data) return;
+
+ const conversationIds = query.data.pages
+ .fl... | frontend/src/hooks/query/use-paginated-conversations.ts | 26 | TypeScript | 0.643 | refactor | 424 | 30 | 32 | false | fix: clean up conversation localStorage on delete and migration | 12,300 | All-Hands-AI/OpenHands | 55,974 | Python | amanape | mo-abdulai | Review this pull request change.
Language: TypeScript
File: frontend/src/hooks/query/use-paginated-conversations.ts
PR Title: fix: clean up conversation localStorage on delete and migration
BEFORE CODE: );
// Optimistically populate individual conversation caches
result.results.forEach((conversat... | My concern with this is that it will always clear up keys for the second page of the paginated query.
1. Fetch first page
2. Trigger effect
3. Second page keys are not found in first page data
4. Clears second page keys
Let’s remove this effect and just ensure `clearConversationLocalStorage` is called in `useDeleteCo... | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
<ConversationNameContextMenuIconText
icon={<CreditCardIcon width={16} height={16} />}
text={t(I18nKey.BUTTON$DISPLAY_COST)}
className={CONTEXT_MENU_ICON_TEXT_CLASSNAME}
/>
</ContextMenuListItem>
)}
{shouldShowPublicSharing && (
<Contex... | Hello @tofarr,
Could you please add some tests to cover your changes? I noticed that you’ve already added a data-testid here, which I assume was intended to support writing tests.
Thank you! 🙏 | onClick={onDisplayCost}
className={contextMenuListItemClassName}
>
<ConversationNameContextMenuIconText
icon={<CreditCardIcon width={16} height={16} />}
text={t(I18nKey.BUTTON$DISPLAY_COST)}
className={CONTEXT_MENU_ICON_TEXT_CLASSNAME}
... | @@ -209,16 +209,18 @@ export function ConversationNameContextMenu({
/>
<span>{t(I18nKey.CONVERSATION$SHARE_PUBLICLY)}</span>
</div>
- {conversation?.public && onCopyShareLink && (
- <button
- type="button"
- data-testid="co... | frontend/src/components/features/conversation/conversation-name-context-menu.tsx | 26 | TypeScript | 0.429 | suggestion | 195 | 51 | 51 | false | feat(frontend): improve public share menu behavior | 12,345 | All-Hands-AI/OpenHands | 55,974 | Python | hieptl | tofarr | Review this pull request change.
Language: TypeScript
File: frontend/src/components/features/conversation/conversation-name-context-menu.tsx
PR Title: feat(frontend): improve public share menu behavior
BEFORE CODE: <ConversationNameContextMenuIconText
icon={<CreditCardIcon width={16} height={1... | Hello @tofarr,
Could you please add some tests to cover your changes? I noticed that you’ve already added a data-testid here, which I assume was intended to support writing tests.
Thank you! 🙏 | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
>
<ConversationNameContextMenuIconText
icon={<CreditCardIcon width={16} height={16} />}
text={t(I18nKey.BUTTON$DISPLAY_COST)}
className={CONTEXT_MENU_ICON_TEXT_CLASSNAME}
/>
</ContextMenuListItem>
)}
{shouldShowPublicSharing && (
... | **question:** In the past, if I wanted to copy a conversation link to share with my teammates, I could simply click this button.
Now, it seems I need to open the shared link in a new tab and then copy it from the browser.
Would it be possible to keep both options—one button to copy the shared link directly, and anoth... | testId="display-cost-button"
onClick={onDisplayCost}
className={contextMenuListItemClassName}
>
<ConversationNameContextMenuIconText
icon={<CreditCardIcon width={16} height={16} />}
text={t(I18nKey.BUTTON$DISPLAY_COST)}
className={CONTE... | @@ -209,16 +209,18 @@ export function ConversationNameContextMenu({
/>
<span>{t(I18nKey.CONVERSATION$SHARE_PUBLICLY)}</span>
</div>
- {conversation?.public && onCopyShareLink && (
- <button | frontend/src/components/features/conversation/conversation-name-context-menu.tsx | 26 | TypeScript | 0.5 | suggestion | 418 | 51 | 51 | false | feat(frontend): improve public share menu behavior | 12,345 | All-Hands-AI/OpenHands | 55,974 | Python | hieptl | tofarr | Review this pull request change.
Language: TypeScript
File: frontend/src/components/features/conversation/conversation-name-context-menu.tsx
PR Title: feat(frontend): improve public share menu behavior
BEFORE CODE: >
<ConversationNameContextMenuIconText
icon={<CreditCardIcon width={16}... | **question:** In the past, if I wanted to copy a conversation link to share with my teammates, I could simply click this button.
Now, it seems I need to open the shared link in a new tab and then copy it from the browser.
Would it be possible to keep both options—one button to copy the shared link directly, and anoth... | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
<ConversationNameContextMenu
onClose={() => setContextMenuOpen(false)}
onRename={handleRename}
onDelete={handleDelete}
onStop={shouldShowStop ? handleStop : undefined}
onDisplayCost={
shouldShowDisplayCost ? ... | **suggestion:** We should avoid calling getShareUrl() here and then passing its returned value as a prop, since it runs on every render. If this function is expensive, it might be a good idea to memoize it. Thank you! 🙏
```ts
const shareUrl = useMemo(() => {
if (!conversationId) {
return "";
}
retur... |
{titleMode !== "edit" && (
<div className="relative flex items-center">
<EllipsisButton fill="#B1B9D3" onClick={handleEllipsisClick} />
{contextMenuOpen && (
<ConversationNameContextMenu
onClose={() => setContextMenuOpen(false)}
on... | @@ -187,9 +187,9 @@ export function ConversationName() {
? handleTogglePublic
: undefined
}
- onCopyShareLink={
+ shareUrl={
ENABLE_PUBLIC_CONVERSATION_SHARING()
- ? handleCopyShareLink
+ ... | frontend/src/components/features/conversation/conversation-name.tsx | 26 | TypeScript | 0.857 | performance | 489 | 51 | 51 | false | feat(frontend): improve public share menu behavior | 12,345 | All-Hands-AI/OpenHands | 55,974 | Python | hieptl | tofarr | Review this pull request change.
Language: TypeScript
File: frontend/src/components/features/conversation/conversation-name.tsx
PR Title: feat(frontend): improve public share menu behavior
BEFORE CODE: <ConversationNameContextMenu
onClose={() => setContextMenuOpen(false)}
... | **suggestion:** We should avoid calling getShareUrl() here and then passing its returned value as a prop, since it runs on every render. If this function is expensive, it might be a good idea to memoize it. Thank you! 🙏
```ts
const shareUrl = useMemo(() => {
if (!conversationId) {
return "";
}
retur... | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
import test, { expect } from "@playwright/test";
/**
* Test for issue #11933: Avatar context menu closes when moving cursor diagonally
*
* This test verifies that the user can move their cursor diagonally from the
* avatar to the context menu without the menu closing unexpectedly.
*/
test("avatar context menu sta... | It appears that this test has been somewhat unstable. @VedantMadane is working on improving it. @amanape, could you kindly review this change? Thank you! 🙏 | import test, { expect } from "@playwright/test";
/**
* Test for issue #11933: Avatar context menu closes when moving cursor diagonally
*
* This test verifies that the user can move their cursor diagonally from the
* avatar to the context menu without the menu closing unexpectedly.
*
* The component supports both... | frontend/tests/avatar-menu.spec.ts | 1 | TypeScript | 0.429 | suggestion | 156 | 26 | 26 | false | fix(frontend): dismissible & expandable error banner | 12,354 | All-Hands-AI/OpenHands | 55,974 | Python | hieptl | VedantMadane | Review this pull request change.
Language: TypeScript
File: frontend/tests/avatar-menu.spec.ts
PR Title: fix(frontend): dismissible & expandable error banner
BEFORE CODE: import test, { expect } from "@playwright/test";
/**
* Test for issue #11933: Avatar context menu closes when moving cursor diagonally
*
* Th... | It appears that this test has been somewhat unstable. @VedantMadane is working on improving it. @amanape, could you kindly review this change? Thank you! 🙏 | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. | |
const [isExpanded, setIsExpanded] = React.useState(false);
const isI18nKey = i18n.exists(message);
const displayTextForLength = isI18nKey ? String(t(message)) : message;
const shouldShowToggle =
displayTextForLength.length > DEFAULT_MAX_COLLAPSED_CHARS;
const isCollapsed = shouldShowToggle && !isExpande... | **suggestion:** It’s preferable to avoid inline styles and use cn to combine classes where possible. Thank you! 🙏
```
import { cn } from "#/utils/utils";
``` | const { t, i18n } = useTranslation();
const [isExpanded, setIsExpanded] = React.useState(false);
const isI18nKey = i18n.exists(message);
const displayTextForLength = isI18nKey ? String(t(message)) : message;
const shouldShowToggle =
displayTextForLength.length > DEFAULT_MAX_COLLAPSED_CHARS;
const isCo... | @@ -1,30 +1,92 @@
-import { Trans } from "react-i18next";
+import React from "react";
+import { Trans, useTranslation } from "react-i18next";
import { Link } from "react-router";
-import i18n from "#/i18n";
+import { X } from "lucide-react";
+import { I18nKey } from "#/i18n/declaration";
interface ErrorMessageBanne... | frontend/src/components/features/chat/error-message-banner.tsx | 26 | TypeScript | 0.786 | suggestion | 159 | 51 | 51 | false | fix(frontend): dismissible & expandable error banner | 12,354 | All-Hands-AI/OpenHands | 55,974 | Python | hieptl | VedantMadane | Review this pull request change.
Language: TypeScript
File: frontend/src/components/features/chat/error-message-banner.tsx
PR Title: fix(frontend): dismissible & expandable error banner
BEFORE CODE: const [isExpanded, setIsExpanded] = React.useState(false);
const isI18nKey = i18n.exists(message);
const displ... | **suggestion:** It’s preferable to avoid inline styles and use cn to combine classes where possible. Thank you! 🙏
```
import { cn } from "#/utils/utils";
``` | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
const DEFAULT_MAX_COLLAPSED_CHARS = 220;
export function ErrorMessageBanner({
message,
onDismiss,
}: ErrorMessageBannerProps) {
const { t, i18n } = useTranslation();
const [isExpanded, setIsExpanded] = React.useState(false);
const isI18nKey = i18n.exists(message);
const displayTextForLength = isI18nKey ?... | ```suggestion
"whitespace-pre-wrap wrap-break-words",
``` |
const DEFAULT_MAX_COLLAPSED_CHARS = 220;
export function ErrorMessageBanner({
message,
onDismiss,
}: ErrorMessageBannerProps) {
const { t, i18n } = useTranslation();
const [isExpanded, setIsExpanded] = React.useState(false);
const isI18nKey = i18n.exists(message);
const displayTextForLength = isI18nKey ?... | @@ -1,30 +1,87 @@
-import { Trans } from "react-i18next";
+import React from "react";
+import { Trans, useTranslation } from "react-i18next";
import { Link } from "react-router";
-import i18n from "#/i18n";
+import { X } from "lucide-react";
+import { I18nKey } from "#/i18n/declaration";
+import { cn } from "#/utils/u... | frontend/src/components/features/chat/error-message-banner.tsx | 26 | TypeScript | 0.571 | suggestion | 69 | 51 | 51 | false | fix(frontend): dismissible & expandable error banner | 12,354 | All-Hands-AI/OpenHands | 55,974 | Python | amanape | VedantMadane | Review this pull request change.
Language: TypeScript
File: frontend/src/components/features/chat/error-message-banner.tsx
PR Title: fix(frontend): dismissible & expandable error banner
BEFORE CODE:
const DEFAULT_MAX_COLLAPSED_CHARS = 220;
export function ErrorMessageBanner({
message,
onDismiss,
}: ErrorMessa... | ```suggestion
"whitespace-pre-wrap wrap-break-words",
``` | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
*/
test("avatar context menu stays open when moving cursor diagonally to menu", async ({
page,
browserName,
}) => {
// WebKit: Playwright hover/mouse simulation is flaky for CSS hover-only menus.
test.skip(browserName === "webkit", "Playwright hover simulation unreliable");
await page.goto("/");
const ai... | > Note that `page.waitForTimeout()` should only be used for debugging. Tests using the timer in production are going to be flaky. Use signals such as network events, selectors becoming visible and others instead.
I'd rather undo the changes here for now and address this in a separate PR | *
* The component supports both CSS hover and click-to-toggle for the menu.
* We use click-to-toggle which is more reliable in automated tests than
* CSS hover simulation.
*/
test("avatar context menu stays open when moving cursor diagonally to menu", async ({
page,
}) => {
await page.goto("/");
// Wait for... | @@ -26,18 +26,24 @@ test("avatar context menu stays open when moving cursor diagonally to menu", asy
const userAvatar = page.getByTestId("user-avatar");
await expect(userAvatar).toBeVisible();
- const avatarBox = await userAvatar.boundingBox();
- if (!avatarBox) {
- throw new Error("Could not get bounding ... | frontend/tests/avatar-menu.spec.ts | 26 | TypeScript | 0.786 | bug | 288 | 43 | 51 | false | fix(frontend): dismissible & expandable error banner | 12,354 | All-Hands-AI/OpenHands | 55,974 | Python | amanape | VedantMadane | Review this pull request change.
Language: TypeScript
File: frontend/tests/avatar-menu.spec.ts
PR Title: fix(frontend): dismissible & expandable error banner
BEFORE CODE: */
test("avatar context menu stays open when moving cursor diagonally to menu", async ({
page,
browserName,
}) => {
// WebKit: Playwright ... | > Note that `page.waitForTimeout()` should only be used for debugging. Tests using the timer in production are going to be flaky. Use signals such as network events, selectors becoming visible and others instead.
I'd rather undo the changes here for now and address this in a separate PR | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
setIsLoadingHistoryMain(false);
}
}
// Use type guard to validate v1 event structure
if (isV1Event(event)) {
addEvent(event);
// Handle ConversationErrorEvent specifically
if (isConversationErrorEvent(event)) {
setErrorMessage(eve... | **question:** Have you verified this work locally? Could you also attach a short demo video? Additionally, once the ConversationErrorEvent and other events (such as stats or conversation status updates) are sent, will the error message be cleared immediately—even if I haven’t seen the error message yet to be aware of t... | setIsLoadingHistoryMain(false);
}
}
// Use type guard to validate v1 event structure
if (isV1Event(event)) {
addEvent(event);
// Handle ConversationErrorEvent specifically - show error banner
// AgentErrorEvent errors are displayed inline in ... | @@ -344,6 +344,9 @@ export function ConversationWebSocketProvider({
conversationId: conversationId || "unknown",
});
}
+ } else if (!isConversationErrorEvent(event)) {
+ // Clear error message on any successful (non-error) event
+ removeErrorMe... | frontend/src/contexts/conversation-websocket-context.tsx | 26 | TypeScript | 0.643 | suggestion | 343 | 51 | 51 | false | fix(frontend): clear error banner on successful V1 WebSocket events | 12,398 | All-Hands-AI/OpenHands | 55,974 | Python | hieptl | amanape | Review this pull request change.
Language: TypeScript
File: frontend/src/contexts/conversation-websocket-context.tsx
PR Title: fix(frontend): clear error banner on successful V1 WebSocket events
BEFORE CODE: setIsLoadingHistoryMain(false);
}
}
// Use type guard to validate v1 ... | **question:** Have you verified this work locally? Could you also attach a short demo video? Additionally, once the ConversationErrorEvent and other events (such as stats or conversation status updates) are sent, will the error message be cleared immediately—even if I haven’t seen the error message yet to be aware of t... | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
import test, { expect } from "@playwright/test";
/**
* Test for issue #11933: Avatar context menu closes when moving cursor diagonally
*
* This test verifies that the avatar context menu can be opened and stays visible.
* The hover bridge feature (for diagonal mouse movement) is implemented via CSS
* pseudo-eleme... | Hello @neubig,
It seems that this file may not be directly related to the objective of this pull request. Thank you! 🙏
⸻
Hello @amanape,
I’ve noticed that the end-to-end tests are failing quite frequently. This can sometimes cause confusion for open source contributors, especially when their changes are not relate... | import test, { expect } from "@playwright/test";
/**
* Test for issue #11933: Avatar context menu closes when moving cursor diagonally
*
* This test verifies that the user can move their cursor diagonally from the
* avatar to the context menu without the menu closing unexpectedly.
*
* The component supports both... | frontend/tests/avatar-menu.spec.ts | 1 | TypeScript | 0.5 | bug | 451 | 26 | 26 | false | fix(frontend): show friendly message for budget/credit errors in V1 conversations | 12,401 | All-Hands-AI/OpenHands | 55,974 | Python | hieptl | neubig | Review this pull request change.
Language: TypeScript
File: frontend/tests/avatar-menu.spec.ts
PR Title: fix(frontend): show friendly message for budget/credit errors in V1 conversations
BEFORE CODE: import test, { expect } from "@playwright/test";
/**
* Test for issue #11933: Avatar context menu closes when movi... | Hello @neubig,
It seems that this file may not be directly related to the objective of this pull request. Thank you! 🙏
⸻
Hello @amanape,
I’ve noticed that the end-to-end tests are failing quite frequently. This can sometimes cause confusion for open source contributors, especially when their changes are not relate... | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. | |
mutation: UseMutationResult<TData, Error, TVariables>,
variables: TVariables,
messages: ToastMessages<TData>,
): Promise<TData> {
const { success, error, loading } = messages;
let loadingToastId: string | undefined;
if (loading) {
loadingToastId = toast.loading(loading, TOAST_OPTIONS);
}
try {
... | 🟠 Important: This type cast is unsafe. In JavaScript, anything can be thrown (not just Error objects). If someone throws a string, number, or object without a `message` property, accessing `.message` could return undefined or fail.
```suggestion
if (loadingToastId) toast.dismiss(loadingToastId);
if (error !=... | export async function mutateWithToast<TData, TVariables>(
mutation: UseMutationResult<TData, Error, TVariables>,
variables: TVariables,
messages: ToastMessages<TData>,
): Promise<TData> {
const { success, error, loading } = messages;
let loadingToastId: string | undefined;
if (loading) {
loadingToastId... | @@ -0,0 +1,51 @@
+import toast from "react-hot-toast";
+import { UseMutationResult } from "@tanstack/react-query";
+import {
+ TOAST_OPTIONS,
+ displaySuccessToast,
+ displayErrorToast,
+} from "./custom-toast-handlers";
+
+export type ToastMessages<TData> = {
+ success?: string | ((data: TData) => string) | false;... | frontend/src/utils/mutate-with-toast.ts | 26 | TypeScript | 1 | bug | 692 | 37 | 44 | false | feat(frontend): add mutateWithToast utility for standardized mutation toast handling | 12,433 | All-Hands-AI/OpenHands | 55,974 | Python | all-hands-bot | eureka928 | Review this pull request change.
Language: TypeScript
File: frontend/src/utils/mutate-with-toast.ts
PR Title: feat(frontend): add mutateWithToast utility for standardized mutation toast handling
BEFORE CODE: mutation: UseMutationResult<TData, Error, TVariables>,
variables: TVariables,
messages: ToastMessages<... | 🟠 Important: This type cast is unsafe. In JavaScript, anything can be thrown (not just Error objects). If someone throws a string, number, or object without a `message` property, accessing `.message` could return undefined or fail.
```suggestion
if (loadingToastId) toast.dismiss(loadingToastId);
if (error !=... | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
</BrandButton>
</div>
</div>
</div>
);
}
function LlmApiKeyManager({
llmApiKey,
isLoadingLlmKey,
isPaymentRequired,
refreshLlmApiKey,
}: LlmApiKeyManagerProps) {
const { t } = useTranslation();
const [showLlmApiKey, setShowLlmApiKey] = useState(false);
const handleRefreshLl... | 🟡 Suggestion: The empty catch block is unnecessary here. Since the error toast is already shown by `mutateWithToast`, you can let the error propagate (or just not await at all if you don't need to handle success/error states).
```suggestion
const handleRefreshLlmApiKey = async () => {
await mutateWithToast(refr... | </BrandButton>
</div>
</div>
</div>
);
}
function LlmApiKeyManager({
llmApiKey,
isLoadingLlmKey,
isPaymentRequired,
refreshLlmApiKey,
}: LlmApiKeyManagerProps) {
const { t } = useTranslation();
const [showLlmApiKey, setShowLlmApiKey] = useState(false);
const handleRefreshLl... | @@ -60,19 +61,17 @@ function LlmApiKeyManager({
const { t } = useTranslation();
const [showLlmApiKey, setShowLlmApiKey] = useState(false);
- const handleRefreshLlmApiKey = () => {
- refreshLlmApiKey.mutate(undefined, {
- onSuccess: () => {
- displaySuccessToast(
- t(I18nKey.SETTINGS$API... | frontend/src/components/features/settings/api-keys-manager.tsx | 26 | TypeScript | 0.929 | suggestion | 522 | 51 | 51 | false | feat(frontend): add mutateWithToast utility for standardized mutation toast handling | 12,433 | All-Hands-AI/OpenHands | 55,974 | Python | all-hands-bot | eureka928 | Review this pull request change.
Language: TypeScript
File: frontend/src/components/features/settings/api-keys-manager.tsx
PR Title: feat(frontend): add mutateWithToast utility for standardized mutation toast handling
BEFORE CODE: </BrandButton>
</div>
</div>
</div>
);
}
function LlmA... | 🟡 Suggestion: The empty catch block is unnecessary here. Since the error toast is already shown by `mutateWithToast`, you can let the error propagate (or just not await at all if you don't need to handle success/error states).
```suggestion
const handleRefreshLlmApiKey = async () => {
await mutateWithToast(refr... | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
export function CreateApiKeyModal({
isOpen,
onClose,
onKeyCreated,
}: CreateApiKeyModalProps) {
const { t } = useTranslation();
const [newKeyName, setNewKeyName] = useState("");
const createApiKeyMutation = useCreateApiKey();
const handleCreateKey = async () => {
if (!newKeyName.trim()) {
dis... | 🟡 Suggestion: The catch block comment is misleading. The real purpose is to prevent `onKeyCreated` and `setNewKeyName` from running on error. Consider a more accurate comment:
```suggestion
try {
const newKey = await mutateWithToast(createApiKeyMutation, newKeyName, {
success: t(I18nKey.SETTINGS$API... |
export function CreateApiKeyModal({
isOpen,
onClose,
onKeyCreated,
}: CreateApiKeyModalProps) {
const { t } = useTranslation();
const [newKeyName, setNewKeyName] = useState("");
const createApiKeyMutation = useCreateApiKey();
const handleCreateKey = async () => {
if (!newKeyName.trim()) {
dis... | @@ -35,12 +33,14 @@ export function CreateApiKeyModal({
}
try {
- const newKey = await createApiKeyMutation.mutateAsync(newKeyName);
+ const newKey = await mutateWithToast(createApiKeyMutation, newKeyName, {
+ success: t(I18nKey.SETTINGS$API_KEY_CREATED),
+ error: t(I18nKey.ERROR$GEN... | frontend/src/components/features/settings/create-api-key-modal.tsx | 26 | TypeScript | 1 | bug | 529 | 51 | 51 | false | feat(frontend): add mutateWithToast utility for standardized mutation toast handling | 12,433 | All-Hands-AI/OpenHands | 55,974 | Python | all-hands-bot | eureka928 | Review this pull request change.
Language: TypeScript
File: frontend/src/components/features/settings/create-api-key-modal.tsx
PR Title: feat(frontend): add mutateWithToast utility for standardized mutation toast handling
BEFORE CODE:
export function CreateApiKeyModal({
isOpen,
onClose,
onKeyCreated,
}: Crea... | 🟡 Suggestion: The catch block comment is misleading. The real purpose is to prevent `onKeyCreated` and `setNewKeyName` from running on error. Consider a more accurate comment:
```suggestion
try {
const newKey = await mutateWithToast(createApiKeyMutation, newKeyName, {
success: t(I18nKey.SETTINGS$API... | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
interface DeleteApiKeyModalProps {
isOpen: boolean;
keyToDelete: ApiKey | null;
onClose: () => void;
}
export function DeleteApiKeyModal({
isOpen,
keyToDelete,
onClose,
}: DeleteApiKeyModalProps) {
const { t } = useTranslation();
const deleteApiKeyMutation = useDeleteApiKey();
const handleDeleteKey... | 🟡 Suggestion: Same as in create modal - the comment should clarify that the catch prevents `onClose()` from being called on error:
```suggestion
try {
await mutateWithToast(deleteApiKeyMutation, keyToDelete.id, {
success: t(I18nKey.SETTINGS$API_KEY_DELETED),
error: t(I18nKey.ERROR$GENERIC),
... |
interface DeleteApiKeyModalProps {
isOpen: boolean;
keyToDelete: ApiKey | null;
onClose: () => void;
}
export function DeleteApiKeyModal({
isOpen,
keyToDelete,
onClose,
}: DeleteApiKeyModalProps) {
const { t } = useTranslation();
const deleteApiKeyMutation = useDeleteApiKey();
const handleDeleteKey... | @@ -29,11 +26,13 @@ export function DeleteApiKeyModal({
if (!keyToDelete) return;
try {
- await deleteApiKeyMutation.mutateAsync(keyToDelete.id);
- displaySuccessToast(t(I18nKey.SETTINGS$API_KEY_DELETED));
+ await mutateWithToast(deleteApiKeyMutation, keyToDelete.id, {
+ success: t(I18... | frontend/src/components/features/settings/delete-api-key-modal.tsx | 26 | TypeScript | 1 | bug | 412 | 51 | 51 | false | feat(frontend): add mutateWithToast utility for standardized mutation toast handling | 12,433 | All-Hands-AI/OpenHands | 55,974 | Python | all-hands-bot | eureka928 | Review this pull request change.
Language: TypeScript
File: frontend/src/components/features/settings/delete-api-key-modal.tsx
PR Title: feat(frontend): add mutateWithToast utility for standardized mutation toast handling
BEFORE CODE:
interface DeleteApiKeyModalProps {
isOpen: boolean;
keyToDelete: ApiKey | nu... | 🟡 Suggestion: Same as in create modal - the comment should clarify that the catch prevents `onClose()` from being called on error:
```suggestion
try {
await mutateWithToast(deleteApiKeyMutation, keyToDelete.id, {
success: t(I18nKey.SETTINGS$API_KEY_DELETED),
error: t(I18nKey.ERROR$GENERIC),
... | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
<BrandButton
type="button"
variant="primary"
onClick={() => navigate("/settings/billing")}
>
{t(I18nKey.SETTINGS$LLM_API_KEY_BUY_NOW)}
</BrandButton>
</div>
</div>
</div>
);
}
function LlmApiKeyManager({
llmApiKey,
is... | **suggestion:** Could we please consider supporting multiple languages for this default value, or alternatively, evaluate whether a default value is necessary? Thank you! 🙏 | <BrandButton
type="button"
variant="primary"
onClick={() => navigate("/settings/billing")}
>
{t(I18nKey.SETTINGS$LLM_API_KEY_BUY_NOW)}
</BrandButton>
</div>
</div>
</div>
);
}
function LlmApiKeyManager({
llmApiKey,
is... | @@ -60,18 +61,12 @@ function LlmApiKeyManager({
const { t } = useTranslation();
const [showLlmApiKey, setShowLlmApiKey] = useState(false);
- const handleRefreshLlmApiKey = () => {
- refreshLlmApiKey.mutate(undefined, {
- onSuccess: () => {
- displaySuccessToast(
- t(I18nKey.SETTINGS$API... | frontend/src/components/features/settings/api-keys-manager.tsx | 26 | TypeScript | 0.429 | suggestion | 173 | 51 | 51 | false | feat(frontend): add mutateWithToast utility for standardized mutation toast handling | 12,433 | All-Hands-AI/OpenHands | 55,974 | Python | hieptl | eureka928 | Review this pull request change.
Language: TypeScript
File: frontend/src/components/features/settings/api-keys-manager.tsx
PR Title: feat(frontend): add mutateWithToast utility for standardized mutation toast handling
BEFORE CODE: <BrandButton
type="button"
variant="primary"
... | **suggestion:** Could we please consider supporting multiple languages for this default value, or alternatively, evaluate whether a default value is necessary? Thank you! 🙏 | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
}
try {
const result = await mutation.mutateAsync(variables);
if (loadingToastId) toast.dismiss(loadingToastId);
if (success !== false) {
const message = typeof success === "function" ? success(result) : success;
if (message) displaySuccessToast(message);
}
return result;
} cat... | **suggestion:** Could we consider supporting multiple languages for this generic error message? Thank you! 🙏 | loadingToastId = toast.loading(loading, TOAST_OPTIONS);
}
try {
const result = await mutation.mutateAsync(variables);
if (loadingToastId) toast.dismiss(loadingToastId);
if (success !== false) {
const message = typeof success === "function" ? success(result) : success;
if (message) dis... | @@ -0,0 +1,57 @@
+import toast from "react-hot-toast";
+import { UseMutationResult } from "@tanstack/react-query";
+import {
+ TOAST_OPTIONS,
+ displaySuccessToast,
+ displayErrorToast,
+} from "./custom-toast-handlers";
+
+export type ToastMessages<TData> = {
+ success?: string | ((data: TData) => string) | false;... | frontend/src/utils/mutate-with-toast.ts | 26 | TypeScript | 0.571 | suggestion | 109 | 34 | 35 | false | feat(frontend): add mutateWithToast utility for standardized mutation toast handling | 12,433 | All-Hands-AI/OpenHands | 55,974 | Python | hieptl | eureka928 | Review this pull request change.
Language: TypeScript
File: frontend/src/utils/mutate-with-toast.ts
PR Title: feat(frontend): add mutateWithToast utility for standardized mutation toast handling
BEFORE CODE: }
try {
const result = await mutation.mutateAsync(variables);
if (loadingToastId) toast.dismis... | **suggestion:** Could we consider supporting multiple languages for this generic error message? Thank you! 🙏 | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
export function CreateApiKeyModal({
isOpen,
onClose,
onKeyCreated,
}: CreateApiKeyModalProps) {
const { t } = useTranslation();
const [newKeyName, setNewKeyName] = useState("");
const createApiKeyMutation = useCreateApiKey();
const handleCreateKey = async () => {
if (!newKeyName.trim()) {
dis... | **suggestion:** Could we please avoid using empty catch blocks? Thank you! 🙏 |
export function CreateApiKeyModal({
isOpen,
onClose,
onKeyCreated,
}: CreateApiKeyModalProps) {
const { t } = useTranslation();
const [newKeyName, setNewKeyName] = useState("");
const createApiKeyMutation = useCreateApiKey();
const handleCreateKey = async () => {
if (!newKeyName.trim()) {
dis... | @@ -35,12 +33,14 @@ export function CreateApiKeyModal({
}
try {
- const newKey = await createApiKeyMutation.mutateAsync(newKeyName);
+ const newKey = await mutateWithToast(createApiKeyMutation, newKeyName, {
+ success: t(I18nKey.SETTINGS$API_KEY_CREATED),
+ error: t(I18nKey.ERROR$GEN... | frontend/src/components/features/settings/create-api-key-modal.tsx | 26 | TypeScript | 0.286 | suggestion | 77 | 51 | 51 | false | feat(frontend): add mutateWithToast utility for standardized mutation toast handling | 12,433 | All-Hands-AI/OpenHands | 55,974 | Python | hieptl | eureka928 | Review this pull request change.
Language: TypeScript
File: frontend/src/components/features/settings/create-api-key-modal.tsx
PR Title: feat(frontend): add mutateWithToast utility for standardized mutation toast handling
BEFORE CODE:
export function CreateApiKeyModal({
isOpen,
onClose,
onKeyCreated,
}: Crea... | **suggestion:** Could we please avoid using empty catch blocks? Thank you! 🙏 | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
interface DeleteApiKeyModalProps {
isOpen: boolean;
keyToDelete: ApiKey | null;
onClose: () => void;
}
export function DeleteApiKeyModal({
isOpen,
keyToDelete,
onClose,
}: DeleteApiKeyModalProps) {
const { t } = useTranslation();
const deleteApiKeyMutation = useDeleteApiKey();
const handleDeleteKey... | **suggestion:** Could we please avoid using empty catch blocks? Thank you! 🙏 |
interface DeleteApiKeyModalProps {
isOpen: boolean;
keyToDelete: ApiKey | null;
onClose: () => void;
}
export function DeleteApiKeyModal({
isOpen,
keyToDelete,
onClose,
}: DeleteApiKeyModalProps) {
const { t } = useTranslation();
const deleteApiKeyMutation = useDeleteApiKey();
const handleDeleteKey... | @@ -29,11 +26,13 @@ export function DeleteApiKeyModal({
if (!keyToDelete) return;
try {
- await deleteApiKeyMutation.mutateAsync(keyToDelete.id);
- displaySuccessToast(t(I18nKey.SETTINGS$API_KEY_DELETED));
+ await mutateWithToast(deleteApiKeyMutation, keyToDelete.id, {
+ success: t(I18... | frontend/src/components/features/settings/delete-api-key-modal.tsx | 26 | TypeScript | 0.286 | suggestion | 77 | 51 | 51 | false | feat(frontend): add mutateWithToast utility for standardized mutation toast handling | 12,433 | All-Hands-AI/OpenHands | 55,974 | Python | hieptl | eureka928 | Review this pull request change.
Language: TypeScript
File: frontend/src/components/features/settings/delete-api-key-modal.tsx
PR Title: feat(frontend): add mutateWithToast utility for standardized mutation toast handling
BEFORE CODE:
interface DeleteApiKeyModalProps {
isOpen: boolean;
keyToDelete: ApiKey | nu... | **suggestion:** Could we please avoid using empty catch blocks? Thank you! 🙏 | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
try:
repository = await self.verify_repo_provider(
repo_name, is_optional=is_optional
)
except AuthenticationError:
raise Exception('Git provider authentication issue when getting remote URL')
provider = repository.git_provider
repo_na... | ```suggestion
raise ValueError(
``` | try:
repository = await self.verify_repo_provider(
repo_name, is_optional=is_optional
)
except AuthenticationError:
raise Exception('Git provider authentication issue when getting remote URL')
provider = repository.git_provider
repo_na... | @@ -675,6 +675,20 @@ async def get_authenticated_git_url(
if provider != ProviderType.AZURE_DEVOPS:
domain = self.provider_tokens[provider].host or domain
+ # Detect protocol before normalizing domain
+ # Default to https, but preserve http if explicitly specified
+ ... | openhands/integrations/provider.py | 26 | Python | 0.714 | suggestion | 51 | 51 | 51 | false | fix: preserve HTTP protocol for self-hosted Gitea/Forgejo instances | 12,439 | All-Hands-AI/OpenHands | 55,974 | Python | neubig | MkDev11 | Review this pull request change.
Language: Python
File: openhands/integrations/provider.py
PR Title: fix: preserve HTTP protocol for self-hosted Gitea/Forgejo instances
BEFORE CODE: try:
repository = await self.verify_repo_provider(
repo_name, is_optional=is_optional
... | ```suggestion
raise ValueError(
``` | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
Authenticated git URL if credentials are available, otherwise regular HTTPS URL
"""
try:
repository = await self.verify_repo_provider(
repo_name, is_optional=is_optional
)
except AuthenticationError:
raise Exception('Git provider au... | ```suggestion
allow_insecure = bool(os.environ.get('ALLOW_INSECURE_GIT_ACCESS', False))
``` | Authenticated git URL if credentials are available, otherwise regular HTTPS URL
"""
try:
repository = await self.verify_repo_provider(
repo_name, is_optional=is_optional
)
except AuthenticationError:
raise Exception('Git provider au... | @@ -675,6 +675,20 @@ async def get_authenticated_git_url(
if provider != ProviderType.AZURE_DEVOPS:
domain = self.provider_tokens[provider].host or domain
+ # Detect protocol before normalizing domain
+ # Default to https, but preserve http if explicitly specified
+ ... | openhands/integrations/provider.py | 26 | Python | 0.714 | suggestion | 103 | 51 | 51 | false | fix: preserve HTTP protocol for self-hosted Gitea/Forgejo instances | 12,439 | All-Hands-AI/OpenHands | 55,974 | Python | neubig | MkDev11 | Review this pull request change.
Language: Python
File: openhands/integrations/provider.py
PR Title: fix: preserve HTTP protocol for self-hosted Gitea/Forgejo instances
BEFORE CODE: Authenticated git URL if credentials are available, otherwise regular HTTPS URL
"""
try:
repos... | ```suggestion
allow_insecure = bool(os.environ.get('ALLOW_INSECURE_GIT_ACCESS', False))
``` | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
if is_host_network:
# Host network mode: container ports are directly accessible on host
for exposed_port in self.exposed_ports:
host_port = exposed_port.container_port
url = self.container_url_pattern.format(port=host_port)
... | **suggestion:** There appears to be a potential inconsistency in the port type definitions between docker_sandbox_service.py at line 154 and line 176. It would be helpful to review these sections together to ensure they are aligned.
- In host networ... | if is_host_network:
# Host network mode: container ports are directly accessible on host
for exposed_port in self.exposed_ports:
host_port = exposed_port.container_port
url = self.container_url_pattern.format(port=host_port)
... | @@ -140,36 +141,61 @@ async def _container_to_sandbox_info(self, container) -> SandboxInfo | None:
env = self._get_container_env_vars(container)
session_api_key = env.get(SESSION_API_KEY_VARIABLE)
- # Get the first exposed port mapping
+ # Get the exposed port mappings
... | openhands/app_server/sandbox/docker_sandbox_service.py | 26 | Python | 0.929 | suggestion | 984 | 51 | 51 | false | feat: add host network support for V1 DockerSandboxService | 12,445 | All-Hands-AI/OpenHands | 55,974 | Python | hieptl | MkDev11 | Review this pull request change.
Language: Python
File: openhands/app_server/sandbox/docker_sandbox_service.py
PR Title: feat: add host network support for V1 DockerSandboxService
BEFORE CODE: if is_host_network:
# Host network mode: container ports are directly accessible on host
... | **suggestion:** There appears to be a potential inconsistency in the port type definitions between docker_sandbox_service.py at line 154 and line 176. It would be helpful to review these sections together to ensure they are aligned.
- In host networ... | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
'Extra hostname mappings to add to agent-server containers. '
'This allows containers to resolve hostnames like host.docker.internal '
'for LAN deployments and MCP connections. '
'Format: {"hostname": "ip_or_gateway"}'
),
)
startup_grace_seconds: int = Fie... | **question:** Environment variable configuration may not work (docker_sandbox_service.py:590, config.py:199-235). The Field description says: "Configure via OH_SANDBOX_USE_HOST_NETWORK environment variable", but config.py doesn't parse this environment variable in the legacy fallback path: ... | 'Extra hostname mappings to add to agent-server containers. '
'This allows containers to resolve hostnames like host.docker.internal '
'for LAN deployments and MCP connections. '
'Format: {"hostname": "ip_or_gateway"}'
),
)
startup_grace_seconds: int = Fie... | @@ -526,6 +580,16 @@ class DockerSandboxServiceInjector(SandboxServiceInjector):
'before it is considered an error'
),
)
+ use_host_network: bool = Field(
+ default=False,
+ description=(
+ 'Whether to use host networking mode for sandbox containers. '
+ ... | openhands/app_server/sandbox/docker_sandbox_service.py | 26 | Python | 1 | suggestion | 1,289 | 51 | 51 | false | feat: add host network support for V1 DockerSandboxService | 12,445 | All-Hands-AI/OpenHands | 55,974 | Python | hieptl | MkDev11 | Review this pull request change.
Language: Python
File: openhands/app_server/sandbox/docker_sandbox_service.py
PR Title: feat: add host network support for V1 DockerSandboxService
BEFORE CODE: 'Extra hostname mappings to add to agent-server containers. '
'This allows containers to resolve ho... | **question:** Environment variable configuration may not work (docker_sandbox_service.py:590, config.py:199-235). The Field description says: "Configure via OH_SANDBOX_USE_HOST_NETWORK environment variable", but config.py doesn't parse this environment variable in the legacy fallback path: ... | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
)
health_check_path: str | None = Field(
default='/health',
description=(
'The url path in the sandbox agent server to check to '
'determine whether the server is running'
),
)
extra_hosts: dict[str, str] = Field(
default_factory=lambda: {'host.doc... | I'd actually apply the `SANDBOX_USE_HOST_NETWORK` as the default here rather than in app_server/config.py:
```
default=os.getenv('SANDBOX_USE_HOST_NETWORK', '').lower() in (
'true',
'1',
'yes',
)
```
This means that if the parameter `OH_SANDBOX_USE... | )
health_check_path: str | None = Field(
default='/health',
description=(
'The url path in the sandbox agent server to check to '
'determine whether the server is running'
),
)
extra_hosts: dict[str, str] = Field(
default_factory=lambda: {'host.doc... | @@ -526,6 +580,16 @@ class DockerSandboxServiceInjector(SandboxServiceInjector):
'before it is considered an error'
),
)
+ use_host_network: bool = Field(
+ default=False, | openhands/app_server/sandbox/docker_sandbox_service.py | 26 | Python | 0.857 | suggestion | 386 | 51 | 51 | false | feat: add host network support for V1 DockerSandboxService | 12,445 | All-Hands-AI/OpenHands | 55,974 | Python | tofarr | MkDev11 | Review this pull request change.
Language: Python
File: openhands/app_server/sandbox/docker_sandbox_service.py
PR Title: feat: add host network support for V1 DockerSandboxService
BEFORE CODE: )
health_check_path: str | None = Field(
default='/health',
description=(
'The url path... | I'd actually apply the `SANDBOX_USE_HOST_NETWORK` as the default here rather than in app_server/config.py:
```
default=os.getenv('SANDBOX_USE_HOST_NETWORK', '').lower() in (
'true',
'1',
'yes',
)
```
This means that if the parameter `OH_SANDBOX_USE... | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.