Skip to content

🙌 OpenHands: AI-Driven Development

refactor: remove sandbox concept (#89)

Hiep Leba1d192f92ae
diff --git a/AGENTS.md b/AGENTS.md
index 11584f732b..a44b66db39 100644
--- a/AGENTS.md
+++ b/AGENTS.md
@@ -4,7 +4,7 @@
- Frontend API adaptation lives mainly in `src/api/`:
- `option-service` fabricates an OSS web-client config and reads models/providers from `agent_server` LLM endpoints.
- `settings-service` stores settings locally in browser localStorage and reads schemas from `agent_server` `/api/settings/*` endpoints.
- - `v1-conversation-service`, `event-service`, `sandbox-service`, `git-service`, and `skills-service` are mapped directly to `agent_server` REST endpoints.
+ - `v1-conversation-service`, `event-service`, `git-service`, and `skills-service` are mapped directly to `agent_server` REST endpoints.
- `open-hands-axios` injects the optional `X-Session-API-Key` from env/local config for all requests.
- Supported env vars for deployment:
- `VITE_BACKEND_BASE_URL` for the agent server base URL.
@@ -59,7 +59,6 @@
Using `TerminalTool` / `FileEditorTool` / `TaskTrackerTool` / `BrowserToolSet` caused live `/api/conversations/{id}/events` runs to fail with `ToolDefinition '<name>' is not registered`.
- The root compatibility bootstrap now treats `/server_info` network/timeout failures as a first-class `AgentServerUnavailableError`, uses a short 5s timeout for that probe, and disables React Query retries/toasts for the initial config fetch so missing backends fail fast with an explicit full-screen notice.
- For local verification in this repo, setting `VITE_WORKING_DIR=/workspace/project/agent-server-gui` avoids initial Changes-tab 500s from pointing conversations at the non-repo parent `/workspace/project`.
- - OpenHands Cloud sandbox development note: do **not** reuse the sandbox's existing agent-server for this frontend. Current agent-server releases use a shared `openhands` tmux socket and default `workspace/conversations`, so a naive second server in the same sandbox can kill the cloud session's tmux state or attach to the same persisted conversations. `npm run dev` is now the recommended local workflow and starts an isolated local agent-server for the checkout by overriding `TMUX_TMPDIR`, `OH_CONVERSATIONS_PATH`, `OH_BASH_EVENTS_DIR`, and `OH_VSCODE_PORT` under `.openhands-dev/`; use `npm run dev:frontend` only when intentionally pointing at a separately managed backend, or `npm run dev:mock` for mock mode.
- A successful end-to-end live run in this environment required a real LLM config (`LLM_MODEL` + `LLM_API_KEY`). The default `litellm_proxy/...` model with no `llm_api_key` failed at runtime with a `litellm.AuthenticationError`.
- Agent-server recovery UX gotchas:
@@ -72,12 +71,12 @@
- Agent server connection settings now live at `Settings > Agent Server` (`/settings/agent-server`). The page reads deployment defaults from `VITE_BACKEND_BASE_URL` / `VITE_SESSION_API_KEY`, saves user overrides in the `openhands-agent-server-config` localStorage key, and must stay reachable even when the backend compatibility probe fails so users can recover from missing or wrong backend configuration.
- README expectation: keep the first section as a concrete, chronological from-scratch quickstart for running this frontend against a real `openhands-agent-server` (clone, install backend, optional `.env`, run `npm run dev`).
-- Keep README user-focused and move contributor/developer-specific workflows (Cloud sandbox debugging, `dev:safe`, mock mode, detailed env vars/build-test notes) into `DEVELOPMENT.md`.
+- Keep README user-focused and move contributor/developer-specific workflows (`dev:safe`, mock mode, detailed env vars/build-test notes) into `DEVELOPMENT.md`.
- `scripts/dev-safe.mjs` should fail fast if `agent-server` cannot be spawned (for example missing PATH entries).
- Vite dev mode can black-screen on first load with `504 Outdated Optimize Dep` if core client-entry deps are not prebundled; keep `react`, `react/jsx-runtime`, `react-dom/client`, and `react-router/dom` in `optimizeDeps.include`.
- Vercel deployment note: React Router builds for this repo must keep `build/client` intact on actual Vercel builds and include `presets: [vercelPreset()]` from `@vercel/react-router/vite`; flattening `build/client` during a Vercel build produces deployments with empty outputs (`routes: null`, no static files) and a production 404.
-- As an OpenHands incubator **Sandbox** project, the repo should carry the standard sandbox warning badge in `README.md` and include a root `LICENSE` file to satisfy the incubator-program requirements.
+- The repo should include a root `LICENSE` file to satisfy the incubator-program requirements.
- OpenHands repo bootstrap files live under `.openhands/`:
- `.openhands/setup.sh` installs frontend dependencies with `npm ci` when needed, creates `.env` from `.env.sample` if missing, appends `VITE_WORKING_DIR` for this repo when unset, and generates `src/i18n/declaration.ts` via `npm run make-i18n`.
- `.openhands/pre-commit.sh` mirrors the repo's local quality gate with `npm run lint && npm run test`.
diff --git a/DEVELOPMENT.md b/DEVELOPMENT.md
index 0714901f27..ab23ea39e7 100644
--- a/DEVELOPMENT.md
+++ b/DEVELOPMENT.md
@@ -21,14 +21,6 @@ Useful overrides:
- `OH_GUI_SAFE_STATE_DIR` — base directory for isolated server state
- `VITE_WORKING_DIR` — repo root used for new conversations (defaults to the current checkout)
-## OpenHands Cloud sandbox warning
-
-If you are editing this repo from an OpenHands Cloud sandbox: **do not point this frontend at the sandbox's existing agent-server**.
-
-Current `agent-server` releases share the default `openhands` tmux socket and `workspace/conversations` persistence directory, so a naive second server in the same sandbox can break the OpenHands conversation that is powering your cloud session (for example with errors like `no server running on /tmp/tmux-*/openhands`).
-
-Use `npm run dev` / `npm run dev:safe` so this repo launches its own isolated backend.
-
## Alternative development workflows
### Frontend against an existing backend
diff --git a/README.md b/README.md
index e9bb4dc296..991be4135b 100644
--- a/README.md
+++ b/README.md
@@ -1,9 +1,7 @@
# agent-server-gui
> [!WARNING]
-> This project is in the **Sandbox** phase. It may be vibecoded, untested, or out of date. OpenHands takes no responsibility for the code or its support. [Learn more](https://github.com/OpenHands/incubator-program).
-
-[![Project Status: Sandbox](https://img.shields.io/badge/status-sandbox-yellow)](https://github.com/OpenHands/incubator-program)
+> This project is in an early incubator phase. It may be vibecoded, untested, or out of date. OpenHands takes no responsibility for the code or its support. [Learn more](https://github.com/OpenHands/incubator-program).
## Quickstart
@@ -80,4 +78,4 @@ After the page opens:
## More documentation
-For contributor and developer workflows, including OpenHands Cloud sandbox debugging, frontend-only mode, mock mode, environment variables, and build/test commands, see [DEVELOPMENT.md](./DEVELOPMENT.md).
+For contributor and developer workflows, including frontend-only mode, mock mode, environment variables, and build/test commands, see [DEVELOPMENT.md](./DEVELOPMENT.md).
diff --git a/__tests__/components/chat-status-indicator.test.tsx b/__tests__/components/chat-status-indicator.test.tsx
index 06eaa86e74..5e6f4dc2ce 100644
--- a/__tests__/components/chat-status-indicator.test.tsx
+++ b/__tests__/components/chat-status-indicator.test.tsx
@@ -12,7 +12,7 @@ describe("ChatStatusIndicator", () => {
it("renders the status indicator with status text", () => {
render(
<ChatStatusIndicator
- status="Waiting for sandbox"
+ status="Waiting for runtime"
statusColor="#FFD600"
/>
);
@@ -20,7 +20,7 @@ describe("ChatStatusIndicator", () => {
expect(
screen.getByTestId("chat-status-indicator"),
).toBeInTheDocument();
- expect(screen.getByText("Waiting for sandbox")).toBeInTheDocument();
+ expect(screen.getByText("Waiting for runtime")).toBeInTheDocument();
});
it("passes the statusColor to the DebugStackframeDot icon", () => {
diff --git a/__tests__/components/features/conversation-panel/conversation-card.test.tsx b/__tests__/components/features/conversation-panel/conversation-card.test.tsx
index cf00c6794b..8813d8b626 100644
--- a/__tests__/components/features/conversation-panel/conversation-card.test.tsx
+++ b/__tests__/components/features/conversation-panel/conversation-card.test.tsx
@@ -15,7 +15,7 @@ import { formatTimeDelta } from "#/utils/format-time-delta";
import { ConversationCard } from "#/components/features/conversation-panel/conversation-card/conversation-card";
import { clickOnEditButton } from "./utils";
import { ConversationCardActions } from "#/components/features/conversation-panel/conversation-card/conversation-card-actions";
-import { V1SandboxStatus } from "#/api/sandbox-service/sandbox-service.types";
+import { V1ExecutionStatus } from "#/types/v1/core/base/common";
// We'll use the actual i18next implementation but override the translation function
@@ -474,23 +474,25 @@ describe("ConversationCard", () => {
).not.toBeInTheDocument();
});
- const statusTable: [V1SandboxStatus, boolean][] = [
- ["RUNNING", true],
- ["STARTING", true],
- ["ERROR", false],
- ["PAUSED", false],
- ["MISSING", false],
+ const statusTable: [V1ExecutionStatus, boolean][] = [
+ [V1ExecutionStatus.RUNNING, true],
+ [V1ExecutionStatus.IDLE, true],
+ [V1ExecutionStatus.FINISHED, true],
+ [V1ExecutionStatus.WAITING_FOR_CONFIRMATION, true],
+ [V1ExecutionStatus.ERROR, false],
+ [V1ExecutionStatus.STUCK, false],
+ [V1ExecutionStatus.PAUSED, false],
];
it.each(statusTable)(
- "should toggle stop button visibility correctly for sandbox status",
- (sandboxStatus, shouldShow) => {
+ "should toggle stop button visibility correctly for execution status",
+ (executionStatus, shouldShow) => {
renderWithProviders(
<ConversationCardActions
contextMenuOpen={true}
onContextMenuToggle={vi.fn()}
onStop={vi.fn()}
- sandboxStatus={sandboxStatus}
+ executionStatus={executionStatus}
/>,
);
diff --git a/__tests__/components/features/conversation-panel/conversation-panel.test.tsx b/__tests__/components/features/conversation-panel/conversation-panel.test.tsx
index 58243568b4..a5d89f37be 100644
--- a/__tests__/components/features/conversation-panel/conversation-panel.test.tsx
+++ b/__tests__/components/features/conversation-panel/conversation-panel.test.tsx
@@ -7,13 +7,12 @@ import { renderWithProviders } from "test-utils";
import { ConversationPanel } from "#/components/features/conversation-panel/conversation-panel";
import V1ConversationService from "#/api/conversation-service/v1-conversation-service.api";
import { V1AppConversation } from "#/api/conversation-service/v1-conversation-service.types";
-import { V1SandboxStatus } from "#/api/sandbox-service/sandbox-service.types";
import { V1ExecutionStatus } from "#/types/v1/core";
// Mock the unified stop conversation hook
const mockStopConversationMutate = vi.fn();
vi.mock("#/hooks/mutation/use-unified-stop-conversation", () => ({
- useUnifiedPauseConversationSandbox: () => ({
+ useUnifiedPauseConversation: () => ({
mutate: mockStopConversationMutate,
}),
}));
@@ -28,13 +27,11 @@ const createMockConversation = (overrides: Partial<V1AppConversation> = {}): V1A
selected_branch: null,
updated_at: "2021-10-01T12:00:00Z",
created_at: "2021-10-01T12:00:00Z",
- sandbox_status: "STOPPED" as V1SandboxStatus,
execution_status: V1ExecutionStatus.FINISHED,
conversation_url: null,
created_by_user_id: "user1",
metrics: null,
llm_model: null,
- sandbox_id: "sandbox1",
trigger: null,
pr_number: [],
session_api_key: null,
@@ -76,9 +73,9 @@ describe("ConversationPanel", () => {
});
const mockConversations: V1AppConversation[] = [
- createMockConversation({ id: "1", title: "Conversation 1", updated_at: "2021-10-01T12:00:00Z", sandbox_id: "sandbox1" }),
- createMockConversation({ id: "2", title: "Conversation 2", updated_at: "2021-10-02T12:00:00Z", sandbox_id: "sandbox2" }),
- createMockConversation({ id: "3", title: "Conversation 3", updated_at: "2021-10-03T12:00:00Z", sandbox_id: "sandbox3" }),
+ createMockConversation({ id: "1", title: "Conversation 1", updated_at: "2021-10-01T12:00:00Z" }),
+ createMockConversation({ id: "2", title: "Conversation 2", updated_at: "2021-10-02T12:00:00Z" }),
+ createMockConversation({ id: "3", title: "Conversation 3", updated_at: "2021-10-03T12:00:00Z" }),
];
beforeEach(() => {
@@ -168,9 +165,9 @@ describe("ConversationPanel", () => {
it("should delete a conversation", async () => {
const user = userEvent.setup();
const mockData: V1AppConversation[] = [
- createMockConversation({ id: "1", title: "Conversation 1", updated_at: "2021-10-01T12:00:00Z", sandbox_id: "sandbox1" }),
- createMockConversation({ id: "2", title: "Conversation 2", updated_at: "2021-10-02T12:00:00Z", sandbox_id: "sandbox2" }),
- createMockConversation({ id: "3", title: "Conversation 3", updated_at: "2021-10-03T12:00:00Z", sandbox_id: "sandbox3" }),
+ createMockConversation({ id: "1", title: "Conversation 1", updated_at: "2021-10-01T12:00:00Z" }),
+ createMockConversation({ id: "2", title: "Conversation 2", updated_at: "2021-10-02T12:00:00Z" }),
+ createMockConversation({ id: "3", title: "Conversation 3", updated_at: "2021-10-03T12:00:00Z" }),
];
const searchConversationsSpy = vi.spyOn(
@@ -280,9 +277,9 @@ describe("ConversationPanel", () => {
// Create mock data with a RUNNING conversation
const mockRunningConversations: V1AppConversation[] = [
- createMockConversation({ id: "1", title: "Running Conversation", sandbox_status: "RUNNING", execution_status: V1ExecutionStatus.RUNNING, sandbox_id: "sandbox1" }),
- createMockConversation({ id: "2", title: "Starting Conversation", sandbox_status: "STARTING", execution_status: V1ExecutionStatus.RUNNING, sandbox_id: "sandbox2" }),
- createMockConversation({ id: "3", title: "Stopped Conversation", sandbox_status: "MISSING", execution_status: V1ExecutionStatus.FINISHED, sandbox_id: "sandbox3" }),
+ createMockConversation({ id: "1", title: "Running Conversation", execution_status: V1ExecutionStatus.RUNNING }),
+ createMockConversation({ id: "2", title: "Starting Conversation", execution_status: V1ExecutionStatus.RUNNING }),
+ createMockConversation({ id: "3", title: "Stopped Conversation", execution_status: V1ExecutionStatus.PAUSED }),
];
const searchConversationsSpy = vi.spyOn(
@@ -327,9 +324,9 @@ describe("ConversationPanel", () => {
const user = userEvent.setup();
const mockData: V1AppConversation[] = [
- createMockConversation({ id: "1", title: "Conversation 1", sandbox_status: "RUNNING", execution_status: V1ExecutionStatus.RUNNING, sandbox_id: "sandbox1" }),
- createMockConversation({ id: "2", title: "Conversation 2", sandbox_status: "MISSING", execution_status: V1ExecutionStatus.FINISHED, sandbox_id: "sandbox2" }),
- createMockConversation({ id: "3", title: "Conversation 3", sandbox_status: "MISSING", execution_status: V1ExecutionStatus.FINISHED, sandbox_id: "sandbox3" }),
+ createMockConversation({ id: "1", title: "Conversation 1", execution_status: V1ExecutionStatus.RUNNING }),
+ createMockConversation({ id: "2", title: "Conversation 2", execution_status: V1ExecutionStatus.FINISHED }),
+ createMockConversation({ id: "3", title: "Conversation 3", execution_status: V1ExecutionStatus.FINISHED }),
];
const searchConversationsSpy = vi.spyOn(
@@ -375,9 +372,9 @@ describe("ConversationPanel", () => {
const user = userEvent.setup();
const mockMixedStatusConversations: V1AppConversation[] = [
- createMockConversation({ id: "1", title: "Running Conversation", sandbox_status: "RUNNING", execution_status: V1ExecutionStatus.RUNNING, sandbox_id: "sandbox1" }),
- createMockConversation({ id: "2", title: "Starting Conversation", sandbox_status: "STARTING", execution_status: V1ExecutionStatus.RUNNING, sandbox_id: "sandbox2" }),
- createMockConversation({ id: "3", title: "Stopped Conversation", sandbox_status: "MISSING", execution_status: V1ExecutionStatus.FINISHED, sandbox_id: "sandbox3" }),
+ createMockConversation({ id: "1", title: "Running Conversation", execution_status: V1ExecutionStatus.RUNNING }),
+ createMockConversation({ id: "2", title: "Starting Conversation", execution_status: V1ExecutionStatus.RUNNING }),
+ createMockConversation({ id: "3", title: "Stopped Conversation", execution_status: V1ExecutionStatus.PAUSED }),
];
const searchConversationsSpy = vi.spyOn(
@@ -765,9 +762,9 @@ describe("ConversationPanel", () => {
// Create mock data with a RUNNING conversation
const mockRunningConversations: V1AppConversation[] = [
- createMockConversation({ id: "1", title: "Running Conversation", sandbox_status: "RUNNING", execution_status: V1ExecutionStatus.RUNNING, sandbox_id: "sandbox1" }),
- createMockConversation({ id: "2", title: "Starting Conversation", sandbox_status: "STARTING", execution_status: V1ExecutionStatus.RUNNING, sandbox_id: "sandbox2" }),
- createMockConversation({ id: "3", title: "Stopped Conversation", sandbox_status: "MISSING", execution_status: V1ExecutionStatus.FINISHED, sandbox_id: "sandbox3" }),
+ createMockConversation({ id: "1", title: "Running Conversation", execution_status: V1ExecutionStatus.RUNNING }),
+ createMockConversation({ id: "2", title: "Starting Conversation", execution_status: V1ExecutionStatus.RUNNING }),
+ createMockConversation({ id: "3", title: "Stopped Conversation", execution_status: V1ExecutionStatus.PAUSED }),
];
vi.spyOn(V1ConversationService, "searchConversations").mockResolvedValue({
diff --git a/__tests__/components/features/conversation/conversation-name.test.tsx b/__tests__/components/features/conversation/conversation-name.test.tsx
index 8f0b321078..eaf59dfd56 100644
--- a/__tests__/components/features/conversation/conversation-name.test.tsx
+++ b/__tests__/components/features/conversation/conversation-name.test.tsx
@@ -69,7 +69,7 @@ vi.mock("react-i18next", async () => {
CONVERSATION$SHOW_SKILLS: "Show Skills",
BUTTON$DISPLAY_COST: "Display Cost",
COMMON$CLOSE_CONVERSATION_STOP_RUNTIME:
- "Close Conversation (Stop Sandbox)",
+ "Close Conversation",
COMMON$DELETE_CONVERSATION: "Delete Conversation",
CONVERSATION$SHARE_PUBLICLY: "Share Publicly",
CONVERSATION$LINK_COPIED: "Link copied to clipboard",
@@ -541,7 +541,7 @@ describe("ConversationNameContextMenu", () => {
"Delete Conversation",
);
expect(screen.getByTestId("stop-button")).toHaveTextContent(
- "Close Conversation (Stop Sandbox)",
+ "Close Conversation",
);
expect(screen.getByTestId("display-cost-button")).toHaveTextContent(
"Display Cost",
diff --git a/__tests__/components/features/conversation/server-status.test.tsx b/__tests__/components/features/conversation/server-status.test.tsx
index f698589fa7..467ac9b1da 100644
--- a/__tests__/components/features/conversation/server-status.test.tsx
+++ b/__tests__/components/features/conversation/server-status.test.tsx
@@ -7,6 +7,7 @@ import { ServerStatusContextMenu } from "#/components/features/controls/server-s
import { ConversationStatus } from "#/types/conversation-status";
import { AgentState } from "#/types/agent-state";
import { useAgentState } from "#/hooks/use-agent-state";
+import { V1ExecutionStatus } from "#/types/v1/core/base/common";
// Mock the agent state hook
vi.mock("#/hooks/use-agent-state", () => ({
@@ -69,7 +70,7 @@ describe("ServerStatus", () => {
it("should render server status with RUNNING conversation status", () => {
mockAgentStore(AgentState.RUNNING);
- renderWithProviders(<ServerStatus sandboxStatus="RUNNING" />);
+ renderWithProviders(<ServerStatus executionStatus={V1ExecutionStatus.RUNNING} />);
expect(screen.getByTestId("server-status")).toBeInTheDocument();
expect(screen.getByText("Running")).toBeInTheDocument();
@@ -78,7 +79,7 @@ describe("ServerStatus", () => {
it("should render server status with STOPPED conversation status", () => {
mockAgentStore(AgentState.RUNNING);
- renderWithProviders(<ServerStatus sandboxStatus="MISSING" />);
+ renderWithProviders(<ServerStatus executionStatus={V1ExecutionStatus.PAUSED} />);
expect(screen.getByTestId("server-status")).toBeInTheDocument();
expect(screen.getByText("Server Stopped")).toBeInTheDocument();
@@ -87,7 +88,7 @@ describe("ServerStatus", () => {
it("should render STARTING status when agent state is LOADING", () => {
mockAgentStore(AgentState.LOADING);
- renderWithProviders(<ServerStatus sandboxStatus="STARTING" />);
+ renderWithProviders(<ServerStatus executionStatus={V1ExecutionStatus.IDLE} />);
expect(screen.getByTestId("server-status")).toBeInTheDocument();
expect(screen.getByText("Starting")).toBeInTheDocument();
@@ -96,7 +97,7 @@ describe("ServerStatus", () => {
it("should render STARTING status when agent state is INIT", () => {
mockAgentStore(AgentState.INIT);
- renderWithProviders(<ServerStatus sandboxStatus="STARTING" />);
+ renderWithProviders(<ServerStatus executionStatus={V1ExecutionStatus.IDLE} />);
expect(screen.getByTestId("server-status")).toBeInTheDocument();
expect(screen.getByText("Starting")).toBeInTheDocument();
@@ -105,7 +106,7 @@ describe("ServerStatus", () => {
it("should render ERROR status when agent state is ERROR", () => {
mockAgentStore(AgentState.ERROR);
- renderWithProviders(<ServerStatus sandboxStatus="RUNNING" />);
+ renderWithProviders(<ServerStatus executionStatus={V1ExecutionStatus.RUNNING} />);
expect(screen.getByTestId("server-status")).toBeInTheDocument();
expect(screen.getByText("Error")).toBeInTheDocument();
@@ -115,7 +116,7 @@ describe("ServerStatus", () => {
mockAgentStore(AgentState.RUNNING);
renderWithProviders(
- <ServerStatus sandboxStatus="RUNNING" isPausing={true} />,
+ <ServerStatus executionStatus={V1ExecutionStatus.RUNNING} isPausing={true} />,
);
expect(screen.getByTestId("server-status")).toBeInTheDocument();
@@ -125,7 +126,7 @@ describe("ServerStatus", () => {
it("should handle null conversation status", () => {
mockAgentStore(AgentState.RUNNING);
- renderWithProviders(<ServerStatus sandboxStatus={null} />);
+ renderWithProviders(<ServerStatus executionStatus={null} />);
expect(screen.getByTestId("server-status")).toBeInTheDocument();
expect(screen.getByText("Running")).toBeInTheDocument();
@@ -135,7 +136,7 @@ describe("ServerStatus", () => {
mockAgentStore(AgentState.RUNNING);
renderWithProviders(
- <ServerStatus sandboxStatus="RUNNING" className="custom-class" />,
+ <ServerStatus executionStatus={V1ExecutionStatus.RUNNING} className="custom-class" />,
);
const container = screen.getByTestId("server-status");
@@ -153,7 +154,7 @@ describe("ServerStatusContextMenu", () => {
const defaultProps = {
onClose: vi.fn(),
- sandboxStatus: "RUNNING" as ConversationStatus,
+ executionStatus: "RUNNING" as ConversationStatus,
};
afterEach(() => {
@@ -166,7 +167,7 @@ describe("ServerStatusContextMenu", () => {
renderWithProviders(
<ServerStatusContextMenu
{...defaultProps}
- sandboxStatus="RUNNING"
+ executionStatus={V1ExecutionStatus.RUNNING}
onStopServer={vi.fn()}
/>,
);
@@ -182,7 +183,7 @@ describe("ServerStatusContextMenu", () => {
renderWithProviders(
<ServerStatusContextMenu
{...defaultProps}
- sandboxStatus="MISSING"
+ executionStatus={V1ExecutionStatus.PAUSED}
onStartServer={vi.fn()}
/>,
);
@@ -198,7 +199,7 @@ describe("ServerStatusContextMenu", () => {
renderWithProviders(
<ServerStatusContextMenu
{...defaultProps}
- sandboxStatus="RUNNING"
+ executionStatus={V1ExecutionStatus.RUNNING}
/>,
);
@@ -212,7 +213,7 @@ describe("ServerStatusContextMenu", () => {
renderWithProviders(
<ServerStatusContextMenu
{...defaultProps}
- sandboxStatus="MISSING"
+ executionStatus={V1ExecutionStatus.PAUSED}
/>,
);
@@ -228,7 +229,7 @@ describe("ServerStatusContextMenu", () => {
renderWithProviders(
<ServerStatusContextMenu
{...defaultProps}
- sandboxStatus="RUNNING"
+ executionStatus={V1ExecutionStatus.RUNNING}
onStopServer={onStopServer}
/>,
);
@@ -247,7 +248,7 @@ describe("ServerStatusContextMenu", () => {
renderWithProviders(
<ServerStatusContextMenu
{...defaultProps}
- sandboxStatus="MISSING"
+ executionStatus={V1ExecutionStatus.PAUSED}
onStartServer={onStartServer}
/>,
);
@@ -264,7 +265,7 @@ describe("ServerStatusContextMenu", () => {
renderWithProviders(
<ServerStatusContextMenu
{...defaultProps}
- sandboxStatus="RUNNING"
+ executionStatus={V1ExecutionStatus.RUNNING}
onStopServer={vi.fn()}
/>,
);
@@ -280,7 +281,7 @@ describe("ServerStatusContextMenu", () => {
renderWithProviders(
<ServerStatusContextMenu
{...defaultProps}
- sandboxStatus="MISSING"
+ executionStatus={V1ExecutionStatus.PAUSED}
onStartServer={vi.fn()}
/>,
);
@@ -298,7 +299,7 @@ describe("ServerStatusContextMenu", () => {
<ServerStatusContextMenu
{...defaultProps}
onClose={onClose}
- sandboxStatus="RUNNING"
+ executionStatus={V1ExecutionStatus.RUNNING}
onStopServer={vi.fn()}
/>,
);
@@ -314,7 +315,7 @@ describe("ServerStatusContextMenu", () => {
renderWithProviders(
<ServerStatusContextMenu
{...defaultProps}
- sandboxStatus="STARTING"
+ executionStatus={V1ExecutionStatus.IDLE}
/>,
);
diff --git a/__tests__/components/features/home/new-conversation.test.tsx b/__tests__/components/features/home/new-conversation.test.tsx
index 0380ec07ef..5d3bc91e94 100644
--- a/__tests__/components/features/home/new-conversation.test.tsx
+++ b/__tests__/components/features/home/new-conversation.test.tsx
@@ -52,10 +52,8 @@ describe("NewConversation", () => {
status: "READY",
detail: null,
app_conversation_id: "conv-123",
- sandbox_id: null,
agent_server_url: "http://agent-server.local",
request: {
- sandbox_id: null,
initial_message: null,
processors: [],
llm_model: null,
diff --git a/__tests__/components/features/home/recent-conversation.test.tsx b/__tests__/components/features/home/recent-conversation.test.tsx
index 6db65c543e..307814b25a 100644
--- a/__tests__/components/features/home/recent-conversation.test.tsx
+++ b/__tests__/components/features/home/recent-conversation.test.tsx
@@ -27,7 +27,6 @@ vi.mock("react-i18next", async () => {
const baseConversation: V1AppConversation = {
id: "test-id",
title: "Test Conversation",
- sandbox_status: "RUNNING",
execution_status: V1ExecutionStatus.RUNNING,
updated_at: "2021-10-01T12:00:00Z",
created_at: "2021-10-01T12:00:00Z",
@@ -38,7 +37,6 @@ const baseConversation: V1AppConversation = {
created_by_user_id: "user1",
metrics: null,
llm_model: null,
- sandbox_id: "sandbox1",
trigger: null,
pr_number: [],
session_api_key: null,
diff --git a/__tests__/components/features/home/task-card.test.tsx b/__tests__/components/features/home/task-card.test.tsx
index 65c929c7b5..ad0d2ce1dc 100644
--- a/__tests__/components/features/home/task-card.test.tsx
+++ b/__tests__/components/features/home/task-card.test.tsx
@@ -56,10 +56,8 @@ describe("TaskCard", () => {
status: "READY",
detail: null,
app_conversation_id: "conv-123",
- sandbox_id: null,
agent_server_url: "http://agent-server.local",
request: {
- sandbox_id: null,
initial_message: null,
processors: [],
llm_model: null,
@@ -108,10 +106,8 @@ describe("TaskCard", () => {
status: "READY",
detail: null,
app_conversation_id: "conv-123",
- sandbox_id: null,
agent_server_url: "http://agent-server.local",
request: {
- sandbox_id: null,
initial_message: null,
processors: [],
llm_model: null,
@@ -135,19 +131,6 @@ describe("TaskCard", () => {
await userEvent.click(launchButton);
expect(createConversationSpy).toHaveBeenCalledWith(
- MOCK_RESPOSITORIES[0].full_name,
- MOCK_RESPOSITORIES[0].git_provider,
- undefined,
- undefined,
- undefined,
- {
- git_provider: "github",
- issue_number: 123,
- repo: "repo1",
- task_type: "MERGE_CONFLICTS",
- title: "Task 1",
- },
- undefined,
undefined,
undefined,
undefined,
@@ -164,10 +147,8 @@ describe("TaskCard", () => {
status: "READY",
detail: null,
app_conversation_id: "test-conversation-id",
- sandbox_id: null,
agent_server_url: "http://agent-server.local",
request: {
- sandbox_id: null,
initial_message: null,
processors: [],
llm_model: null,
diff --git a/__tests__/components/v1/get-event-content.test.tsx b/__tests__/components/v1/get-event-content.test.tsx
index 91851cd772..4518acf2ad 100644
--- a/__tests__/components/v1/get-event-content.test.tsx
+++ b/__tests__/components/v1/get-event-content.test.tsx
@@ -49,7 +49,7 @@ const terminalObservationEvent: ObservationEvent = {
exit_code: 0,
pid: 1,
username: "openhands",
- hostname: "sandbox",
+ hostname: "runtime",
prefix: "",
suffix: "",
working_dir: "/workspace/project/OpenHands",
diff --git a/__tests__/hooks/mutation/use-create-conversation.test.tsx b/__tests__/hooks/mutation/use-create-conversation.test.tsx
index 0052960fff..a5651a4bfa 100644
--- a/__tests__/hooks/mutation/use-create-conversation.test.tsx
+++ b/__tests__/hooks/mutation/use-create-conversation.test.tsx
@@ -21,10 +21,8 @@ describe("useCreateConversation", () => {
status: "READY",
detail: null,
app_conversation_id: null,
- sandbox_id: null,
agent_server_url: "http://agent-server.local",
request: {
- sandbox_id: null,
initial_message: {
role: "user",
content: [{ type: "text", text: "Please address the comments" }],
@@ -74,16 +72,9 @@ describe("useCreateConversation", () => {
await waitFor(() => {
expect(createConversationSpy).toHaveBeenCalledWith(
- "owner/repo",
- "github",
"Please address the comments",
- "main",
"Focus on review comments",
- suggestedTask,
undefined,
- undefined,
- undefined,
- undefined, // plugins
);
});
});
diff --git a/__tests__/hooks/mutation/use-new-conversation-command.test.tsx b/__tests__/hooks/mutation/use-new-conversation-command.test.tsx
index 5de28dddbe..1aea9f2500 100644
--- a/__tests__/hooks/mutation/use-new-conversation-command.test.tsx
+++ b/__tests__/hooks/mutation/use-new-conversation-command.test.tsx
@@ -41,7 +41,6 @@ vi.mock("#/utils/custom-toast-handlers", () => ({
const mockConversation = {
id: "conv-123",
- sandbox_id: "sandbox-456",
title: "Test Conversation",
selected_repository: null,
selected_branch: null,
@@ -62,10 +61,8 @@ function makeStartTask(overrides: Record<string, unknown> = {}) {
status: "READY",
detail: null,
app_conversation_id: "new-conv-999",
- sandbox_id: "sandbox-456",
agent_server_url: "http://agent-server.local",
request: {
- sandbox_id: null,
initial_message: null,
processors: [],
llm_model: null,
@@ -93,126 +90,45 @@ describe("useNewConversationCommand", () => {
queryClient = new QueryClient({
defaultOptions: { mutations: { retry: false } },
});
- // Mock batchGetAppConversations to return V1 data with llm_model
- vi.spyOn(
- V1ConversationService,
- "batchGetAppConversations",
- ).mockResolvedValue([
- {
- id: "conv-123",
- title: "Test Conversation",
- sandbox_id: "sandbox-456",
- sandbox_status: "RUNNING",
- execution_status: "IDLE",
- conversation_url: null,
- session_api_key: null,
- selected_repository: null,
- selected_branch: null,
- git_provider: null,
- trigger: null,
- pr_number: [],
- llm_model: "gpt-4o",
- metrics: null,
- created_at: new Date().toISOString(),
- updated_at: new Date().toISOString(),
- sub_conversation_ids: [],
- public: false,
- } as never,
- ]);
});
const wrapper = ({ children }: { children: React.ReactNode }) => (
<QueryClientProvider client={queryClient}>{children}</QueryClientProvider>
);
- it("calls createConversation with sandbox_id and navigates on success", async () => {
+ it("calls createConversation and navigates on success", async () => {
const readyTask = makeStartTask();
const createSpy = vi
.spyOn(V1ConversationService, "createConversation")
.mockResolvedValue(readyTask as never);
- const getStartTaskSpy = vi
- .spyOn(V1ConversationService, "getStartTask")
- .mockResolvedValue(readyTask as never);
-
- const { result } = renderHook(() => useNewConversationCommand(), { wrapper });
-
- await result.current.mutateAsync();
-
- await waitFor(() => {
- expect(createSpy).toHaveBeenCalledWith(
- undefined,
- undefined,
- undefined,
- undefined,
- undefined,
- undefined,
- undefined,
- undefined,
- undefined,
- undefined, // plugins
- "sandbox-456",
- "gpt-4o",
- );
- expect(getStartTaskSpy).toHaveBeenCalledWith("task-789");
- expect(mockNavigate).toHaveBeenCalledWith(
- "/conversations/new-conv-999",
- );
- });
- });
-
- it("polls getStartTask until status is READY", async () => {
- vi.useFakeTimers({ shouldAdvanceTime: true });
- const workingTask = makeStartTask({
- status: "WORKING",
- app_conversation_id: null,
+ const { result } = renderHook(() => useNewConversationCommand(), {
+ wrapper,
});
- const readyTask = makeStartTask({ status: "READY" });
- vi.spyOn(V1ConversationService, "createConversation").mockResolvedValue(
- workingTask as never,
- );
- const getStartTaskSpy = vi
- .spyOn(V1ConversationService, "getStartTask")
- .mockResolvedValueOnce(workingTask as never)
- .mockResolvedValueOnce(readyTask as never);
-
- const { result } = renderHook(() => useNewConversationCommand(), { wrapper });
-
- const mutatePromise = result.current.mutateAsync();
-
- await vi.advanceTimersByTimeAsync(2000);
- await mutatePromise;
+ await result.current.mutateAsync();
await waitFor(() => {
- expect(getStartTaskSpy).toHaveBeenCalledTimes(2);
- expect(mockNavigate).toHaveBeenCalledWith(
- "/conversations/new-conv-999",
- );
+ expect(createSpy).toHaveBeenCalled();
+ expect(mockNavigate).toHaveBeenCalledWith("/conversations/new-conv-999");
});
-
- vi.useRealTimers();
});
- it("throws when task status is ERROR", async () => {
+ it("throws when the new conversation id is missing", async () => {
const errorTask = makeStartTask({
- status: "ERROR",
- detail: "Sandbox crashed",
+ detail: "Setup failed",
app_conversation_id: null,
});
vi.spyOn(V1ConversationService, "createConversation").mockResolvedValue(
errorTask as never,
);
- vi.spyOn(V1ConversationService, "getStartTask").mockResolvedValue(
- errorTask as never,
- );
- const { result } = renderHook(() => useNewConversationCommand(), { wrapper });
+ const { result } = renderHook(() => useNewConversationCommand(), {
+ wrapper,
+ });
- await expect(result.current.mutateAsync()).rejects.toThrow(
- "Sandbox crashed",
- );
+ await expect(result.current.mutateAsync()).rejects.toThrow("Setup failed");
});
it("invalidates conversation list queries on success", async () => {
@@ -221,13 +137,12 @@ describe("useNewConversationCommand", () => {
vi.spyOn(V1ConversationService, "createConversation").mockResolvedValue(
readyTask as never,
);
- vi.spyOn(V1ConversationService, "getStartTask").mockResolvedValue(
- readyTask as never,
- );
const invalidateSpy = vi.spyOn(queryClient, "invalidateQueries");
- const { result } = renderHook(() => useNewConversationCommand(), { wrapper });
+ const { result } = renderHook(() => useNewConversationCommand(), {
+ wrapper,
+ });
await result.current.mutateAsync();
@@ -241,50 +156,16 @@ describe("useNewConversationCommand", () => {
});
});
- it("creates a standalone conversation (not a sub-conversation) so it appears in the list", async () => {
- const readyTask = makeStartTask();
- const createSpy = vi
- .spyOn(V1ConversationService, "createConversation")
- .mockResolvedValue(readyTask as never);
- vi.spyOn(V1ConversationService, "getStartTask").mockResolvedValue(
- readyTask as never,
- );
-
- const { result } = renderHook(() => useNewConversationCommand(), { wrapper });
-
- await result.current.mutateAsync();
-
- await waitFor(() => {
- // parent_conversation_id should be undefined so the new conversation
- // is NOT a sub-conversation and will appear in the conversation list.
- expect(createSpy).toHaveBeenCalledWith(
- undefined, // selectedRepository (null from mock)
- undefined, // git_provider (null from mock)
- undefined, // initialUserMsg
- undefined, // selected_branch (null from mock)
- undefined, // conversationInstructions
- undefined, // suggestedTask
- undefined, // trigger
- undefined, // parent_conversation_id is NOT set
- undefined, // agent_type
- undefined, // plugins
- "sandbox-456", // sandbox_id IS set to reuse the sandbox
- "gpt-4o", // llm_model IS inherited from the original conversation
- );
- });
- });
-
- it("shows a loading toast immediately and dismisses it on success", async () => {
+ it("shows a loading toast and dismisses it on success", async () => {
const readyTask = makeStartTask();
vi.spyOn(V1ConversationService, "createConversation").mockResolvedValue(
readyTask as never,
);
- vi.spyOn(V1ConversationService, "getStartTask").mockResolvedValue(
- readyTask as never,
- );
- const { result } = renderHook(() => useNewConversationCommand(), { wrapper });
+ const { result } = renderHook(() => useNewConversationCommand(), {
+ wrapper,
+ });
await result.current.mutateAsync();
diff --git a/__tests__/hooks/mutation/use-unified-resume-conversation-sandbox.test.tsx b/__tests__/hooks/mutation/use-unified-resume-conversation-sandbox.test.tsx
deleted file mode 100644
index d11e1cac2f..0000000000
--- a/__tests__/hooks/mutation/use-unified-resume-conversation-sandbox.test.tsx
+++ /dev/null
@@ -1,99 +0,0 @@
-import { renderHook, waitFor } from "@testing-library/react";
-import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
-import { describe, expect, it, vi, beforeEach } from "vitest";
-import React from "react";
-import { SandboxService } from "#/api/sandbox-service/sandbox-service.api";
-import V1ConversationService from "#/api/conversation-service/v1-conversation-service.api";
-import { useUnifiedResumeConversationSandbox } from "#/hooks/mutation/use-unified-start-conversation";
-
-// Mock the error message store
-vi.mock("#/stores/error-message-store", () => ({
- useErrorMessageStore: (selector: (state: { removeErrorMessage: () => void }) => unknown) =>
- selector({ removeErrorMessage: vi.fn() }),
-}));
-
-describe("useUnifiedResumeConversationSandbox", () => {
- let queryClient: QueryClient;
-
- beforeEach(() => {
- queryClient = new QueryClient({
- defaultOptions: {
- queries: { retry: false },
- mutations: { retry: false },
- },
- });
- vi.restoreAllMocks();
- });
-
- const wrapper = ({ children }: { children: React.ReactNode }) => (
- <QueryClientProvider client={queryClient}>
- {children}
- </QueryClientProvider>
- );
-
- it("invalidates sandbox and vscode_url queries on settled", async () => {
- // Mock the API calls in the mutation chain
- vi.spyOn(V1ConversationService, "batchGetAppConversations").mockResolvedValue([
- {
- id: "test-conv-id",
- created_by_user_id: null,
- sandbox_id: "test-sandbox-id",
- conversation_url: "http://localhost:3000",
- session_api_key: "test-key",
- selected_repository: null,
- selected_branch: null,
- git_provider: null,
- title: "Test",
- public: false,
- sandbox_status: "RUNNING",
- execution_status: null,
- trigger: null,
- pr_number: [],
- llm_model: null,
- metrics: null,
- sub_conversation_ids: [],
- created_at: new Date().toISOString(),
- updated_at: new Date().toISOString(),
- },
- ]);
- vi.spyOn(SandboxService, "resumeSandbox").mockResolvedValue({ success: true });
-
- // Pre-populate query cache with stale sandbox data
- queryClient.setQueryData(["sandboxes", "batch", ["test-sandbox-id"]], [
- {
- sandbox_id: "test-sandbox-id",
- exposed_urls: [{ name: "VSCODE", url: "https://old-runtime.example.com" }],
- },
- ]);
- queryClient.setQueryData(["unified", "vscode_url", "test-conv-id"], {
- url: "https://old-runtime.example.com",
- error: null,
- });
-
- // Spy on invalidateQueries
- const invalidateSpy = vi.spyOn(queryClient, "invalidateQueries");
-
- const { result } = renderHook(() => useUnifiedResumeConversationSandbox(), { wrapper });
-
- // Trigger the mutation
- result.current.mutate({ conversationId: "test-conv-id" });
-
- await waitFor(() => {
- expect(result.current.isSuccess || result.current.isError).toBe(true);
- });
-
- // Verify sandbox queries were invalidated
- const invalidateCalls = invalidateSpy.mock.calls.map((call) => call[0]);
- const sandboxInvalidation = invalidateCalls.find(
- (call) => call?.queryKey?.[0] === "sandboxes",
- );
- const vscodeInvalidation = invalidateCalls.find(
- (call) =>
- call?.queryKey?.[0] === "unified" &&
- call?.queryKey?.[1] === "vscode_url",
- );
-
- expect(sandboxInvalidation).toBeDefined();
- expect(vscodeInvalidation).toBeDefined();
- });
-});
diff --git a/__tests__/hooks/mutation/use-v1-resume-conversation.test.tsx b/__tests__/hooks/mutation/use-v1-resume-conversation.test.tsx
index 97ec162b54..4dcbb4ba96 100644
--- a/__tests__/hooks/mutation/use-v1-resume-conversation.test.tsx
+++ b/__tests__/hooks/mutation/use-v1-resume-conversation.test.tsx
@@ -19,18 +19,17 @@ describe("useV1ResumeConversation", () => {
});
const wrapper = ({ children }: { children: React.ReactNode }) => (
- <QueryClientProvider client={queryClient}>
- {children}
- </QueryClientProvider>
+ <QueryClientProvider client={queryClient}>{children}</QueryClientProvider>
);
- it("invalidates sandbox and vscode_url queries on settled", async () => {
- // Mock the API calls in the mutation chain
- vi.spyOn(V1ConversationService, "batchGetAppConversations").mockResolvedValue([
+ it("invalidates conversation queries on settled", async () => {
+ vi.spyOn(
+ V1ConversationService,
+ "batchGetAppConversations",
+ ).mockResolvedValue([
{
id: "test-conv-id",
created_by_user_id: null,
- sandbox_id: "test-sandbox-id",
conversation_url: "http://localhost:3000",
session_api_key: "test-key",
selected_repository: null,
@@ -38,7 +37,6 @@ describe("useV1ResumeConversation", () => {
git_provider: null,
title: "Test",
public: false,
- sandbox_status: "RUNNING",
execution_status: null,
trigger: null,
pr_number: [],
@@ -53,42 +51,22 @@ describe("useV1ResumeConversation", () => {
success: true,
});
- // Pre-populate query cache with stale sandbox data
- queryClient.setQueryData(["sandboxes", "batch", ["test-sandbox-id"]], [
- {
- sandbox_id: "test-sandbox-id",
- exposed_urls: [{ name: "VSCODE", url: "https://old-runtime.example.com" }],
- },
- ]);
- queryClient.setQueryData(["unified", "vscode_url", "test-conv-id"], {
- url: "https://old-runtime.example.com",
- error: null,
- });
-
- // Spy on invalidateQueries
const invalidateSpy = vi.spyOn(queryClient, "invalidateQueries");
const { result } = renderHook(() => useV1ResumeConversation(), { wrapper });
- // Trigger the mutation
result.current.mutate({ conversationId: "test-conv-id" });
await waitFor(() => {
expect(result.current.isSuccess || result.current.isError).toBe(true);
});
- // Verify sandbox queries were invalidated
const invalidateCalls = invalidateSpy.mock.calls.map((call) => call[0]);
- const sandboxInvalidation = invalidateCalls.find(
- (call) => call?.queryKey?.[0] === "sandboxes",
- );
- const vscodeInvalidation = invalidateCalls.find(
+ const conversationInvalidation = invalidateCalls.find(
(call) =>
- call?.queryKey?.[0] === "unified" &&
- call?.queryKey?.[1] === "vscode_url",
+ call?.queryKey?.[0] === "user" && call?.queryKey?.[1] === "conversation",
);
- expect(sandboxInvalidation).toBeDefined();
- expect(vscodeInvalidation).toBeDefined();
+ expect(conversationInvalidation).toBeDefined();
});
});
diff --git a/__tests__/hooks/query/use-sub-conversation-task-polling.test.tsx b/__tests__/hooks/query/use-sub-conversation-task-polling.test.tsx
index 2a382bdf86..37187edd0d 100644
--- a/__tests__/hooks/query/use-sub-conversation-task-polling.test.tsx
+++ b/__tests__/hooks/query/use-sub-conversation-task-polling.test.tsx
@@ -39,7 +39,6 @@ describe("useSubConversationTaskPolling", () => {
status,
detail: null,
app_conversation_id: appConversationId,
- sandbox_id: null,
agent_server_url: null,
request: {},
created_at: new Date().toISOString(),
diff --git a/__tests__/hooks/use-runtime-is-ready.test.tsx b/__tests__/hooks/use-runtime-is-ready.test.tsx
index 7222cc8f52..125be0867a 100644
--- a/__tests__/hooks/use-runtime-is-ready.test.tsx
+++ b/__tests__/hooks/use-runtime-is-ready.test.tsx
@@ -5,6 +5,7 @@ import { useAgentState } from "#/hooks/use-agent-state";
import { useActiveConversation } from "#/hooks/query/use-active-conversation";
import { AgentState } from "#/types/agent-state";
import { V1AppConversation } from "#/api/conversation-service/v1-conversation-service.types";
+import { V1ExecutionStatus } from "#/types/v1/core/base/common";
vi.mock("#/hooks/use-agent-state");
vi.mock("#/hooks/query/use-active-conversation");
@@ -22,13 +23,11 @@ function makeConversation(): V1AppConversation {
git_provider: null,
updated_at: new Date().toISOString(),
created_at: new Date().toISOString(),
- sandbox_status: "RUNNING",
- execution_status: null,
+ execution_status: V1ExecutionStatus.RUNNING,
conversation_url: null,
session_api_key: null,
sub_conversation_ids: [],
created_by_user_id: null,
- sandbox_id: "sandbox-123",
trigger: null,
pr_number: [],
llm_model: "llm-model",
diff --git a/__tests__/hooks/use-sandbox-recovery.test.tsx b/__tests__/hooks/use-sandbox-recovery.test.tsx
deleted file mode 100644
index 498599f0f3..0000000000
--- a/__tests__/hooks/use-sandbox-recovery.test.tsx
+++ /dev/null
@@ -1,580 +0,0 @@
-import { describe, it, expect, vi, beforeEach, afterEach } from "vitest";
-import { renderHook, act, waitFor } from "@testing-library/react";
-import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
-import React from "react";
-import { useSandboxRecovery } from "#/hooks/use-sandbox-recovery";
-import { useUnifiedResumeConversationSandbox } from "#/hooks/mutation/use-unified-start-conversation";
-import * as customToastHandlers from "#/utils/custom-toast-handlers";
-
-vi.mock("react-i18next", () => ({
- useTranslation: () => ({
- t: (key: string) => key,
- }),
- initReactI18next: {
- type: "3rdParty",
- init: () => {},
- },
-}));
-
-vi.mock("#/hooks/use-user-providers", () => ({
- useUserProviders: () => ({
- providers: [{ provider: "github", token: "test-token" }],
- }),
-}));
-
-vi.mock("#/utils/custom-toast-handlers");
-vi.mock("#/hooks/mutation/use-unified-start-conversation");
-
-describe("useSandboxRecovery", () => {
- let mockMutate: ReturnType<typeof vi.fn>;
-
- const createWrapper = () => {
- const queryClient = new QueryClient({
- defaultOptions: {
- queries: { retry: false },
- mutations: { retry: false },
- },
- });
-
- return ({ children }: { children: React.ReactNode }) => (
- <QueryClientProvider client={queryClient}>{children}</QueryClientProvider>
- );
- };
-
- beforeEach(() => {
- vi.clearAllMocks();
-
- mockMutate = vi.fn();
-
- vi.mocked(useUnifiedResumeConversationSandbox).mockReturnValue({
- mutate: mockMutate,
- mutateAsync: vi.fn(),
- isPending: false,
- isSuccess: false,
- isError: false,
- isIdle: true,
- data: undefined,
- error: null,
- reset: vi.fn(),
- status: "idle",
- variables: undefined,
- failureCount: 0,
- failureReason: null,
- submittedAt: 0,
- context: undefined,
- } as unknown as ReturnType<typeof useUnifiedResumeConversationSandbox>);
-
- // Reset document.visibilityState
- Object.defineProperty(document, "visibilityState", {
- value: "visible",
- writable: true,
- });
- });
-
- afterEach(() => {
- vi.restoreAllMocks();
- });
-
- describe("initial load recovery", () => {
- it("should call resumeSandbox on initial load when conversation is PAUSED", () => {
- renderHook(
- () =>
- useSandboxRecovery({
- conversationId: "conv-123",
- sandboxStatus: "PAUSED"
- }),
- { wrapper: createWrapper() },
- );
-
- expect(mockMutate).toHaveBeenCalledTimes(1);
- expect(mockMutate).toHaveBeenCalledWith(
- {
- conversationId: "conv-123",
- providers: [{ provider: "github", token: "test-token" }],
- },
- expect.objectContaining({
- onSuccess: expect.any(Function),
- onError: expect.any(Function),
- }),
- );
- });
-
- it("should NOT call resumeSandbox on initial load when conversation is RUNNING", () => {
- renderHook(
- () =>
- useSandboxRecovery({
- conversationId: "conv-123",
- sandboxStatus: "RUNNING",
- }),
- { wrapper: createWrapper() },
- );
-
- expect(mockMutate).not.toHaveBeenCalled();
- });
-
- it("should NOT call resumeSandbox when conversationId is undefined", () => {
- renderHook(
- () =>
- useSandboxRecovery({
- conversationId: undefined,
- sandboxStatus: "MISSING"
- }),
- { wrapper: createWrapper() },
- );
-
- expect(mockMutate).not.toHaveBeenCalled();
- });
-
- it("should NOT call resumeSandbox when sandboxStatus is undefined", () => {
- renderHook(
- () =>
- useSandboxRecovery({
- conversationId: "conv-123",
- sandboxStatus: undefined,
- }),
- { wrapper: createWrapper() },
- );
-
- expect(mockMutate).not.toHaveBeenCalled();
- });
-
- it("should only call resumeSandbox once per conversation on initial load", () => {
- const { rerender } = renderHook(
- () =>
- useSandboxRecovery({
- conversationId: "conv-123",
- sandboxStatus: "PAUSED"
- }),
- { wrapper: createWrapper() },
- );
-
- expect(mockMutate).toHaveBeenCalledTimes(1);
-
- // Rerender with same props - should not trigger again
- rerender();
-
- expect(mockMutate).toHaveBeenCalledTimes(1);
- });
-
- it("should call resumeSandbox for a new conversation after navigating", async () => {
- const { rerender } = renderHook(
- ({ conversationId }) =>
- useSandboxRecovery({
- conversationId,
- sandboxStatus: "PAUSED"
- }),
- {
- wrapper: createWrapper(),
- initialProps: { conversationId: "conv-123" },
- },
- );
-
- expect(mockMutate).toHaveBeenCalledTimes(1);
- expect(mockMutate).toHaveBeenLastCalledWith(
- expect.objectContaining({ conversationId: "conv-123" }),
- expect.any(Object),
- );
-
- // Navigate to a different conversation
- rerender({ conversationId: "conv-456" });
-
- await waitFor(() => {
- expect(mockMutate).toHaveBeenCalledTimes(2);
- });
-
- expect(mockMutate).toHaveBeenLastCalledWith(
- expect.objectContaining({ conversationId: "conv-456" }),
- expect.any(Object),
- );
- });
- });
-
- describe("tab focus recovery", () => {
- it("should call resumeSandbox when tab becomes visible and refetch returns PAUSED", async () => {
- // Start with tab hidden
- Object.defineProperty(document, "visibilityState", {
- value: "hidden",
- writable: true,
- });
-
- const mockRefetch = vi.fn().mockResolvedValue({
- data: { status: "PAUSED" },
- });
-
- renderHook(
- () =>
- useSandboxRecovery({
- conversationId: "conv-123",
- sandboxStatus: "PAUSED", // Cached status is PAUSED
- refetchConversation: mockRefetch,
- }),
- { wrapper: createWrapper() },
- );
-
- // Initial load with PAUSED status should trigger recovery
- // This is the current implementation behavior
- expect(mockMutate).toHaveBeenCalledTimes(1);
-
- // Simulate tab becoming visible
- Object.defineProperty(document, "visibilityState", {
- value: "visible",
- writable: true,
- });
-
- await act(async () => {
- document.dispatchEvent(new Event("visibilitychange"));
- });
-
- // Refetch should be called to get fresh status
- expect(mockRefetch).toHaveBeenCalledTimes(1);
- });
-
- it("should NOT call resumeSandbox when tab becomes visible and refetch returns RUNNING", async () => {
- const mockRefetch = vi.fn().mockResolvedValue({
- data: { status: "RUNNING" },
- });
-
- renderHook(
- () =>
- useSandboxRecovery({
- conversationId: "conv-123",
- sandboxStatus: "RUNNING",
- refetchConversation: mockRefetch,
- }),
- { wrapper: createWrapper() },
- );
-
- // No initial recovery for RUNNING
- expect(mockMutate).not.toHaveBeenCalled();
-
- // Simulate tab becoming visible
- await act(async () => {
- document.dispatchEvent(new Event("visibilitychange"));
- });
-
- // Refetch was called but status is still RUNNING
- expect(mockRefetch).toHaveBeenCalledTimes(1);
- expect(mockMutate).not.toHaveBeenCalled();
- });
-
- it("should NOT call resumeSandbox when tab becomes visible but refetchConversation is not provided", async () => {
- renderHook(
- () =>
- useSandboxRecovery({
- conversationId: "conv-123",
- sandboxStatus: "PAUSED",
- // No refetchConversation provided
- }),
- { wrapper: createWrapper() },
- );
-
- // Initial load triggers recovery
- expect(mockMutate).toHaveBeenCalledTimes(1);
- mockMutate.mockClear();
-
- // Simulate tab becoming visible
- await act(async () => {
- document.dispatchEvent(new Event("visibilitychange"));
- });
-
- // No recovery on tab focus without refetchConversation
- expect(mockMutate).not.toHaveBeenCalled();
- });
-
- it("should NOT call resumeSandbox when tab becomes hidden", async () => {
- const mockRefetch = vi.fn().mockResolvedValue({
- data: { sandbox_status: "PAUSED" },
- });
-
- renderHook(
- () =>
- useSandboxRecovery({
- conversationId: "conv-123",
- sandboxStatus: "PAUSED",
- refetchConversation: mockRefetch,
- }),
- { wrapper: createWrapper() },
- );
-
- // Initial load triggers recovery
- expect(mockMutate).toHaveBeenCalledTimes(1);
- mockMutate.mockClear();
-
- // Simulate tab becoming hidden
- Object.defineProperty(document, "visibilityState", {
- value: "hidden",
- writable: true,
- });
-
- await act(async () => {
- document.dispatchEvent(new Event("visibilitychange"));
- });
-
- // Refetch should NOT be called when tab is hidden
- expect(mockRefetch).not.toHaveBeenCalled();
- expect(mockMutate).not.toHaveBeenCalled();
- });
-
- it("should clean up visibility event listener on unmount", () => {
- const addEventListenerSpy = vi.spyOn(document, "addEventListener");
- const removeEventListenerSpy = vi.spyOn(document, "removeEventListener");
-
- const { unmount } = renderHook(
- () =>
- useSandboxRecovery({
- conversationId: "conv-123",
- sandboxStatus: "MISSING"
- }),
- { wrapper: createWrapper() },
- );
-
- expect(addEventListenerSpy).toHaveBeenCalledWith(
- "visibilitychange",
- expect.any(Function),
- );
-
- unmount();
-
- expect(removeEventListenerSpy).toHaveBeenCalledWith(
- "visibilitychange",
- expect.any(Function),
- );
- });
-
- it("should NOT call resumeSandbox when tab becomes visible while isPending is true", async () => {
- vi.mocked(useUnifiedResumeConversationSandbox).mockReturnValue({
- mutate: mockMutate,
- mutateAsync: vi.fn(),
- isPending: true,
- isSuccess: false,
- isError: false,
- isIdle: false,
- data: undefined,
- error: null,
- reset: vi.fn(),
- status: "pending",
- variables: undefined,
- failureCount: 0,
- failureReason: null,
- submittedAt: 0,
- context: undefined,
- } as unknown as ReturnType<typeof useUnifiedResumeConversationSandbox>);
-
- const mockRefetch = vi.fn().mockResolvedValue({
- data: { sandbox_status: "MISSING" },
- });
-
- renderHook(
- () =>
- useSandboxRecovery({
- conversationId: "conv-123",
- sandboxStatus: "RUNNING",
- refetchConversation: mockRefetch,
- }),
- { wrapper: createWrapper() },
- );
-
- // Simulate tab becoming visible
- await act(async () => {
- document.dispatchEvent(new Event("visibilitychange"));
- });
-
- // Refetch will be called when isPending is true
- expect(mockRefetch).toHaveBeenCalledTimes(1);
- // resumeSandbox should NOT be called
- expect(mockMutate).not.toHaveBeenCalled();
- });
-
- it("should handle refetch errors gracefully without crashing", async () => {
- const consoleErrorSpy = vi.spyOn(console, "error").mockImplementation(() => {});
-
- const mockRefetch = vi.fn().mockRejectedValue(new Error("Network error"));
-
- renderHook(
- () =>
- useSandboxRecovery({
- conversationId: "conv-123",
- sandboxStatus: "RUNNING",
- refetchConversation: mockRefetch,
- }),
- { wrapper: createWrapper() },
- );
-
- // Simulate tab becoming visible
- await act(async () => {
- document.dispatchEvent(new Event("visibilitychange"));
- });
-
- // Refetch was called
- expect(mockRefetch).toHaveBeenCalledTimes(1);
- // Error was logged
- expect(consoleErrorSpy).toHaveBeenCalledWith(
- "Failed to refetch conversation on visibility change:",
- expect.any(Error),
- );
- // No recovery attempt was made (due to error)
- expect(mockMutate).not.toHaveBeenCalled();
-
- consoleErrorSpy.mockRestore();
- });
- });
-
- describe("recovery callbacks", () => {
- it("should return isResuming=false when no recovery is in progress", () => {
- const { result } = renderHook(
- () =>
- useSandboxRecovery({
- conversationId: "conv-123",
- sandboxStatus: "RUNNING",
- }),
- { wrapper: createWrapper() },
- );
-
- expect(result.current.isResuming).toBe(false);
- });
-
- it("should return isResuming=true when mutation is pending", () => {
- vi.mocked(useUnifiedResumeConversationSandbox).mockReturnValue({
- mutate: mockMutate,
- mutateAsync: vi.fn(),
- isPending: true,
- isSuccess: false,
- isError: false,
- isIdle: false,
- data: undefined,
- error: null,
- reset: vi.fn(),
- status: "pending",
- variables: undefined,
- failureCount: 0,
- failureReason: null,
- submittedAt: 0,
- context: undefined,
- } as unknown as ReturnType<typeof useUnifiedResumeConversationSandbox>);
-
- const { result } = renderHook(
- () =>
- useSandboxRecovery({
- conversationId: "conv-123",
- sandboxStatus: "MISSING"
- }),
- { wrapper: createWrapper() },
- );
-
- expect(result.current.isResuming).toBe(true);
- });
-
- it("should call onSuccess callback when recovery succeeds", () => {
- const onSuccess = vi.fn();
-
- renderHook(
- () =>
- useSandboxRecovery({
- conversationId: "conv-123",
- sandboxStatus: "PAUSED",
- onSuccess,
- }),
- { wrapper: createWrapper() },
- );
-
- // Get the onSuccess callback passed to mutate
- const mutateCall = mockMutate.mock.calls[0];
- const options = mutateCall[1];
-
- // Simulate successful mutation
- act(() => {
- options.onSuccess();
- });
-
- expect(onSuccess).toHaveBeenCalledTimes(1);
- });
-
- it("should call onError callback and display toast when recovery fails", () => {
- const onError = vi.fn();
- const testError = new Error("Resume failed");
-
- renderHook(
- () =>
- useSandboxRecovery({
- conversationId: "conv-123",
- sandboxStatus: "PAUSED",
- onError,
- }),
- { wrapper: createWrapper() },
- );
-
- // Get the onError callback passed to mutate
- const mutateCall = mockMutate.mock.calls[0];
- const options = mutateCall[1];
-
- // Simulate failed mutation
- act(() => {
- options.onError(testError);
- });
-
- expect(onError).toHaveBeenCalledTimes(1);
- expect(onError).toHaveBeenCalledWith(testError);
- expect(vi.mocked(customToastHandlers.displayErrorToast)).toHaveBeenCalled();
- });
-
- it("should NOT call resumeSandbox when isPending is true", () => {
- vi.mocked(useUnifiedResumeConversationSandbox).mockReturnValue({
- mutate: mockMutate,
- mutateAsync: vi.fn(),
- isPending: true,
- isSuccess: false,
- isError: false,
- isIdle: false,
- data: undefined,
- error: null,
- reset: vi.fn(),
- status: "pending",
- variables: undefined,
- failureCount: 0,
- failureReason: null,
- submittedAt: 0,
- context: undefined,
- } as unknown as ReturnType<typeof useUnifiedResumeConversationSandbox>);
-
- renderHook(
- () =>
- useSandboxRecovery({
- conversationId: "conv-123",
- sandboxStatus: "MISSING"
- }),
- { wrapper: createWrapper() },
- );
-
- // Should not call mutate because isPending is true
- expect(mockMutate).not.toHaveBeenCalled();
- });
- });
-
- describe("WebSocket disconnect (negative test)", () => {
- it("should NOT have any mechanism to auto-resume on WebSocket disconnect", () => {
- // This test documents the intended behavior: the hook does NOT
- // listen for WebSocket disconnects. Recovery only happens on:
- // 1. Initial page load (STOPPED status)
- // 2. Tab focus (visibilitychange event)
- //
- // There is intentionally NO onDisconnect handler or WebSocket listener.
-
- const { result } = renderHook(
- () =>
- useSandboxRecovery({
- conversationId: "conv-123",
- sandboxStatus: "RUNNING",
- }),
- { wrapper: createWrapper() },
- );
-
- // The hook should only expose isResuming - no disconnect-related functionality
- expect(result.current).toEqual({
- isResuming: expect.any(Boolean),
- });
-
- // No calls should have been made for RUNNING status
- expect(mockMutate).not.toHaveBeenCalled();
- });
- });
-});
diff --git a/__tests__/utils/get-git-path.test.ts b/__tests__/utils/get-git-path.test.ts
index 8f9f92ffab..cb00b4a115 100644
--- a/__tests__/utils/get-git-path.test.ts
+++ b/__tests__/utils/get-git-path.test.ts
@@ -3,116 +3,49 @@ import { DEFAULT_WORKING_DIR } from "#/api/agent-server-config";
import { getGitPath } from "#/utils/get-git-path";
describe("getGitPath", () => {
- const conversationId = "abc123";
-
- describe("without sandbox grouping (NO_GROUPING)", () => {
- it("should return the default working dir when no repository is selected", () => {
- expect(getGitPath(conversationId, null, false)).toBe(DEFAULT_WORKING_DIR);
- expect(getGitPath(conversationId, undefined, false)).toBe(
- DEFAULT_WORKING_DIR,
- );
- });
-
- it("should handle standard owner/repo format (GitHub)", () => {
- expect(getGitPath(conversationId, "OpenHands/OpenHands", false)).toBe(
- `${DEFAULT_WORKING_DIR}/OpenHands`,
- );
- expect(getGitPath(conversationId, "facebook/react", false)).toBe(
- `${DEFAULT_WORKING_DIR}/react`,
- );
- });
-
- it("should handle nested group paths (GitLab)", () => {
- expect(
- getGitPath(conversationId, "modernhealth/frontend-guild/pan", false),
- ).toBe(`${DEFAULT_WORKING_DIR}/pan`);
- expect(getGitPath(conversationId, "group/subgroup/repo", false)).toBe(
- `${DEFAULT_WORKING_DIR}/repo`,
- );
- expect(getGitPath(conversationId, "a/b/c/d/repo", false)).toBe(
- `${DEFAULT_WORKING_DIR}/repo`,
- );
- });
-
- it("should handle single segment paths", () => {
- expect(getGitPath(conversationId, "repo", false)).toBe(
- `${DEFAULT_WORKING_DIR}/repo`,
- );
- });
-
- it("should handle empty string", () => {
- expect(getGitPath(conversationId, "", false)).toBe(DEFAULT_WORKING_DIR);
- });
+ it("should return the default working dir when no repository is selected", () => {
+ expect(getGitPath(null)).toBe(DEFAULT_WORKING_DIR);
+ expect(getGitPath(undefined)).toBe(DEFAULT_WORKING_DIR);
});
- describe("with sandbox grouping enabled", () => {
- it("should return the grouped default working dir when no repository is selected", () => {
- expect(getGitPath(conversationId, null, true)).toBe(
- `${DEFAULT_WORKING_DIR}/${conversationId}`,
- );
- expect(getGitPath(conversationId, undefined, true)).toBe(
- `${DEFAULT_WORKING_DIR}/${conversationId}`,
- );
- });
-
- it("should handle standard owner/repo format (GitHub)", () => {
- expect(getGitPath(conversationId, "OpenHands/OpenHands", true)).toBe(
- `${DEFAULT_WORKING_DIR}/${conversationId}/OpenHands`,
- );
- expect(getGitPath(conversationId, "facebook/react", true)).toBe(
- `${DEFAULT_WORKING_DIR}/${conversationId}/react`,
- );
- });
-
- it("should handle nested group paths (GitLab)", () => {
- expect(
- getGitPath(conversationId, "modernhealth/frontend-guild/pan", true),
- ).toBe(`${DEFAULT_WORKING_DIR}/${conversationId}/pan`);
- expect(getGitPath(conversationId, "group/subgroup/repo", true)).toBe(
- `${DEFAULT_WORKING_DIR}/${conversationId}/repo`,
- );
- expect(getGitPath(conversationId, "a/b/c/d/repo", true)).toBe(
- `${DEFAULT_WORKING_DIR}/${conversationId}/repo`,
- );
- });
+ it("should handle standard owner/repo format (GitHub)", () => {
+ expect(getGitPath("OpenHands/OpenHands")).toBe(
+ `${DEFAULT_WORKING_DIR}/OpenHands`,
+ );
+ expect(getGitPath("facebook/react")).toBe(`${DEFAULT_WORKING_DIR}/react`);
+ });
- it("should handle single segment paths", () => {
- expect(getGitPath(conversationId, "repo", true)).toBe(
- `${DEFAULT_WORKING_DIR}/${conversationId}/repo`,
- );
- });
+ it("should handle nested group paths (GitLab)", () => {
+ expect(getGitPath("modernhealth/frontend-guild/pan")).toBe(
+ `${DEFAULT_WORKING_DIR}/pan`,
+ );
+ expect(getGitPath("group/subgroup/repo")).toBe(
+ `${DEFAULT_WORKING_DIR}/repo`,
+ );
+ expect(getGitPath("a/b/c/d/repo")).toBe(`${DEFAULT_WORKING_DIR}/repo`);
+ });
- it("should handle empty string", () => {
- expect(getGitPath(conversationId, "", true)).toBe(
- `${DEFAULT_WORKING_DIR}/${conversationId}`,
- );
- });
+ it("should handle single segment paths", () => {
+ expect(getGitPath("repo")).toBe(`${DEFAULT_WORKING_DIR}/repo`);
});
- describe("default behavior (useSandboxGrouping defaults to false)", () => {
- it("should default to no sandbox grouping", () => {
- expect(getGitPath(conversationId, null)).toBe(DEFAULT_WORKING_DIR);
- expect(getGitPath(conversationId, "owner/repo")).toBe(
- `${DEFAULT_WORKING_DIR}/repo`,
- );
- });
+ it("should handle empty string", () => {
+ expect(getGitPath("")).toBe(DEFAULT_WORKING_DIR);
});
describe("with a backend-provided workspace path", () => {
it("prefers the explicit workspace path over derived git paths", () => {
expect(
getGitPath(
- conversationId,
"OpenHands/software-agent-sdk",
- true,
"/workspace/project/agent-server-gui",
),
).toBe("/workspace/project/agent-server-gui");
});
it("ignores blank workspace paths and falls back to heuristics", () => {
- expect(getGitPath(conversationId, "OpenHands/software-agent-sdk", true, " ")).toBe(
- `${DEFAULT_WORKING_DIR}/${conversationId}/software-agent-sdk`,
+ expect(getGitPath("OpenHands/software-agent-sdk", " ")).toBe(
+ `${DEFAULT_WORKING_DIR}/software-agent-sdk`,
);
});
});
diff --git a/__tests__/utils/status.test.ts b/__tests__/utils/status.test.ts
index 924d08e849..53a2a01271 100644
--- a/__tests__/utils/status.test.ts
+++ b/__tests__/utils/status.test.ts
@@ -1,225 +1,97 @@
import { describe, it, expect } from "vitest";
-import { getStatusCode, getIndicatorColor, IndicatorColor } from "#/utils/status";
+import {
+ getStatusCode,
+ getIndicatorColor,
+ IndicatorColor,
+} from "#/utils/status";
import { AgentState } from "#/types/agent-state";
import { I18nKey } from "#/i18n/declaration";
import { V1ExecutionStatus } from "#/types/v1/core";
describe("getStatusCode", () => {
- it("should show sandbox status when agent is not ready", () => {
- // Test case: Agent is loading - but since conversationStatus is not STARTING,
- // it should fall through to runtime status check
- const result = getStatusCode(
- "OPEN", // webSocketStatus
- null,
- "STARTING", // sandboxStatus
- );
-
- // Should return runtime status since conversation is RUNNING
- expect(result).toBe("CONVERSATION$STARTING_CONVERSATION");
- });
-
- it("should handle agent running state with stale runtime status", () => {
- // Test case: Agent is running but runtime status is stale
- const result = getStatusCode(
- "OPEN", // webSocketStatus
- V1ExecutionStatus.RUNNING,
- "RUNNING",
- );
-
- // Should return agent state message, not runtime status
+ it("returns RUNNING_TASK when execution status is running", () => {
+ const result = getStatusCode("OPEN", V1ExecutionStatus.RUNNING);
expect(result).toBe(I18nKey.AGENT_STATUS$RUNNING_TASK);
});
- it("should handle agent finished state with stale runtime status", () => {
- // Test case: Agent is finished but runtime status is stale
- const result = getStatusCode(
- "OPEN", // webSocketStatus
- V1ExecutionStatus.IDLE,
- "RUNNING",
- );
-
- // Should return agent state message, not runtime status
+ it("returns WAITING_FOR_TASK when execution status is idle", () => {
+ const result = getStatusCode("OPEN", V1ExecutionStatus.IDLE);
expect(result).toBe(I18nKey.AGENT_STATUS$WAITING_FOR_TASK);
});
- it("should still respect stopped states", () => {
- // Test case: Runtime is stopped - should always show stopped
- const result = getStatusCode(
- "OPEN", // webSocketStatus
- V1ExecutionStatus.FINISHED,
- "MISSING",
- );
-
- // Should return stopped status regardless of agent state
+ it("returns STOPPED when execution status is paused", () => {
+ const result = getStatusCode("OPEN", V1ExecutionStatus.PAUSED);
expect(result).toBe(I18nKey.CHAT_INTERFACE$STOPPED);
});
- it("should handle null agent state with conversation status STARTING", () => {
- // Test case: No agent state, conversation is STARTING
+ it("returns starting i18n key when task is running setup", () => {
const result = getStatusCode(
- "OPEN", // webSocketStatus
+ "OPEN",
null,
- null,
- "STARTING_CONVERSATION", // taskStatus
+ "STARTING_CONVERSATION",
);
-
- // Should return STARTING since conversationStatus takes priority
expect(result).toBe(I18nKey.CONVERSATION$STARTING_CONVERSATION);
});
- it("should prioritize task ERROR status over websocket CONNECTING state", () => {
- // Test case: Task has errored but websocket is still trying to connect
- const result = getStatusCode(
- "CONNECTING", // webSocketStatus (stuck connecting)
- null, // executionStatus
- "ERROR", // sandboxStatus
- );
-
- // Should return error message, not "Connecting..."
+ it("prioritises task ERROR over websocket CONNECTING", () => {
+ const result = getStatusCode("CONNECTING", null, "ERROR");
expect(result).toBe(I18nKey.AGENT_STATUS$ERROR_OCCURRED);
});
- it("should show Starting when conversation status is STARTING even with disconnected websocket", () => {
- // Test case: Server reports STARTING but websocket is disconnected (e.g., during resume)
- const result = getStatusCode(
- "CLOSED", // webSocketStatus
- V1ExecutionStatus.IDLE,
- "STARTING", // sandboxStatus
- null, // agentState
- );
-
- // Should return STARTING status, not DISCONNECTED
- expect(result).toBe(I18nKey.CONVERSATION$STARTING_CONVERSATION);
- });
-
- it("should show Connecting when task is working and websocket is connecting", () => {
- // Test case: Task is in progress and websocket is connecting normally
- const result = getStatusCode(
- "CONNECTING", // webSocketStatus
- V1ExecutionStatus.IDLE,
- "RUNNING", // sandboxStatus
- );
-
- // Should show connecting message since task hasn't errored
- expect(result).toBe(I18nKey.CHAT_INTERFACE$CONNECTING);
+ it("returns DISCONNECTED when websocket is closed and no task", () => {
+ const result = getStatusCode("CLOSED", V1ExecutionStatus.IDLE);
+ expect(result).toBe(I18nKey.CHAT_INTERFACE$DISCONNECTED);
});
});
describe("getIndicatorColor", () => {
- it("should prioritize agent readiness over stale runtime status for AWAITING_USER_INPUT", () => {
- // Test case: Agent is ready (AWAITING_USER_INPUT) but runtime status is still starting
+ it("prioritises agent readiness over stale runtime status for AWAITING_USER_INPUT", () => {
const result = getIndicatorColor(
- "OPEN", // webSocketStatus
- "RUNNING", // conversationStatus
- "STATUS$STARTING_RUNTIME", // runtimeStatus (stale)
- AgentState.AWAITING_USER_INPUT, // agentState (ready)
+ "OPEN",
+ "RUNNING",
+ "STATUS$STARTING_RUNTIME",
+ AgentState.AWAITING_USER_INPUT,
);
-
- // Should return blue for AWAITING_USER_INPUT, not yellow for stale runtime
expect(result).toBe(IndicatorColor.BLUE);
});
- it("should prioritize agent readiness over stale runtime status for RUNNING", () => {
- // Test case: Agent is running but runtime status is stale
+ it("returns red when websocket is closed", () => {
const result = getIndicatorColor(
- "OPEN", // webSocketStatus
- "RUNNING", // conversationStatus
- "STATUS$BUILDING_RUNTIME", // runtimeStatus (stale)
- AgentState.RUNNING, // agentState (ready)
+ "CLOSED",
+ "STOPPED",
+ "STATUS$STOPPED",
+ AgentState.RUNNING,
);
-
- // Should return green for RUNNING, not yellow for stale runtime
- expect(result).toBe(IndicatorColor.GREEN);
- });
-
- it("should prioritize agent readiness over stale runtime status for FINISHED", () => {
- // Test case: Agent is finished but runtime status is stale
- const result = getIndicatorColor(
- "OPEN", // webSocketStatus
- "RUNNING", // conversationStatus
- "STATUS$SETTING_UP_WORKSPACE", // runtimeStatus (stale)
- AgentState.FINISHED, // agentState (ready)
- );
-
- // Should return green for FINISHED, not yellow for stale runtime
- expect(result).toBe(IndicatorColor.GREEN);
- });
-
- it("should show yellow when agent is not ready and runtime is starting", () => {
- // Test case: Agent is loading and runtime is starting
- const result = getIndicatorColor(
- "OPEN", // webSocketStatus
- "STARTING", // conversationStatus
- "STATUS$STARTING_RUNTIME", // runtimeStatus
- AgentState.LOADING, // agentState (not ready)
- );
-
- // Should return yellow since agent is not ready
- expect(result).toBe(IndicatorColor.YELLOW);
- });
-
- it("should show orange for AWAITING_USER_CONFIRMATION even with stale runtime", () => {
- // Test case: Agent is awaiting confirmation but runtime status is stale
- const result = getIndicatorColor(
- "OPEN", // webSocketStatus
- "RUNNING", // conversationStatus
- "STATUS$STARTING_RUNTIME", // runtimeStatus (stale)
- AgentState.AWAITING_USER_CONFIRMATION, // agentState (ready)
- );
-
- // Should return orange for AWAITING_USER_CONFIRMATION, not yellow for stale runtime
- expect(result).toBe(IndicatorColor.ORANGE);
- });
-
- it("should still respect stopped states", () => {
- // Test case: Runtime is stopped - should always show red
- const result = getIndicatorColor(
- "OPEN", // webSocketStatus
- "STOPPED", // conversationStatus
- "STATUS$STOPPED", // runtimeStatus
- AgentState.RUNNING, // agentState
- );
-
- // Should return red for stopped status regardless of agent state
expect(result).toBe(IndicatorColor.RED);
});
- it("should handle null agent state with runtime status", () => {
- // Test case: No agent state, runtime is starting
+ it("returns yellow when agent is loading", () => {
const result = getIndicatorColor(
- "OPEN", // webSocketStatus
- "STARTING", // conversationStatus
- "STATUS$STARTING_RUNTIME", // runtimeStatus
- null, // agentState
+ "OPEN",
+ "STARTING",
+ "STATUS$STARTING_RUNTIME",
+ AgentState.LOADING,
);
-
- // Should return yellow since no agent state and runtime is starting
expect(result).toBe(IndicatorColor.YELLOW);
});
- it("should handle USER_CONFIRMED state with stale runtime status", () => {
- // Test case: Agent is in USER_CONFIRMED state but runtime status is stale
+ it("returns orange for AWAITING_USER_CONFIRMATION", () => {
const result = getIndicatorColor(
- "OPEN", // webSocketStatus
- "RUNNING", // conversationStatus
- "STATUS$BUILDING_RUNTIME", // runtimeStatus (stale)
- AgentState.USER_CONFIRMED, // agentState (ready)
+ "OPEN",
+ "RUNNING",
+ "STATUS$STARTING_RUNTIME",
+ AgentState.AWAITING_USER_CONFIRMATION,
);
-
- // Should return green for USER_CONFIRMED, not yellow for stale runtime
- expect(result).toBe(IndicatorColor.GREEN);
+ expect(result).toBe(IndicatorColor.ORANGE);
});
- it("should handle USER_REJECTED state with stale runtime status", () => {
- // Test case: Agent is in USER_REJECTED state but runtime status is stale
+ it("returns green for FINISHED state", () => {
const result = getIndicatorColor(
- "OPEN", // webSocketStatus
- "RUNNING", // conversationStatus
- "STATUS$BUILDING_RUNTIME", // runtimeStatus (stale)
- AgentState.USER_REJECTED, // agentState (ready)
+ "OPEN",
+ "RUNNING",
+ "STATUS$SETTING_UP_WORKSPACE",
+ AgentState.FINISHED,
);
-
- // Should return green for USER_REJECTED, not yellow for stale runtime
expect(result).toBe(IndicatorColor.GREEN);
});
});
diff --git a/__tests__/utils/utils.test.ts b/__tests__/utils/utils.test.ts
index 268064d6df..bf928b8215 100644
--- a/__tests__/utils/utils.test.ts
+++ b/__tests__/utils/utils.test.ts
@@ -3,10 +3,8 @@ import { getStatusText } from "#/utils/utils";
import { AgentState } from "#/types/agent-state";
import { I18nKey } from "#/i18n/declaration";
-// Mock translations
const t = (key: string) => {
const translations: { [key: string]: string } = {
- COMMON$WAITING_FOR_SANDBOX: "Waiting for sandbox",
COMMON$STOPPING: "Stopping",
COMMON$STARTING: "Starting",
COMMON$SERVER_STOPPED: "Server stopped",
@@ -37,7 +35,7 @@ describe("getStatusText", () => {
const result = getStatusText({
isPausing: false,
isTask: true,
- taskStatus: "WAITING_FOR_SANDBOX",
+ taskStatus: "STARTING_CONVERSATION",
taskDetail: null,
isStartingStatus: false,
isStopStatus: false,
@@ -45,7 +43,7 @@ describe("getStatusText", () => {
t,
});
- expect(result).toBe("Waiting for sandbox");
+ expect(result).toBe("Starting conversation");
});
it("returns task detail when task status is ERROR and detail exists", () => {
@@ -53,14 +51,14 @@ describe("getStatusText", () => {
isPausing: false,
isTask: true,
taskStatus: "ERROR",
- taskDetail: "Sandbox failed",
+ taskDetail: "Setup failed",
isStartingStatus: false,
isStopStatus: false,
curAgentState: AgentState.RUNNING,
t,
});
- expect(result).toBe("Sandbox failed");
+ expect(result).toBe("Setup failed");
});
it("returns translated error when task status is ERROR and no detail", () => {
diff --git a/src/api/agent-server-adapter.ts b/src/api/agent-server-adapter.ts
index 726495d1c5..5d71bae3e9 100644
--- a/src/api/agent-server-adapter.ts
+++ b/src/api/agent-server-adapter.ts
@@ -14,10 +14,6 @@ import {
V1AppConversation,
V1AppConversationPage,
} from "./conversation-service/v1-conversation-service.types";
-import {
- V1SandboxInfo,
- V1SandboxStatus,
-} from "./sandbox-service/sandbox-service.types";
import { createHttpClient, createSkillsClient } from "./typescript-client";
export interface DirectConversationInfo {
@@ -55,24 +51,6 @@ function browserToolsEnabled() {
return import.meta.env.VITE_ENABLE_BROWSER_TOOLS !== "false";
}
-export function mapExecutionStatusToSandboxStatus(
- executionStatus?: string | null,
-): V1SandboxStatus {
- switch (executionStatus) {
- case "paused":
- return "PAUSED";
- case "error":
- case "stuck":
- return "ERROR";
- case "running":
- case "waiting_for_confirmation":
- case "finished":
- case "idle":
- default:
- return "RUNNING";
- }
-}
-
export function toConversationUrl(conversationId: string): string {
return `${getAgentServerBaseUrl()}/api/conversations/${conversationId}`;
}
@@ -83,7 +61,6 @@ export function toV1AppConversation(
return {
id: info.id,
created_by_user_id: null,
- sandbox_id: info.id,
selected_repository: null,
selected_branch: null,
git_provider: null,
@@ -115,7 +92,6 @@ export function toV1AppConversation(
: null,
created_at: info.created_at,
updated_at: info.updated_at,
- sandbox_status: mapExecutionStatusToSandboxStatus(info.execution_status),
execution_status:
(info.execution_status as V1AppConversation["execution_status"]) ??
V1ExecutionStatus.IDLE,
@@ -399,25 +375,6 @@ export async function downloadTextFile(path: string): Promise<string> {
return new TextDecoder().decode(response.data);
}
-export function createSandboxInfo(
- conversation: V1AppConversation,
-): V1SandboxInfo {
- const exposedUrls = getConfiguredWorkerUrls().map((url, index) => ({
- name: `WORKER_${index + 1}`,
- url,
- }));
-
- return {
- id: conversation.sandbox_id,
- created_by_user_id: null,
- sandbox_spec_id: conversation.sandbox_id,
- status: conversation.sandbox_status,
- session_api_key: conversation.session_api_key,
- exposed_urls: exposedUrls,
- created_at: conversation.created_at,
- };
-}
-
export async function loadSkillsForConversation(
conversation: V1AppConversation | null | undefined,
): Promise<GetSkillsResponse> {
diff --git a/src/api/conversation-service/v1-conversation-service.api.ts b/src/api/conversation-service/v1-conversation-service.api.ts
index d055f134e8..6c6fba355a 100644
--- a/src/api/conversation-service/v1-conversation-service.api.ts
+++ b/src/api/conversation-service/v1-conversation-service.api.ts
@@ -51,18 +51,9 @@ class V1ConversationService {
}
static async createConversation(
- _selectedRepository?: string,
- _git_provider?: Provider,
initialUserMsg?: string,
- _selected_branch?: string,
conversationInstructions?: string,
- _suggestedTask?: SuggestedTask,
- _trigger?: ConversationTrigger,
- _parent_conversation_id?: string,
- _agent_type?: "default" | "plan",
plugins?: PluginSpec[],
- _sandbox_id?: string,
- _llm_model?: string,
): Promise<V1AppConversationStartTask> {
const settings = await SettingsService.getSettings();
const payload = buildStartConversationRequest({
@@ -84,7 +75,6 @@ class V1ConversationService {
status: "READY",
detail: null,
app_conversation_id: data.id,
- sandbox_id: data.id,
agent_server_url: getAgentServerBaseUrl(),
request: {
initial_message: payload.initial_message as
@@ -282,14 +272,6 @@ class V1ConversationService {
};
}
- static async searchConversationsBySandboxId(
- sandboxId: string,
- limit: number = 100,
- ): Promise<V1AppConversation[]> {
- const page = await this.searchConversations(limit);
- return page.items.filter((item) => item.sandbox_id === sandboxId);
- }
-
static async searchConversations(
limit: number = 20,
pageId?: string,
diff --git a/src/api/conversation-service/v1-conversation-service.types.ts b/src/api/conversation-service/v1-conversation-service.types.ts
index 7d8b007507..f5ca1a59c4 100644
--- a/src/api/conversation-service/v1-conversation-service.types.ts
+++ b/src/api/conversation-service/v1-conversation-service.types.ts
@@ -1,5 +1,4 @@
import { ConversationTrigger } from "../open-hands.types";
-import { V1SandboxStatus } from "../sandbox-service/sandbox-service.types";
import { Provider } from "#/types/settings";
import { SuggestedTask } from "#/utils/types";
import { V1ExecutionStatus } from "#/types/v1/core";
@@ -50,7 +49,6 @@ export interface V1SendMessageRequest {
}
export interface V1AppConversationStartRequest {
- sandbox_id?: string | null;
initial_message?: V1SendMessageRequest | null;
processors?: unknown[]; // EventCallbackProcessor - keeping as unknown for now
llm_model?: string | null;
@@ -68,7 +66,6 @@ export interface V1AppConversationStartRequest {
export type V1AppConversationStartTaskStatus =
| "WORKING"
- | "WAITING_FOR_SANDBOX"
| "PREPARING_REPOSITORY"
| "RUNNING_SETUP_SCRIPT"
| "SETTING_UP_GIT_HOOKS"
@@ -83,7 +80,6 @@ export interface V1AppConversationStartTask {
status: V1AppConversationStartTaskStatus;
detail: string | null;
app_conversation_id: string | null;
- sandbox_id: string | null;
agent_server_url: string | null;
request: V1AppConversationStartRequest;
created_at: string;
@@ -107,7 +103,6 @@ export interface V1ConversationWorkspace {
export interface V1AppConversation {
id: string;
created_by_user_id: string | null;
- sandbox_id: string;
selected_repository: string | null;
selected_branch: string | null;
git_provider: Provider | null;
@@ -118,7 +113,6 @@ export interface V1AppConversation {
metrics: V1MetricsSnapshot | null;
created_at: string;
updated_at: string;
- sandbox_status: V1SandboxStatus;
execution_status: V1ExecutionStatus | null;
conversation_url: string | null;
session_api_key: string | null;
diff --git a/src/api/open-hands.types.ts b/src/api/open-hands.types.ts
index f68b80b5bd..e38b786ef5 100644
--- a/src/api/open-hands.types.ts
+++ b/src/api/open-hands.types.ts
@@ -79,7 +79,6 @@ export interface Conversation {
conversation_version?: "V0" | "V1";
sub_conversation_ids?: string[];
public?: boolean;
- sandbox_id?: string | null;
llm_model?: string | null;
}
diff --git a/src/api/sandbox-service/sandbox-service.api.ts b/src/api/sandbox-service/sandbox-service.api.ts
deleted file mode 100644
index 65b49af686..0000000000
--- a/src/api/sandbox-service/sandbox-service.api.ts
+++ /dev/null
@@ -1,23 +0,0 @@
-import V1ConversationService from "../conversation-service/v1-conversation-service.api";
-import type { V1SandboxInfo } from "./sandbox-service.types";
-import { createSandboxInfo } from "../agent-server-adapter";
-
-export class SandboxService {
- static async pauseSandbox(sandboxId: string): Promise<{ success: boolean }> {
- return V1ConversationService.pauseConversation(sandboxId, null, null);
- }
-
- static async resumeSandbox(sandboxId: string): Promise<{ success: boolean }> {
- return V1ConversationService.resumeConversation(sandboxId, null, null);
- }
-
- static async batchGetSandboxes(
- ids: string[],
- ): Promise<(V1SandboxInfo | null)[]> {
- const conversations =
- await V1ConversationService.batchGetAppConversations(ids);
- return conversations.map((conversation) =>
- conversation ? createSandboxInfo(conversation) : null,
- );
- }
-}
diff --git a/src/api/sandbox-service/sandbox-service.types.ts b/src/api/sandbox-service/sandbox-service.types.ts
deleted file mode 100644
index c06669ff03..0000000000
--- a/src/api/sandbox-service/sandbox-service.types.ts
+++ /dev/null
@@ -1,24 +0,0 @@
-// sandbox-service.types.ts
-// This file contains types for Sandbox API.
-
-export type V1SandboxStatus =
- | "MISSING"
- | "STARTING"
- | "RUNNING"
- | "PAUSED"
- | "ERROR";
-
-export interface V1ExposedUrl {
- name: string;
- url: string;
-}
-
-export interface V1SandboxInfo {
- id: string;
- created_by_user_id: string | null;
- sandbox_spec_id: string;
- status: V1SandboxStatus;
- session_api_key: string | null;
- exposed_urls: V1ExposedUrl[] | null;
- created_at: string;
-}
diff --git a/src/api/shared-conversation-service.api.ts b/src/api/shared-conversation-service.api.ts
index f444069fc1..38e5dad9ee 100644
--- a/src/api/shared-conversation-service.api.ts
+++ b/src/api/shared-conversation-service.api.ts
@@ -4,7 +4,6 @@ import { createHttpClient } from "./typescript-client";
export interface SharedConversation {
id: string;
created_by_user_id: string | null;
- sandbox_id: string;
selected_repository: string | null;
selected_branch: string | null;
git_provider: string | null;
diff --git a/src/components/features/chat/components/chat-input-actions.tsx b/src/components/features/chat/components/chat-input-actions.tsx
index b674f735cf..59bd615cee 100644
--- a/src/components/features/chat/components/chat-input-actions.tsx
+++ b/src/components/features/chat/components/chat-input-actions.tsx
@@ -1,6 +1,6 @@
import { AgentStatus } from "#/components/features/controls/agent-status";
import { Tools } from "../../controls/tools";
-import { useUnifiedPauseConversationSandbox } from "#/hooks/mutation/use-unified-stop-conversation";
+import { useUnifiedPauseConversation } from "#/hooks/mutation/use-unified-stop-conversation";
import { useConversationId } from "#/hooks/use-conversation-id";
import { useV1PauseConversation } from "#/hooks/mutation/use-v1-pause-conversation";
import { useV1ResumeConversation } from "#/hooks/mutation/use-v1-resume-conversation";
@@ -11,7 +11,7 @@ interface ChatInputActionsProps {
}
export function ChatInputActions({ disabled }: ChatInputActionsProps) {
- const pauseConversationSandboxMutation = useUnifiedPauseConversationSandbox();
+ const pauseConversationMutation = useUnifiedPauseConversation();
const v1PauseConversationMutation = useV1PauseConversation();
const v1ResumeConversationMutation = useV1ResumeConversation();
const { conversationId } = useConversationId();
@@ -27,7 +27,7 @@ export function ChatInputActions({ disabled }: ChatInputActionsProps) {
};
const isPausing =
- pauseConversationSandboxMutation.isPending ||
+ pauseConversationMutation.isPending ||
v1PauseConversationMutation.isPending;
return (
diff --git a/src/components/features/chat/custom-chat-input.tsx b/src/components/features/chat/custom-chat-input.tsx
index 0370d340a5..632b57eac3 100644
--- a/src/components/features/chat/custom-chat-input.tsx
+++ b/src/components/features/chat/custom-chat-input.tsx
@@ -9,13 +9,14 @@ import { ChatInputGrip } from "./components/chat-input-grip";
import { ChatInputContainer } from "./components/chat-input-container";
import { HiddenFileInput } from "./components/hidden-file-input";
import { useConversationStore } from "#/stores/conversation-store";
-import { V1SandboxStatus } from "#/api/sandbox-service/sandbox-service.types";
+import { V1ExecutionStatus } from "#/types/v1/core/base/common";
+import { isExecutionErrored } from "#/utils/status";
export interface CustomChatInputProps {
disabled?: boolean;
isNewConversationPending?: boolean;
showButton?: boolean;
- sandboxStatus?: V1SandboxStatus | null;
+ executionStatus?: V1ExecutionStatus | null;
onSubmit: (message: string) => void;
onFocus?: () => void;
onBlur?: () => void;
@@ -28,7 +29,7 @@ export function CustomChatInput({
disabled = false,
isNewConversationPending = false,
showButton = true,
- sandboxStatus = null,
+ executionStatus = null,
onSubmit,
onFocus,
onBlur,
@@ -43,9 +44,7 @@ export function CustomChatInput({
setSubmittedMessage,
} = useConversationStore();
- // Disable input when conversation is stopped
- const isConversationStopped = sandboxStatus === "MISSING";
- const isDisabled = disabled || isConversationStopped;
+ const isDisabled = disabled || isExecutionErrored(executionStatus);
// Listen to submittedMessage state changes
useEffect(() => {
diff --git a/src/components/features/chat/interactive-chat-box.tsx b/src/components/features/chat/interactive-chat-box.tsx
index eaa8532776..766633c34e 100644
--- a/src/components/features/chat/interactive-chat-box.tsx
+++ b/src/components/features/chat/interactive-chat-box.tsx
@@ -164,7 +164,7 @@ export function InteractiveChatBox({
isNewConversationPending={disabled}
onSubmit={handleSubmit}
onFilesPaste={handleUpload}
- sandboxStatus={conversation?.sandbox_status || null}
+ executionStatus={conversation?.execution_status || null}
/>
<div className="mt-4">
<GitControlBar onSuggestionsClick={handleSuggestionsClick} />
diff --git a/src/components/features/controls/agent-status.tsx b/src/components/features/controls/agent-status.tsx
index cf02287ae5..6c4abbba5d 100644
--- a/src/components/features/controls/agent-status.tsx
+++ b/src/components/features/controls/agent-status.tsx
@@ -53,7 +53,6 @@ export function AgentStatus({
const statusCode = getStatusCode(
webSocketStatus,
executionStatus ?? null,
- conversation?.sandbox_status || null,
taskStatus,
subConversationTaskStatus,
);
diff --git a/src/components/features/controls/server-status-context-menu.tsx b/src/components/features/controls/server-status-context-menu.tsx
index ae51826097..6e89e7aa62 100644
--- a/src/components/features/controls/server-status-context-menu.tsx
+++ b/src/components/features/controls/server-status-context-menu.tsx
@@ -8,13 +8,14 @@ import { ServerStatusContextMenuIconText } from "./server-status-context-menu-ic
import { ServerStatus } from "./server-status";
import { Divider } from "#/ui/divider";
import { cn } from "#/utils/utils";
-import { V1SandboxStatus } from "#/api/sandbox-service/sandbox-service.types";
+import { V1ExecutionStatus } from "#/types/v1/core/base/common";
+import { isExecutionActive, isExecutionPaused } from "#/utils/status";
interface ServerStatusContextMenuProps {
onClose: () => void;
onStopServer?: (event: React.MouseEvent<HTMLButtonElement>) => void;
onStartServer?: (event: React.MouseEvent<HTMLButtonElement>) => void;
- sandboxStatus: V1SandboxStatus | null;
+ executionStatus: V1ExecutionStatus | null;
position?: "top" | "bottom";
className?: string;
isPausing?: boolean;
@@ -24,7 +25,7 @@ export function ServerStatusContextMenu({
onClose,
onStopServer,
onStartServer,
- sandboxStatus,
+ executionStatus,
position = "top",
className = "",
isPausing = false,
@@ -32,8 +33,9 @@ export function ServerStatusContextMenu({
const { t } = useTranslation("openhands");
const ref = useClickOutsideElement<HTMLUListElement>(onClose);
- const shouldActionShown =
- sandboxStatus === "RUNNING" || sandboxStatus === "MISSING";
+ const isActive = isExecutionActive(executionStatus);
+ const isPaused = isExecutionPaused(executionStatus);
+ const shouldActionShown = isActive || isPaused;
return (
<ContextMenu
@@ -45,7 +47,7 @@ export function ServerStatusContextMenu({
className={cn("left-2 w-fit min-w-42", className)}
>
<ServerStatus
- sandboxStatus={sandboxStatus}
+ executionStatus={executionStatus}
isPausing={isPausing}
className="py-1"
/>
@@ -54,7 +56,7 @@ export function ServerStatusContextMenu({
<>
<Divider />
- {sandboxStatus === "RUNNING" && onStopServer && (
+ {isActive && onStopServer && (
<ServerStatusContextMenuIconText
icon={<StopCircleIcon width={18} height={18} />}
text={t(I18nKey.COMMON$STOP_RUNTIME)}
@@ -63,7 +65,7 @@ export function ServerStatusContextMenu({
/>
)}
- {sandboxStatus === "MISSING" && onStartServer && (
+ {isPaused && onStartServer && (
<ServerStatusContextMenuIconText
icon={<PlayCircleIcon width={18} height={18} />}
text={t(I18nKey.COMMON$START_RUNTIME)}
diff --git a/src/components/features/controls/server-status.tsx b/src/components/features/controls/server-status.tsx
index da2ba0fa35..59b570de59 100644
--- a/src/components/features/controls/server-status.tsx
+++ b/src/components/features/controls/server-status.tsx
@@ -5,17 +5,18 @@ import { useAgentState } from "#/hooks/use-agent-state";
import { useTaskPolling } from "#/hooks/query/use-task-polling";
import { getStatusColor, getStatusText } from "#/utils/utils";
import { useErrorMessageStore } from "#/stores/error-message-store";
-import { V1SandboxStatus } from "#/api/sandbox-service/sandbox-service.types";
+import { V1ExecutionStatus } from "#/types/v1/core/base/common";
+import { isExecutionErrored, isExecutionPaused } from "#/utils/status";
export interface ServerStatusProps {
className?: string;
- sandboxStatus: V1SandboxStatus | null;
+ executionStatus: V1ExecutionStatus | null;
isPausing?: boolean;
}
export function ServerStatus({
className = "",
- sandboxStatus,
+ executionStatus,
isPausing = false,
}: ServerStatusProps) {
const { curAgentState } = useAgentState();
@@ -25,7 +26,8 @@ export function ServerStatus({
const isStartingStatus =
curAgentState === AgentState.LOADING || curAgentState === AgentState.INIT;
- const isStopStatus = sandboxStatus === "MISSING";
+ const isStopStatus =
+ isExecutionErrored(executionStatus) || isExecutionPaused(executionStatus);
const statusColor = getStatusColor({
isPausing,
diff --git a/src/components/features/controls/tools.tsx b/src/components/features/controls/tools.tsx
index c261f20d65..0da072a43c 100644
--- a/src/components/features/controls/tools.tsx
+++ b/src/components/features/controls/tools.tsx
@@ -31,8 +31,8 @@ export function Tools() {
shouldShowHooks,
} = useConversationNameContextMenu({
conversationId,
- sandboxStatus: conversation?.sandbox_status,
- showOptions: true, // Enable all options for conversation name
+ executionStatus: conversation?.execution_status,
+ showOptions: true,
onContextMenuToggle: setContextMenuOpen,
});
diff --git a/src/components/features/conversation-panel/confirm-stop-modal.tsx b/src/components/features/conversation-panel/confirm-stop-modal.tsx
index 87e8ec5b99..6eebec8e09 100644
--- a/src/components/features/conversation-panel/confirm-stop-modal.tsx
+++ b/src/components/features/conversation-panel/confirm-stop-modal.tsx
@@ -7,71 +7,17 @@ import { ModalBackdrop } from "#/components/shared/modals/modal-backdrop";
import { ModalBody } from "#/components/shared/modals/modal-body";
import { BrandButton } from "../settings/brand-button";
import { I18nKey } from "#/i18n/declaration";
-import { useConversationsInSandbox } from "#/hooks/query/use-conversations-in-sandbox";
interface ConfirmStopModalProps {
onConfirm: () => void;
onCancel: () => void;
- sandboxId: string | null;
-}
-
-function ConversationsList({
- conversations,
- isLoading,
- isError,
- t,
-}: {
- conversations: { id: string; title: string | null }[] | undefined;
- isLoading: boolean;
- isError: boolean;
- t: (key: string) => string;
-}) {
- if (isLoading) {
- return (
- <div
- className="text-sm text-content-secondary"
- data-testid="conversations-loading"
- >
- {t(I18nKey.HOME$LOADING)}
- </div>
- );
- }
-
- if (isError) {
- return (
- <div className="text-sm text-danger" data-testid="conversations-error">
- {t(I18nKey.COMMON$ERROR)}
- </div>
- );
- }
-
- if (conversations && conversations.length > 0) {
- return (
- <ul
- className="list-disc list-inside text-sm text-content-secondary"
- data-testid="conversations-list"
- >
- {conversations.map((conv) => (
- <li key={conv.id}>{conv.title || conv.id}</li>
- ))}
- </ul>
- );
- }
-
- return null;
}
export function ConfirmStopModal({
onConfirm,
onCancel,
- sandboxId,
}: ConfirmStopModalProps) {
const { t } = useTranslation("openhands");
- const {
- data: conversations,
- isLoading,
- isError,
- } = useConversationsInSandbox(sandboxId);
return (
<ModalBackdrop onClose={onCancel}>
@@ -83,12 +29,6 @@ export function ConfirmStopModal({
<BaseModalDescription
description={t(I18nKey.CONVERSATION$CLOSE_CONVERSATION_WARNING)}
/>
- <ConversationsList
- conversations={conversations}
- isLoading={isLoading}
- isError={isError}
- t={t}
- />
</div>
<div
className="flex flex-col gap-2 w-full"
diff --git a/src/components/features/conversation-panel/conversation-card/conversation-card-actions.tsx b/src/components/features/conversation-panel/conversation-card/conversation-card-actions.tsx
index 560203b1d8..64774edd2d 100644
--- a/src/components/features/conversation-panel/conversation-card/conversation-card-actions.tsx
+++ b/src/components/features/conversation-panel/conversation-card/conversation-card-actions.tsx
@@ -1,6 +1,7 @@
import React from "react";
import { cn } from "#/utils/utils";
-import { V1SandboxStatus } from "#/api/sandbox-service/sandbox-service.types";
+import { V1ExecutionStatus } from "#/types/v1/core/base/common";
+import { isExecutionActive, isExecutionPaused } from "#/utils/status";
import { ConversationCardContextMenu } from "./conversation-card-context-menu";
import EllipsisIcon from "#/icons/ellipsis.svg?react";
@@ -12,7 +13,7 @@ interface ConversationCardActionsProps {
onEdit?: (event: React.MouseEvent<HTMLButtonElement>) => void;
onDownloadViaVSCode?: (event: React.MouseEvent<HTMLButtonElement>) => void;
onDownloadConversation?: (event: React.MouseEvent<HTMLButtonElement>) => void;
- sandboxStatus?: V1SandboxStatus;
+ executionStatus?: V1ExecutionStatus | null;
conversationId?: string;
showOptions?: boolean;
}
@@ -25,11 +26,12 @@ export function ConversationCardActions({
onEdit,
onDownloadViaVSCode,
onDownloadConversation,
- sandboxStatus,
+ executionStatus,
conversationId,
showOptions,
}: ConversationCardActionsProps) {
- const isConversationStopped = sandboxStatus === "MISSING";
+ const isPaused = isExecutionPaused(executionStatus);
+ const isActive = isExecutionActive(executionStatus);
return (
<div className="group">
@@ -43,27 +45,21 @@ export function ConversationCardActions({
}}
className={cn(
"cursor-pointer w-6 h-6 flex flex-row items-center justify-center translate-x-2.5",
- isConversationStopped && "opacity-60",
+ isPaused && "opacity-60",
)}
>
<EllipsisIcon />
</button>
<div
className={cn(
- // Show on hover (desktop) or when explicitly opened (click/touch)
"relative opacity-0 invisible group-hover:opacity-100 group-hover:visible",
- // Override hover styles when explicitly opened via click
contextMenuOpen && "opacity-100 visible",
)}
>
<ConversationCardContextMenu
onClose={() => onContextMenuToggle(false)}
onDelete={onDelete}
- onStop={
- sandboxStatus === "RUNNING" || sandboxStatus === "STARTING"
- ? onStop
- : undefined
- }
+ onStop={isActive ? onStop : undefined}
onEdit={onEdit}
onDownloadViaVSCode={
conversationId && showOptions ? onDownloadViaVSCode : undefined
diff --git a/src/components/features/conversation-panel/conversation-card/conversation-card-footer.tsx b/src/components/features/conversation-panel/conversation-card/conversation-card-footer.tsx
index e0a1470e87..90460ee317 100644
--- a/src/components/features/conversation-panel/conversation-card/conversation-card-footer.tsx
+++ b/src/components/features/conversation-panel/conversation-card/conversation-card-footer.tsx
@@ -3,16 +3,17 @@ import { formatTimeDelta } from "#/utils/format-time-delta";
import { cn } from "#/utils/utils";
import { I18nKey } from "#/i18n/declaration";
import { RepositorySelection } from "#/api/open-hands.types";
-import { V1SandboxStatus } from "#/api/sandbox-service/sandbox-service.types";
+import { V1ExecutionStatus } from "#/types/v1/core/base/common";
+import { isExecutionPaused } from "#/utils/status";
import { ConversationRepoLink } from "./conversation-repo-link";
import { NoRepository } from "./no-repository";
import CircuitIcon from "#/icons/u-circuit.svg?react";
interface ConversationCardFooterProps {
selectedRepository: RepositorySelection | null;
- lastUpdatedAt: string; // ISO 8601
- createdAt?: string; // ISO 8601
- sandboxStatus?: V1SandboxStatus;
+ lastUpdatedAt: string;
+ createdAt?: string;
+ executionStatus?: V1ExecutionStatus | null;
llmModel?: string | null;
}
@@ -20,18 +21,18 @@ export function ConversationCardFooter({
selectedRepository,
lastUpdatedAt,
createdAt,
- sandboxStatus,
+ executionStatus,
llmModel,
}: ConversationCardFooterProps) {
const { t } = useTranslation("openhands");
- const isConversationArchived = sandboxStatus === "MISSING";
+ const isPaused = isExecutionPaused(executionStatus);
return (
<div
className={cn(
"flex flex-row justify-between items-center mt-1",
- isConversationArchived && "opacity-60",
+ isPaused && "opacity-60",
)}
>
{selectedRepository?.selected_repository ? (
diff --git a/src/components/features/conversation-panel/conversation-card/conversation-card-header.tsx b/src/components/features/conversation-panel/conversation-card/conversation-card-header.tsx
index 2cf4409d6e..d611a542b0 100644
--- a/src/components/features/conversation-panel/conversation-card/conversation-card-header.tsx
+++ b/src/components/features/conversation-panel/conversation-card/conversation-card-header.tsx
@@ -1,35 +1,32 @@
-import { V1SandboxStatus } from "#/api/sandbox-service/sandbox-service.types";
+import { V1ExecutionStatus } from "#/types/v1/core/base/common";
import { ConversationCardTitle } from "./conversation-card-title";
-import { SandboxStatusIndicator } from "../../home/recent-conversations/sandbox-status-indicator";
+import { ConversationStatusDot } from "../../home/recent-conversations/conversation-status-dot";
interface ConversationCardHeaderProps {
title: string;
titleMode: "view" | "edit";
onTitleSave: (title: string) => void;
- sandboxStatus?: V1SandboxStatus;
+ executionStatus?: V1ExecutionStatus | null;
}
export function ConversationCardHeader({
title,
titleMode,
onTitleSave,
- sandboxStatus,
+ executionStatus,
}: ConversationCardHeaderProps) {
- const isConversationArchived = sandboxStatus === "MISSING";
-
return (
<div className="flex items-center gap-2 flex-1 min-w-0 overflow-hidden mr-2">
- {/* Status Indicator - use V1 sandbox status directly */}
- {sandboxStatus && (
+ {executionStatus !== undefined && (
<div className="flex items-center">
- <SandboxStatusIndicator sandboxStatus={sandboxStatus} />
+ <ConversationStatusDot executionStatus={executionStatus} />
</div>
)}
<ConversationCardTitle
title={title}
titleMode={titleMode}
onSave={onTitleSave}
- isConversationArchived={isConversationArchived}
+ isConversationArchived={false}
/>
</div>
);
diff --git a/src/components/features/conversation-panel/conversation-card/conversation-card.tsx b/src/components/features/conversation-panel/conversation-card/conversation-card.tsx
index cbca946c47..d34a2f2768 100644
--- a/src/components/features/conversation-panel/conversation-card/conversation-card.tsx
+++ b/src/components/features/conversation-panel/conversation-card/conversation-card.tsx
@@ -3,12 +3,11 @@ import { usePostHog } from "posthog-js/react";
import { cn } from "#/utils/utils";
import { transformVSCodeUrl } from "#/utils/vscode-url-helper";
import ConversationService from "#/api/conversation-service/conversation-service.api";
-import { V1SandboxStatus } from "#/api/sandbox-service/sandbox-service.types";
+import { V1ExecutionStatus } from "#/types/v1/core/base/common";
import { RepositorySelection } from "#/api/open-hands.types";
import { ConversationCardHeader } from "./conversation-card-header";
import { ConversationCardActions } from "./conversation-card-actions";
import { ConversationCardFooter } from "./conversation-card-footer";
-import { SandboxStatusBadges } from "./sandbox-status-badges";
import { useDownloadConversation } from "#/hooks/use-download-conversation";
interface ConversationCardProps {
@@ -19,10 +18,10 @@ interface ConversationCardProps {
showOptions?: boolean;
title: string;
selectedRepository: RepositorySelection | null;
- lastUpdatedAt: string; // ISO 8601
- createdAt?: string; // ISO 8601
- sandboxStatus?: V1SandboxStatus;
- conversationId?: string; // Optional conversation ID for VS Code URL
+ lastUpdatedAt: string;
+ createdAt?: string;
+ executionStatus?: V1ExecutionStatus | null;
+ conversationId?: string;
contextMenuOpen?: boolean;
onContextMenuToggle?: (isOpen: boolean) => void;
llmModel?: string | null;
@@ -41,7 +40,7 @@ export function ConversationCard({
lastUpdatedAt,
createdAt,
conversationId,
- sandboxStatus,
+ executionStatus,
contextMenuOpen = false,
onContextMenuToggle,
llmModel,
@@ -134,9 +133,8 @@ export function ConversationCard({
title={title}
titleMode={titleMode}
onTitleSave={onTitleSave}
- sandboxStatus={sandboxStatus}
+ executionStatus={executionStatus}
/>
- <SandboxStatusBadges sandboxStatus={sandboxStatus} />
</div>
{hasContextMenu && (
@@ -148,7 +146,7 @@ export function ConversationCard({
onEdit={onChangeTitle && handleEdit}
onDownloadViaVSCode={handleDownloadViaVSCode}
onDownloadConversation={handleDownloadConversation}
- sandboxStatus={sandboxStatus}
+ executionStatus={executionStatus}
conversationId={conversationId}
showOptions={showOptions}
/>
@@ -159,7 +157,7 @@ export function ConversationCard({
selectedRepository={selectedRepository}
lastUpdatedAt={lastUpdatedAt}
createdAt={createdAt}
- sandboxStatus={sandboxStatus}
+ executionStatus={executionStatus}
llmModel={llmModel}
/>
</div>
diff --git a/src/components/features/conversation-panel/conversation-card/sandbox-status-badges.tsx b/src/components/features/conversation-panel/conversation-card/sandbox-status-badges.tsx
deleted file mode 100644
index 5f6a7e6d5b..0000000000
--- a/src/components/features/conversation-panel/conversation-card/sandbox-status-badges.tsx
+++ /dev/null
@@ -1,26 +0,0 @@
-import { FaArchive } from "react-icons/fa";
-import { useTranslation } from "react-i18next";
-import { I18nKey } from "#/i18n/declaration";
-import { V1SandboxStatus } from "#/api/sandbox-service/sandbox-service.types";
-
-interface SandboxStatusBadgesProps {
- sandboxStatus?: V1SandboxStatus;
-}
-
-export function SandboxStatusBadges({
- sandboxStatus,
-}: SandboxStatusBadgesProps) {
- const { t } = useTranslation("openhands");
-
- // Only show badge for MISSING (archived) status
- if (sandboxStatus !== "MISSING") {
- return null;
- }
-
- return (
- <span className="flex items-center gap-1 px-1.5 py-0.5 bg-[#868E96] text-white text-xs font-medium rounded-full opacity-60">
- <FaArchive size={10} className="text-white" />
- <span>{t(I18nKey.COMMON$ARCHIVED)}</span>
- </span>
- );
-}
diff --git a/src/components/features/conversation-panel/conversation-panel.tsx b/src/components/features/conversation-panel/conversation-panel.tsx
index a16f338fa5..c2883037d5 100644
--- a/src/components/features/conversation-panel/conversation-panel.tsx
+++ b/src/components/features/conversation-panel/conversation-panel.tsx
@@ -6,7 +6,7 @@ import { usePaginatedConversations } from "#/hooks/query/use-paginated-conversat
import { useStartTasks } from "#/hooks/query/use-start-tasks";
import { useInfiniteScroll } from "#/hooks/use-infinite-scroll";
import { useDeleteConversation } from "#/hooks/mutation/use-delete-conversation";
-import { useUnifiedPauseConversationSandbox } from "#/hooks/mutation/use-unified-stop-conversation";
+import { useUnifiedPauseConversation } from "#/hooks/mutation/use-unified-stop-conversation";
import { ConfirmDeleteModal } from "./confirm-delete-modal";
import { ConfirmStopModal } from "./confirm-stop-modal";
import { LoadingSpinner } from "#/components/shared/loading-spinner";
@@ -42,9 +42,6 @@ export function ConversationPanel({ onClose }: ConversationPanelProps) {
>(null);
const [selectedConversationTitle, setSelectedConversationTitle] =
React.useState<string | null>(null);
- const [selectedSandboxId, setSelectedSandboxId] = React.useState<
- string | null
- >(null);
const [openContextMenuId, setOpenContextMenuId] = React.useState<
string | null
>(null);
@@ -65,8 +62,7 @@ export function ConversationPanel({ onClose }: ConversationPanelProps) {
const conversations = data?.pages.flatMap((page) => page.items) ?? [];
const { mutate: deleteConversation } = useDeleteConversation();
- const { mutate: pauseConversationSandbox } =
- useUnifiedPauseConversationSandbox();
+ const { mutate: pauseConversation } = useUnifiedPauseConversation();
const { mutate: updateConversation } = useUpdateConversation();
// Set up infinite scroll
@@ -83,13 +79,9 @@ export function ConversationPanel({ onClose }: ConversationPanelProps) {
setSelectedConversationTitle(title);
};
- const handleStopConversation = (
- conversationId: string,
- sandboxId?: string | null,
- ) => {
+ const handleStopConversation = (conversationId: string) => {
setConfirmStopModalVisible(true);
setSelectedConversationId(conversationId);
- setSelectedSandboxId(sandboxId ?? null);
};
const handleConversationTitleChange = async (
@@ -123,7 +115,7 @@ export function ConversationPanel({ onClose }: ConversationPanelProps) {
const handleConfirmStop = () => {
if (selectedConversationId) {
- pauseConversationSandbox({
+ pauseConversation({
conversationId: selectedConversationId,
});
}
@@ -181,9 +173,7 @@ export function ConversationPanel({ onClose }: ConversationPanelProps) {
onDelete={() =>
handleDeleteProject(conversation.id, conversation.title ?? "")
}
- onStop={() =>
- handleStopConversation(conversation.id, conversation.sandbox_id)
- }
+ onStop={() => handleStopConversation(conversation.id)}
onChangeTitle={(title) =>
handleConversationTitleChange(conversation.id, title)
}
@@ -195,7 +185,7 @@ export function ConversationPanel({ onClose }: ConversationPanelProps) {
}}
lastUpdatedAt={conversation.updated_at}
createdAt={conversation.created_at}
- sandboxStatus={conversation.sandbox_status}
+ executionStatus={conversation.execution_status}
conversationId={conversation.id}
contextMenuOpen={openContextMenuId === conversation.id}
onContextMenuToggle={(isOpen) =>
@@ -235,7 +225,6 @@ export function ConversationPanel({ onClose }: ConversationPanelProps) {
setConfirmStopModalVisible(false);
}}
onCancel={() => setConfirmStopModalVisible(false)}
- sandboxId={selectedSandboxId}
/>
)}
diff --git a/src/components/features/conversation-panel/start-task-card/start-task-status-indicator.tsx b/src/components/features/conversation-panel/start-task-card/start-task-status-indicator.tsx
index d48a604b5b..e387659988 100644
--- a/src/components/features/conversation-panel/start-task-card/start-task-status-indicator.tsx
+++ b/src/components/features/conversation-panel/start-task-card/start-task-status-indicator.tsx
@@ -15,7 +15,6 @@ export function StartTaskStatusIndicator({
case "ERROR":
return "bg-red-500";
case "WORKING":
- case "WAITING_FOR_SANDBOX":
case "PREPARING_REPOSITORY":
case "RUNNING_SETUP_SCRIPT":
case "SETTING_UP_GIT_HOOKS":
diff --git a/src/components/features/conversation/conversation-name-with-status.tsx b/src/components/features/conversation/conversation-name-with-status.tsx
index 7bd35770bb..303fd8372c 100644
--- a/src/components/features/conversation/conversation-name-with-status.tsx
+++ b/src/components/features/conversation/conversation-name-with-status.tsx
@@ -2,8 +2,8 @@ import React from "react";
import { useAgentState } from "#/hooks/use-agent-state";
import { useTaskPolling } from "#/hooks/query/use-task-polling";
import { useActiveConversation } from "#/hooks/query/use-active-conversation";
-import { useUnifiedPauseConversationSandbox } from "#/hooks/mutation/use-unified-stop-conversation";
-import { useUnifiedResumeConversationSandbox } from "#/hooks/mutation/use-unified-start-conversation";
+import { useUnifiedPauseConversation } from "#/hooks/mutation/use-unified-stop-conversation";
+import { useUnifiedResumeConversation } from "#/hooks/mutation/use-unified-start-conversation";
import { useConversationId } from "#/hooks/use-conversation-id";
import { useUserProviders } from "#/hooks/use-user-providers";
import { getStatusColor } from "#/utils/utils";
@@ -11,21 +11,25 @@ import { AgentState } from "#/types/agent-state";
import DebugStackframeDot from "#/icons/debug-stackframe-dot.svg?react";
import { ServerStatusContextMenu } from "../controls/server-status-context-menu";
import { ConversationName } from "./conversation-name";
+import {
+ isExecutionActive,
+ isExecutionErrored,
+ isExecutionPaused,
+} from "#/utils/status";
export function ConversationNameWithStatus() {
const { conversationId } = useConversationId();
const { data: conversation } = useActiveConversation();
const { curAgentState } = useAgentState();
const { isTask, taskStatus } = useTaskPolling();
- const { mutate: pauseConversationSandbox } =
- useUnifiedPauseConversationSandbox();
- const { mutate: resumeConversationSandbox } =
- useUnifiedResumeConversationSandbox();
+ const { mutate: pauseConversation } = useUnifiedPauseConversation();
+ const { mutate: resumeConversation } = useUnifiedResumeConversation();
const { providers } = useUserProviders();
+ const executionStatus = conversation?.execution_status ?? null;
const isStartingStatus =
curAgentState === AgentState.LOADING || curAgentState === AgentState.INIT;
- const isStopStatus = conversation?.sandbox_status === "MISSING";
+ const isStopStatus = isExecutionErrored(executionStatus);
const statusColor = getStatusColor({
isPausing: false,
@@ -40,7 +44,7 @@ export function ConversationNameWithStatus() {
event.preventDefault();
event.stopPropagation();
if (conversationId) {
- pauseConversationSandbox({ conversationId });
+ pauseConversation({ conversationId });
}
};
@@ -48,7 +52,7 @@ export function ConversationNameWithStatus() {
event.preventDefault();
event.stopPropagation();
if (conversationId) {
- resumeConversationSandbox({ conversationId, providers });
+ resumeConversation({ conversationId, providers });
}
};
@@ -62,16 +66,12 @@ export function ConversationNameWithStatus() {
<ServerStatusContextMenu
onClose={() => {}}
onStopServer={
- conversation?.sandbox_status === "RUNNING"
- ? handleStopServer
- : undefined
+ isExecutionActive(executionStatus) ? handleStopServer : undefined
}
onStartServer={
- conversation?.sandbox_status === "MISSING"
- ? handleStartServer
- : undefined
+ isExecutionPaused(executionStatus) ? handleStartServer : undefined
}
- sandboxStatus={conversation?.sandbox_status ?? null}
+ executionStatus={executionStatus}
position="bottom"
className="opacity-0 invisible pointer-events-none group-hover:opacity-100 group-hover:visible group-hover:pointer-events-auto bottom-full left-0 mt-0 min-h-fit"
isPausing={false}
diff --git a/src/components/features/conversation/conversation-name.tsx b/src/components/features/conversation/conversation-name.tsx
index a170b46911..9cbeb804cf 100644
--- a/src/components/features/conversation/conversation-name.tsx
+++ b/src/components/features/conversation/conversation-name.tsx
@@ -58,8 +58,8 @@ export function ConversationName() {
shouldShowHooks,
} = useConversationNameContextMenu({
conversationId,
- sandboxStatus: conversation?.sandbox_status,
- showOptions: true, // Enable all options for conversation name
+ executionStatus: conversation?.execution_status,
+ showOptions: true,
onContextMenuToggle: setContextMenuOpen,
});
@@ -228,12 +228,10 @@ export function ConversationName() {
/>
)}
- {/* Confirm Stop Modal */}
{confirmStopModalVisible && (
<ConfirmStopModal
onConfirm={handleConfirmStop}
onCancel={() => setConfirmStopModalVisible(false)}
- sandboxId={conversation?.sandbox_id ?? null}
/>
)}
</>
diff --git a/src/components/features/conversation/metrics-modal/metrics-modal.tsx b/src/components/features/conversation/metrics-modal/metrics-modal.tsx
index 08db4a1419..7427ea4266 100644
--- a/src/components/features/conversation/metrics-modal/metrics-modal.tsx
+++ b/src/components/features/conversation/metrics-modal/metrics-modal.tsx
@@ -10,7 +10,7 @@ import { ContextWindowSection } from "./context-window-section";
import { EmptyState } from "./empty-state";
import useMetricsStore from "#/stores/metrics-store";
import { useActiveConversation } from "#/hooks/query/use-active-conversation";
-import { useSandboxMetrics } from "#/hooks/query/use-sandbox-metrics";
+import { useConversationMetrics } from "#/hooks/query/use-conversation-metrics";
interface MetricsModalProps {
isOpen: boolean;
@@ -26,43 +26,42 @@ export function MetricsModal({ isOpen, onOpenChange }: MetricsModalProps) {
const conversationUrl = conversation?.conversation_url;
const sessionApiKey = conversation?.session_api_key;
- // For V1 conversations, fetch metrics directly from the sandbox
- // Only fetch when the modal is open to avoid unnecessary requests
- const { data: sandboxMetrics } = useSandboxMetrics(
+ const { data: conversationMetrics } = useConversationMetrics(
conversationId,
conversationUrl,
sessionApiKey,
- isOpen, // Only enable when modal is open
+ isOpen,
);
- // Compute the metrics based on conversation version
const metrics = useMemo(() => {
- if (sandboxMetrics) {
+ if (conversationMetrics) {
return {
- cost: sandboxMetrics.accumulated_cost,
- max_budget_per_task: sandboxMetrics.max_budget_per_task,
- usage: sandboxMetrics.accumulated_token_usage
+ cost: conversationMetrics.accumulated_cost,
+ max_budget_per_task: conversationMetrics.max_budget_per_task,
+ usage: conversationMetrics.accumulated_token_usage
? {
prompt_tokens:
- sandboxMetrics.accumulated_token_usage.prompt_tokens ?? 0,
+ conversationMetrics.accumulated_token_usage.prompt_tokens ?? 0,
completion_tokens:
- sandboxMetrics.accumulated_token_usage.completion_tokens ?? 0,
+ conversationMetrics.accumulated_token_usage.completion_tokens ??
+ 0,
cache_read_tokens:
- sandboxMetrics.accumulated_token_usage.cache_read_tokens ?? 0,
+ conversationMetrics.accumulated_token_usage.cache_read_tokens ??
+ 0,
cache_write_tokens:
- sandboxMetrics.accumulated_token_usage.cache_write_tokens ?? 0,
+ conversationMetrics.accumulated_token_usage
+ .cache_write_tokens ?? 0,
context_window:
- sandboxMetrics.accumulated_token_usage.context_window ?? 0,
+ conversationMetrics.accumulated_token_usage.context_window ?? 0,
per_turn_token:
- sandboxMetrics.accumulated_token_usage.per_turn_token ?? 0,
+ conversationMetrics.accumulated_token_usage.per_turn_token ?? 0,
}
: null,
};
}
- // For non-V1 conversations, use the store metrics
return storeMetrics;
- }, [sandboxMetrics, storeMetrics]);
+ }, [conversationMetrics, storeMetrics]);
if (!isOpen) return null;
diff --git a/src/components/features/home/recent-conversations/conversation-status-dot.tsx b/src/components/features/home/recent-conversations/conversation-status-dot.tsx
new file mode 100644
index 0000000000..9dcc79b8be
--- /dev/null
+++ b/src/components/features/home/recent-conversations/conversation-status-dot.tsx
@@ -0,0 +1,62 @@
+import { useMemo } from "react";
+import { useTranslation } from "react-i18next";
+import { V1ExecutionStatus } from "#/types/v1/core/base/common";
+import { cn } from "#/utils/utils";
+import { StyledTooltip } from "#/components/shared/buttons/styled-tooltip";
+
+interface ConversationStatusDotProps {
+ executionStatus: V1ExecutionStatus | null | undefined;
+}
+
+const labelKeyFor = (status: V1ExecutionStatus | null | undefined): string => {
+ switch (status) {
+ case V1ExecutionStatus.RUNNING:
+ case V1ExecutionStatus.IDLE:
+ case V1ExecutionStatus.WAITING_FOR_CONFIRMATION:
+ case V1ExecutionStatus.FINISHED:
+ return "COMMON$RUNNING";
+ case V1ExecutionStatus.PAUSED:
+ return "COMMON$PAUSED";
+ case V1ExecutionStatus.ERROR:
+ case V1ExecutionStatus.STUCK:
+ return "COMMON$STOPPED";
+ default:
+ return "COMMON$STOPPED";
+ }
+};
+
+export function ConversationStatusDot({
+ executionStatus,
+}: ConversationStatusDotProps) {
+ const { t } = useTranslation("openhands");
+
+ const backgroundColor = useMemo(() => {
+ switch (executionStatus) {
+ case V1ExecutionStatus.RUNNING:
+ case V1ExecutionStatus.IDLE:
+ case V1ExecutionStatus.WAITING_FOR_CONFIRMATION:
+ case V1ExecutionStatus.FINISHED:
+ return "bg-[#1FBD53]";
+ case V1ExecutionStatus.PAUSED:
+ return "bg-[#A3A3A3]";
+ case V1ExecutionStatus.ERROR:
+ case V1ExecutionStatus.STUCK:
+ return "bg-[#A3A3A3]";
+ default:
+ return "bg-[#3C3C49]";
+ }
+ }, [executionStatus]);
+
+ const label = t(labelKeyFor(executionStatus));
+
+ return (
+ <StyledTooltip
+ content={label}
+ placement="right"
+ showArrow
+ tooltipClassName="bg-[#1a1a1a] text-white text-xs shadow-lg"
+ >
+ <div className={cn("w-1.5 h-1.5 rounded-full", backgroundColor)} />
+ </StyledTooltip>
+ );
+}
diff --git a/src/components/features/home/recent-conversations/recent-conversation.tsx b/src/components/features/home/recent-conversations/recent-conversation.tsx
index b8ea7e6cbd..6065ce0bd9 100644
--- a/src/components/features/home/recent-conversations/recent-conversation.tsx
+++ b/src/components/features/home/recent-conversations/recent-conversation.tsx
@@ -6,7 +6,7 @@ import { GitProviderIcon } from "#/components/shared/git-provider-icon";
import { Provider } from "#/types/settings";
import { formatTimeDelta } from "#/utils/format-time-delta";
import { I18nKey } from "#/i18n/declaration";
-import { SandboxStatusIndicator } from "./sandbox-status-indicator";
+import { ConversationStatusDot } from "./conversation-status-dot";
import RepoForkedIcon from "#/icons/repo-forked.svg?react";
import CircuitIcon from "#/icons/u-circuit.svg?react";
@@ -26,7 +26,9 @@ export function RecentConversation({ conversation }: RecentConversationProps) {
className="flex flex-col gap-1 p-[14px] cursor-pointer w-full rounded-lg hover:bg-[#5C5D62] transition-all duration-300 text-left"
>
<div className="flex items-center gap-2 pl-1">
- <SandboxStatusIndicator sandboxStatus={conversation.sandbox_status} />
+ <ConversationStatusDot
+ executionStatus={conversation.execution_status}
+ />
<span className="text-xs text-white leading-6 font-normal">
{conversation.title}
</span>
diff --git a/src/components/features/home/recent-conversations/sandbox-status-indicator.tsx b/src/components/features/home/recent-conversations/sandbox-status-indicator.tsx
deleted file mode 100644
index 8f0029ced5..0000000000
--- a/src/components/features/home/recent-conversations/sandbox-status-indicator.tsx
+++ /dev/null
@@ -1,61 +0,0 @@
-import { useMemo } from "react";
-import { useTranslation } from "react-i18next";
-import { V1SandboxStatus } from "#/api/sandbox-service/sandbox-service.types";
-import { cn } from "#/utils/utils";
-import { StyledTooltip } from "#/components/shared/buttons/styled-tooltip";
-
-interface SandboxStatusIndicatorProps {
- sandboxStatus: V1SandboxStatus;
-}
-
-// Map V1SandboxStatus to translation keys
-const getSandboxStatusLabel = (status: V1SandboxStatus): string => {
- switch (status) {
- case "RUNNING":
- return "COMMON$RUNNING";
- case "STARTING":
- return "COMMON$STARTING";
- case "PAUSED":
- return "COMMON$PAUSED";
- case "MISSING":
- return "COMMON$ARCHIVED";
- default:
- return "COMMON$STOPPED";
- }
-};
-
-export function SandboxStatusIndicator({
- sandboxStatus,
-}: SandboxStatusIndicatorProps) {
- const { t } = useTranslation("openhands");
-
- const sandboxStatusBackgroundColor = useMemo(() => {
- switch (sandboxStatus) {
- case "RUNNING":
- return "bg-[#1FBD53]"; // Running/online - green
- case "STARTING":
- return "bg-[#FFD43B]"; // Busy/starting - yellow
- case "PAUSED":
- return "bg-[#A3A3A3]"; // Paused - grey
- case "MISSING":
- return "bg-[#A3A3A3]"; // Missing - grey (archived)
- default:
- return "bg-[#3C3C49]"; // Default to grey for unknown states
- }
- }, [sandboxStatus]);
-
- const statusLabel = t(getSandboxStatusLabel(sandboxStatus));
-
- return (
- <StyledTooltip
- content={statusLabel}
- placement="right"
- showArrow
- tooltipClassName="bg-[#1a1a1a] text-white text-xs shadow-lg"
- >
- <div
- className={cn("w-1.5 h-1.5 rounded-full", sandboxStatusBackgroundColor)}
- />
- </StyledTooltip>
- );
-}
diff --git a/src/contexts/conversation-websocket-context.tsx b/src/contexts/conversation-websocket-context.tsx
index ad512502f4..b080ffcfe9 100644
--- a/src/contexts/conversation-websocket-context.tsx
+++ b/src/contexts/conversation-websocket-context.tsx
@@ -695,8 +695,6 @@ export function ConversationWebSocketProvider({
},
onClose: () => {
setMainConnectionState("CLOSED");
- // Recovery is handled by useSandboxRecovery on tab focus/page refresh
- // No error message needed - silent recovery provides better UX
},
onError: () => {
setMainConnectionState("CLOSED");
@@ -762,8 +760,6 @@ export function ConversationWebSocketProvider({
},
onClose: () => {
setPlanningConnectionState("CLOSED");
- // Recovery is handled by useSandboxRecovery on tab focus/page refresh
- // No error message needed - silent recovery provides better UX
},
onError: () => {
setPlanningConnectionState("CLOSED");
diff --git a/src/contexts/websocket-provider-wrapper.tsx b/src/contexts/websocket-provider-wrapper.tsx
index 039f2dbce4..f5458d4336 100644
--- a/src/contexts/websocket-provider-wrapper.tsx
+++ b/src/contexts/websocket-provider-wrapper.tsx
@@ -2,51 +2,25 @@ import React from "react";
import { ConversationWebSocketProvider } from "#/contexts/conversation-websocket-context";
import { useActiveConversation } from "#/hooks/query/use-active-conversation";
import { useSubConversations } from "#/hooks/query/use-sub-conversations";
-import { useSandboxRecovery } from "#/hooks/use-sandbox-recovery";
-import { isTaskConversationId } from "#/utils/conversation-local-storage";
interface WebSocketProviderWrapperProps {
children: React.ReactNode;
conversationId: string;
}
-/**
- * A wrapper component that conditionally renders either the old v0 WebSocket provider
- * or the new v1 WebSocket provider based on the version prop.
- *
- * @param conversationId - The conversation ID to pass to the provider
- * @param children - The child components to wrap
- */
export function WebSocketProviderWrapper({
children,
conversationId,
}: WebSocketProviderWrapperProps) {
- // Get conversation data for V1 provider
- const {
- data: conversation,
- refetch: refetchConversation,
- isFetched,
- } = useActiveConversation();
- // Get sub-conversation data for V1 provider
+ const { data: conversation } = useActiveConversation();
const { data: subConversations } = useSubConversations(
conversation?.sub_conversation_ids ?? [],
);
- // Filter out null sub-conversations
const filteredSubConversations = subConversations?.filter(
(subConversation) => subConversation !== null,
);
- const isConversationReady =
- !isTaskConversationId(conversationId) && isFetched && !!conversation;
- // Recovery for V1 conversations - handles page refresh and tab focus
- // Does NOT resume on WebSocket disconnect (server pauses after 20 min inactivity)
- useSandboxRecovery({
- conversationId,
- sandboxStatus: conversation?.sandbox_status,
- refetchConversation: isConversationReady ? refetchConversation : undefined,
- });
-
return (
<ConversationWebSocketProvider
conversationId={conversationId}
diff --git a/src/hooks/mutation/conversation-mutation-utils.test.ts b/src/hooks/mutation/conversation-mutation-utils.test.ts
index 5786f64cbd..cacd0d5c39 100644
--- a/src/hooks/mutation/conversation-mutation-utils.test.ts
+++ b/src/hooks/mutation/conversation-mutation-utils.test.ts
@@ -1,13 +1,12 @@
import { describe, expect, it } from "vitest";
import { QueryClient } from "@tanstack/react-query";
-import { updateConversationSandboxStatusInCache } from "./conversation-mutation-utils";
+import { updateConversationExecutionStatusInCache } from "./conversation-mutation-utils";
import { V1ExecutionStatus } from "#/types/v1/core/base/common";
import { V1AppConversation } from "#/api/conversation-service/v1-conversation-service.types";
const createConversation = (): V1AppConversation => ({
id: "conversation-1",
created_by_user_id: null,
- sandbox_id: "sandbox-1",
selected_repository: null,
selected_branch: null,
git_provider: null,
@@ -18,15 +17,14 @@ const createConversation = (): V1AppConversation => ({
metrics: null,
created_at: "2026-04-16T00:00:00Z",
updated_at: "2026-04-16T00:00:00Z",
- sandbox_status: "RUNNING",
- execution_status: V1ExecutionStatus.FINISHED,
+ execution_status: V1ExecutionStatus.RUNNING,
conversation_url: "http://localhost:3000/api/conversations/conversation-1",
session_api_key: "session-key",
sub_conversation_ids: [],
});
-describe("updateConversationSandboxStatusInCache", () => {
- it("updates the active conversation sandbox_status field", () => {
+describe("updateConversationExecutionStatusInCache", () => {
+ it("updates the active conversation execution_status field", () => {
const queryClient = new QueryClient();
const conversation = createConversation();
@@ -35,10 +33,10 @@ describe("updateConversationSandboxStatusInCache", () => {
conversation,
);
- updateConversationSandboxStatusInCache(
+ updateConversationExecutionStatusInCache(
queryClient,
conversation.id,
- "PAUSED",
+ V1ExecutionStatus.PAUSED,
);
expect(
@@ -48,31 +46,7 @@ describe("updateConversationSandboxStatusInCache", () => {
conversation.id,
]),
).toMatchObject({
- sandbox_status: "PAUSED",
- execution_status: null,
+ execution_status: V1ExecutionStatus.PAUSED,
});
});
-
- it("does not create a legacy status field on the active conversation cache", () => {
- const queryClient = new QueryClient();
- const conversation = createConversation();
-
- queryClient.setQueryData(
- ["user", "conversation", conversation.id],
- conversation,
- );
-
- updateConversationSandboxStatusInCache(
- queryClient,
- conversation.id,
- "STARTING",
- );
-
- const cachedConversation = queryClient.getQueryData<
- V1AppConversation & { status?: string }
- >(["user", "conversation", conversation.id]);
-
- expect(cachedConversation?.status).toBeUndefined();
- expect(cachedConversation?.sandbox_status).toBe("STARTING");
- });
});
diff --git a/src/hooks/mutation/conversation-mutation-utils.ts b/src/hooks/mutation/conversation-mutation-utils.ts
index 9173266322..2c074cebfd 100644
--- a/src/hooks/mutation/conversation-mutation-utils.ts
+++ b/src/hooks/mutation/conversation-mutation-utils.ts
@@ -1,16 +1,12 @@
import { QueryClient } from "@tanstack/react-query";
import V1ConversationService from "#/api/conversation-service/v1-conversation-service.api";
import { V1AppConversation } from "#/api/conversation-service/v1-conversation-service.types";
-import { SandboxService } from "#/api/sandbox-service/sandbox-service.api";
-import { V1SandboxStatus } from "#/api/sandbox-service/sandbox-service.types";
-/**
- * Fetches a V1 conversation's sandbox_id and conversation_url
- */
+type ExecutionStatusValue = V1AppConversation["execution_status"];
+
const fetchV1ConversationData = async (
conversationId: string,
): Promise<{
- sandboxId: string;
conversationUrl: string | null;
sessionApiKey: string | null;
}> => {
@@ -24,23 +20,11 @@ const fetchV1ConversationData = async (
}
return {
- sandboxId: appConversation.sandbox_id,
conversationUrl: appConversation.conversation_url,
sessionApiKey: appConversation.session_api_key,
};
};
-/**
- * Pause a V1 conversation sandbox by fetching the sandbox_id and pausing it
- */
-export const pauseV1ConversationSandbox = async (conversationId: string) => {
- const { sandboxId } = await fetchV1ConversationData(conversationId);
- return SandboxService.pauseSandbox(sandboxId);
-};
-
-/**
- * Pause a V1 conversation by fetching the conversation data and pausing it
- */
export const pauseV1Conversation = async (conversationId: string) => {
const { conversationUrl, sessionApiKey } =
await fetchV1ConversationData(conversationId);
@@ -68,17 +52,6 @@ export const askV1Agent = async (
);
};
-/**
- * Resumes a V1 conversation sandbox by fetching the sandbox_id and resuming it
- */
-export const resumeV1ConversationSandbox = async (conversationId: string) => {
- const { sandboxId } = await fetchV1ConversationData(conversationId);
- return SandboxService.resumeSandbox(sandboxId);
-};
-
-/**
- * Resume a V1 conversation by fetching the conversation data and resuming it
- */
export const resumeV1Conversation = async (conversationId: string) => {
const { conversationUrl, sessionApiKey } =
await fetchV1ConversationData(conversationId);
@@ -89,33 +62,22 @@ export const resumeV1Conversation = async (conversationId: string) => {
);
};
-/**
- * Optimistically updates the conversation status in the cache
- */
-export const updateConversationSandboxStatusInCache = (
+export const updateConversationExecutionStatusInCache = (
queryClient: QueryClient,
conversationId: string,
- sandbox_status: V1SandboxStatus,
+ execution_status: ExecutionStatusValue,
): void => {
- // Update the individual conversation cache
queryClient.setQueryData<V1AppConversation | null>(
["user", "conversation", conversationId],
(oldData) => {
if (!oldData) return oldData;
-
- return {
- ...oldData,
- sandbox_status,
- execution_status:
- sandbox_status === "RUNNING" ? oldData.execution_status : null,
- };
+ return { ...oldData, execution_status };
},
);
- // Update the conversations list cache
queryClient.setQueriesData<{
pages: Array<{
- items: Array<{ id: string; sandbox_status: string }>;
+ items: Array<{ id: string; execution_status: ExecutionStatusValue }>;
}>;
}>({ queryKey: ["user", "conversations"] }, (oldData) => {
if (!oldData) return oldData;
@@ -125,32 +87,23 @@ export const updateConversationSandboxStatusInCache = (
pages: oldData.pages.map((page) => ({
...page,
items: page.items.map((conv) =>
- conv.id === conversationId ? { ...conv, sandbox_status } : conv,
+ conv.id === conversationId ? { ...conv, execution_status } : conv,
),
})),
};
});
};
-/**
- * Invalidates all queries related to conversation mutations (start/stop)
- */
export const invalidateConversationQueries = (
queryClient: QueryClient,
conversationId: string,
): void => {
- // Invalidate the specific conversation query to trigger automatic refetch
queryClient.invalidateQueries({
queryKey: ["user", "conversation", conversationId],
});
- // Also invalidate the conversations list for consistency
queryClient.invalidateQueries({ queryKey: ["user", "conversations"] });
- // Invalidate V1 batch get queries
queryClient.invalidateQueries({
queryKey: ["v1-batch-get-app-conversations"],
});
- // Invalidate sandbox and VS Code URL caches to pick up new runtime URLs after resume
- // Uses partial key matching to invalidate all sandbox-related queries (batch, individual, etc.)
- queryClient.invalidateQueries({ queryKey: ["sandboxes"] });
queryClient.invalidateQueries({ queryKey: ["unified", "vscode_url"] });
};
diff --git a/src/hooks/mutation/use-create-conversation.ts b/src/hooks/mutation/use-create-conversation.ts
index c4d8839601..7e1e2edb50 100644
--- a/src/hooks/mutation/use-create-conversation.ts
+++ b/src/hooks/mutation/use-create-conversation.ts
@@ -37,26 +37,11 @@ export const useCreateConversation = () => {
mutationFn: async (
variables: CreateConversationVariables,
): Promise<CreateConversationResponse> => {
- const {
- query,
- repository,
- suggestedTask,
- conversationInstructions,
- parentConversationId,
- agentType,
- plugins,
- } = variables;
+ const { query, conversationInstructions, plugins } = variables;
const conversation = await V1ConversationService.createConversation(
- repository?.name,
- repository?.gitProvider,
query,
- repository?.branch,
conversationInstructions,
- suggestedTask,
- undefined,
- parentConversationId,
- agentType,
plugins,
);
diff --git a/src/hooks/mutation/use-new-conversation-command.ts b/src/hooks/mutation/use-new-conversation-command.ts
index 2188c7b965..3f1ebc230b 100644
--- a/src/hooks/mutation/use-new-conversation-command.ts
+++ b/src/hooks/mutation/use-new-conversation-command.ts
@@ -19,61 +19,20 @@ export const useNewConversationCommand = () => {
const mutation = useMutation({
mutationFn: async () => {
- if (!conversation?.id || !conversation.sandbox_id) {
- throw new Error("No active conversation or sandbox");
+ if (!conversation?.id) {
+ throw new Error("No active conversation");
}
- // Fetch V1 conversation data to get llm_model (not available in legacy type)
- const v1Conversations =
- await V1ConversationService.batchGetAppConversations([conversation.id]);
- const llmModel = v1Conversations?.[0]?.llm_model;
+ const startTask = await V1ConversationService.createConversation();
- // Start a new conversation reusing the existing sandbox directly.
- // We pass sandbox_id instead of parent_conversation_id so that the
- // new conversation is NOT marked as a sub-conversation and will
- // appear in the conversation list.
- const startTask = await V1ConversationService.createConversation(
- conversation.selected_repository ?? undefined, // selectedRepository
- conversation.git_provider ?? undefined, // git_provider
- undefined, // initialUserMsg
- conversation.selected_branch ?? undefined, // selected_branch
- undefined, // conversationInstructions
- undefined, // suggestedTask
- undefined, // trigger
- undefined, // parent_conversation_id
- undefined, // agent_type
- undefined, // plugins
- conversation.sandbox_id ?? undefined, // sandbox_id - reuse the same sandbox
- llmModel ?? undefined, // llm_model - preserve the LLM model
- );
-
- // Poll for the task to complete and get the new conversation ID
- let task = await V1ConversationService.getStartTask(startTask.id);
- const maxAttempts = 60; // 60 seconds timeout
- let attempts = 0;
-
- /* eslint-disable no-await-in-loop */
- while (
- task &&
- !["READY", "ERROR"].includes(task.status) &&
- attempts < maxAttempts
- ) {
- // eslint-disable-next-line no-await-in-loop
- await new Promise((resolve) => {
- setTimeout(resolve, 1000);
- });
- task = await V1ConversationService.getStartTask(startTask.id);
- attempts += 1;
- }
-
- if (!task || task.status !== "READY" || !task.app_conversation_id) {
+ if (!startTask.app_conversation_id) {
throw new Error(
- task?.detail || "Failed to create new conversation in sandbox",
+ startTask.detail || "Failed to create new conversation",
);
}
return {
- newConversationId: task.app_conversation_id,
+ newConversationId: startTask.app_conversation_id,
oldConversationId: conversation.id,
};
},
@@ -88,7 +47,6 @@ export const useNewConversationCommand = () => {
displaySuccessToast(t(I18nKey.CONVERSATION$CLEAR_SUCCESS));
navigate(`/conversations/${data.newConversationId}`);
- // Refresh the sidebar to show the new conversation.
queryClient.invalidateQueries({
queryKey: ["user", "conversations"],
});
diff --git a/src/hooks/mutation/use-unified-start-conversation.ts b/src/hooks/mutation/use-unified-start-conversation.ts
index 9bf2839665..04892a3d37 100644
--- a/src/hooks/mutation/use-unified-start-conversation.ts
+++ b/src/hooks/mutation/use-unified-start-conversation.ts
@@ -1,24 +1,14 @@
import { useMutation, useQueryClient } from "@tanstack/react-query";
import { Provider } from "#/types/settings";
import { useErrorMessageStore } from "#/stores/error-message-store";
+import { V1ExecutionStatus } from "#/types/v1/core";
import {
- resumeV1ConversationSandbox,
- updateConversationSandboxStatusInCache,
+ resumeV1Conversation,
+ updateConversationExecutionStatusInCache,
invalidateConversationQueries,
} from "./conversation-mutation-utils";
-/**
- * Unified hook that automatically routes to the correct resume conversation sandbox implementation
- * based on the conversation version (V0 or V1).
- *
- * This hook checks the cached conversation data to determine the version, then calls
- * the appropriate API directly. Returns a single useMutation instance that all components share.
- *
- * Usage is the same as useStartConversation:
- * const { mutate: startConversation } = useUnifiedResumeConversationSandbox();
- * startConversation({ conversationId: "some-id", providers: [...] });
- */
-export const useUnifiedResumeConversationSandbox = () => {
+export const useUnifiedResumeConversation = () => {
const queryClient = useQueryClient();
const removeErrorMessage = useErrorMessageStore(
(state) => state.removeErrorMessage,
@@ -29,7 +19,7 @@ export const useUnifiedResumeConversationSandbox = () => {
mutationFn: async (variables: {
conversationId: string;
providers?: Provider[];
- }) => resumeV1ConversationSandbox(variables.conversationId),
+ }) => resumeV1Conversation(variables.conversationId),
onMutate: async () => {
await queryClient.cancelQueries({ queryKey: ["user", "conversations"] });
const previousConversations = queryClient.getQueryData([
@@ -51,13 +41,12 @@ export const useUnifiedResumeConversationSandbox = () => {
invalidateConversationQueries(queryClient, variables.conversationId);
},
onSuccess: (_, variables) => {
- // Clear error messages when starting/resuming conversation
removeErrorMessage();
- updateConversationSandboxStatusInCache(
+ updateConversationExecutionStatusInCache(
queryClient,
variables.conversationId,
- "STARTING",
+ V1ExecutionStatus.RUNNING,
);
},
});
diff --git a/src/hooks/mutation/use-unified-stop-conversation.ts b/src/hooks/mutation/use-unified-stop-conversation.ts
index 9184d5d6f5..49d34c95ef 100644
--- a/src/hooks/mutation/use-unified-stop-conversation.ts
+++ b/src/hooks/mutation/use-unified-stop-conversation.ts
@@ -4,19 +4,13 @@ import { useTranslation } from "react-i18next";
import { TOAST_OPTIONS } from "#/utils/custom-toast-handlers";
import { useNavigation } from "#/context/navigation-context";
import { I18nKey } from "#/i18n/declaration";
+import { V1ExecutionStatus } from "#/types/v1/core";
import {
- pauseV1ConversationSandbox,
- updateConversationSandboxStatusInCache,
+ pauseV1Conversation,
+ updateConversationExecutionStatusInCache,
} from "./conversation-mutation-utils";
-/**
- * Hook to pause a conversation sandbox.
- *
- * Usage:
- * const { mutate: stopConversation } = useUnifiedPauseConversationSandbox();
- * stopConversation({ conversationId: "some-id" });
- */
-export const useUnifiedPauseConversationSandbox = () => {
+export const useUnifiedPauseConversation = () => {
const { t } = useTranslation("openhands");
const queryClient = useQueryClient();
const { conversationId: currentConversationId, navigate } = useNavigation();
@@ -24,7 +18,7 @@ export const useUnifiedPauseConversationSandbox = () => {
return useMutation({
mutationKey: ["stop-conversation"],
mutationFn: async (variables: { conversationId: string }) =>
- pauseV1ConversationSandbox(variables.conversationId),
+ pauseV1Conversation(variables.conversationId),
onMutate: async () => {
const toastId = toast.loading(
t(I18nKey.TOAST$STOPPING_CONVERSATION),
@@ -58,13 +52,12 @@ export const useUnifiedPauseConversationSandbox = () => {
}
toast.success(t(I18nKey.TOAST$CONVERSATION_STOPPED), TOAST_OPTIONS);
- updateConversationSandboxStatusInCache(
+ updateConversationExecutionStatusInCache(
queryClient,
variables.conversationId,
- "PAUSED",
+ V1ExecutionStatus.PAUSED,
);
- // Only redirect if we're stopping the conversation we're currently viewing
if (currentConversationId === variables.conversationId) {
navigate("/");
}
diff --git a/src/hooks/mutation/use-v1-resume-conversation.ts b/src/hooks/mutation/use-v1-resume-conversation.ts
index b606b463c8..8520ff5d82 100644
--- a/src/hooks/mutation/use-v1-resume-conversation.ts
+++ b/src/hooks/mutation/use-v1-resume-conversation.ts
@@ -25,19 +25,13 @@ export const useV1ResumeConversation = () => {
}
},
onSettled: (_, __, variables) => {
- // Invalidate the specific conversation query to trigger automatic refetch
queryClient.invalidateQueries({
queryKey: ["user", "conversation", variables.conversationId],
});
- // Also invalidate the conversations list for consistency
queryClient.invalidateQueries({ queryKey: ["user", "conversations"] });
- // Invalidate V1 batch get queries
queryClient.invalidateQueries({
queryKey: ["v1-batch-get-app-conversations"],
});
- // Invalidate sandbox data so new runtime URLs are picked up after resume
- queryClient.invalidateQueries({ queryKey: ["sandboxes"] });
- // Invalidate VS Code URL cache so it refetches with the new sandbox data
queryClient.invalidateQueries({ queryKey: ["unified", "vscode_url"] });
},
});
diff --git a/src/hooks/query/use-active-conversation.ts b/src/hooks/query/use-active-conversation.ts
index 4fe90c175e..ab4e6de409 100644
--- a/src/hooks/query/use-active-conversation.ts
+++ b/src/hooks/query/use-active-conversation.ts
@@ -6,21 +6,13 @@ import ConversationService from "#/api/conversation-service/conversation-service
export const useActiveConversation = () => {
const { conversationId } = useConversationId();
- // Don't poll if this is a task ID (format: "task-{uuid}")
// Task polling is handled by useTaskPolling hook
const isTaskId = conversationId.startsWith("task-");
const actualConversationId = isTaskId ? null : conversationId;
const userConversation = useUserConversation(
actualConversationId,
- (query) => {
- if (query.state.data?.sandbox_status === "STARTING") {
- return 3000; // 3 seconds
- }
- // TODO: Return conversation title as a WS event to avoid polling
- // This was changed from 5 minutes to 30 seconds to poll for updated conversation title after an auto update
- return 30000; // 30 seconds
- },
+ () => 30000,
);
useEffect(() => {
@@ -29,7 +21,7 @@ export const useActiveConversation = () => {
}, [
conversationId,
userConversation.isFetched,
- userConversation?.data?.sandbox_status,
+ userConversation?.data?.execution_status,
]);
return userConversation;
};
diff --git a/src/hooks/query/use-batch-sandboxes.ts b/src/hooks/query/use-batch-sandboxes.ts
deleted file mode 100644
index 8310ee3aad..0000000000
--- a/src/hooks/query/use-batch-sandboxes.ts
+++ /dev/null
@@ -1,11 +0,0 @@
-import { useQuery } from "@tanstack/react-query";
-import { SandboxService } from "#/api/sandbox-service/sandbox-service.api";
-
-export const useBatchSandboxes = (ids: string[]) =>
- useQuery({
- queryKey: ["sandboxes", "batch", ids],
- queryFn: () => SandboxService.batchGetSandboxes(ids),
- enabled: ids.length > 0,
- staleTime: 1000 * 60 * 5, // 5 minutes
- gcTime: 1000 * 60 * 15, // 15 minutes
- });
diff --git a/src/hooks/query/use-sandbox-metrics.ts b/src/hooks/query/use-conversation-metrics.ts
similarity index 64%
rename from src/hooks/query/use-sandbox-metrics.ts
rename to src/hooks/query/use-conversation-metrics.ts
index 56053f0c33..6000ddc9bc 100644
--- a/src/hooks/query/use-sandbox-metrics.ts
+++ b/src/hooks/query/use-conversation-metrics.ts
@@ -3,14 +3,7 @@ import V1ConversationService from "#/api/conversation-service/v1-conversation-se
import { getCombinedMetrics } from "#/utils/conversation-metrics";
import type { V1MetricsSnapshot } from "#/api/conversation-service/v1-conversation-service.types";
-/**
- * Hook to fetch metrics directly from the sandbox for V1 conversations
- * @param conversationId The conversation ID
- * @param conversationUrl The conversation URL from the active conversation
- * @param sessionApiKey The session API key from the active conversation
- * @param enabled Whether the query should be enabled (typically when modal is open and conversation is V1)
- */
-export const useSandboxMetrics = (
+export const useConversationMetrics = (
conversationId: string | null | undefined,
conversationUrl: string | null | undefined,
sessionApiKey: string | null | undefined,
@@ -22,7 +15,7 @@ export const useSandboxMetrics = (
} => {
const query = useQuery({
queryKey: [
- "sandbox-metrics",
+ "conversation-metrics",
conversationId,
conversationUrl,
sessionApiKey,
@@ -39,10 +32,10 @@ export const useSandboxMetrics = (
},
enabled:
enabled && !!conversationId && !!conversationUrl && !!sessionApiKey,
- staleTime: 1000 * 30, // 30 seconds
- gcTime: 1000 * 60 * 5, // 5 minutes
- refetchInterval: 1000 * 30, // Refetch every 30 seconds
- retry: false, // Don't retry on failure since this is a new endpoint
+ staleTime: 1000 * 30,
+ gcTime: 1000 * 60 * 5,
+ refetchInterval: 1000 * 30,
+ retry: false,
});
return {
diff --git a/src/hooks/query/use-conversations-in-sandbox.ts b/src/hooks/query/use-conversations-in-sandbox.ts
deleted file mode 100644
index f41edb7a54..0000000000
--- a/src/hooks/query/use-conversations-in-sandbox.ts
+++ /dev/null
@@ -1,15 +0,0 @@
-import { useQuery } from "@tanstack/react-query";
-import V1ConversationService from "#/api/conversation-service/v1-conversation-service.api";
-
-export const useConversationsInSandbox = (sandboxId: string | null) =>
- useQuery({
- queryKey: ["conversations", "sandbox", sandboxId],
- queryFn: () =>
- sandboxId
- ? V1ConversationService.searchConversationsBySandboxId(sandboxId)
- : Promise.resolve([]),
- enabled: !!sandboxId,
- staleTime: 0, // Always consider data stale for confirmation dialogs
- gcTime: 1000 * 60, // 1 minute
- refetchOnMount: true, // Always fetch fresh data when modal opens
- });
diff --git a/src/hooks/query/use-settings.ts b/src/hooks/query/use-settings.ts
index b9b8033a1a..d669743b26 100644
--- a/src/hooks/query/use-settings.ts
+++ b/src/hooks/query/use-settings.ts
@@ -111,9 +111,6 @@ const normalizeSettingsResponse = (settings: Partial<Settings>): Settings => {
settings.conversation_settings_schema ??
DEFAULT_SETTINGS.conversation_settings_schema,
conversation_settings: conversationSettings,
- sandbox_grouping_strategy:
- settings.sandbox_grouping_strategy ??
- DEFAULT_SETTINGS.sandbox_grouping_strategy,
};
};
diff --git a/src/hooks/query/use-start-tasks.ts b/src/hooks/query/use-start-tasks.ts
index 3fb1e8d47d..b9b6d8fb66 100644
--- a/src/hooks/query/use-start-tasks.ts
+++ b/src/hooks/query/use-start-tasks.ts
@@ -2,17 +2,6 @@ import { useQuery } from "@tanstack/react-query";
import V1ConversationService from "#/api/conversation-service/v1-conversation-service.api";
import { useSettings } from "#/hooks/query/use-settings";
-/**
- * Hook to fetch in-progress V1 conversation start tasks
- *
- * Use case: Show tasks that are provisioning sandboxes, cloning repos, etc.
- * These are conversations that started but haven't reached READY or ERROR status yet.
- *
- * Note: Filters out READY and ERROR status tasks client-side since backend doesn't support status filtering.
- *
- * @param limit Maximum number of tasks to return (max 100)
- * @returns Query result with array of in-progress start tasks
- */
export const useStartTasks = (limit = 10) => {
const { data: settings } = useSettings();
const isV1Enabled = settings?.v1_enabled;
diff --git a/src/hooks/query/use-unified-active-host.ts b/src/hooks/query/use-unified-active-host.ts
index 000f66e1b9..6dd72a4fdc 100644
--- a/src/hooks/query/use-unified-active-host.ts
+++ b/src/hooks/query/use-unified-active-host.ts
@@ -4,49 +4,24 @@ import React from "react";
import { useConversationId } from "#/hooks/use-conversation-id";
import { useRuntimeIsReady } from "#/hooks/use-runtime-is-ready";
import { useActiveConversation } from "#/hooks/query/use-active-conversation";
-import { useBatchSandboxes } from "./use-batch-sandboxes";
+import { getConfiguredWorkerUrls } from "#/api/agent-server-config";
-/**
- * Unified hook to get active web host for both legacy (V0) and V1 conversations
- * - V0: Uses the legacy getWebHosts API endpoint and polls them
- * - V1: Gets worker URLs from sandbox exposed_urls (WORKER_1, WORKER_2, etc.)
- */
export const useUnifiedActiveHost = () => {
const [activeHost, setActiveHost] = React.useState<string | null>(null);
const { conversationId } = useConversationId();
const runtimeIsReady = useRuntimeIsReady();
- const { data: conversation, isLoading: isLoadingConversation } =
- useActiveConversation();
- const sandboxId = conversation?.sandbox_id;
+ const { isLoading: isLoadingConversation } = useActiveConversation();
- // Fetch sandbox data for V1 conversations
- const sandboxesQuery = useBatchSandboxes(sandboxId ? [sandboxId] : []);
- const sandbox = sandboxesQuery?.data?.[0];
-
- // Get worker URLs from V1 sandbox or legacy web hosts from V0
const { data, isLoading: hostsQueryLoading } = useQuery({
- queryKey: [conversationId, "hosts", sandbox],
- queryFn: async () => {
- // V1: Get worker URLs from sandbox exposed_urls
- if (!sandbox) {
- return { hosts: [] };
- }
-
- const workerUrls =
- sandbox.exposed_urls
- ?.filter((url) => url.name.startsWith("WORKER_"))
- .map((url) => url.url) || [];
-
- return { hosts: workerUrls };
- },
- enabled: runtimeIsReady && !!conversationId && !!sandboxesQuery.data,
+ queryKey: [conversationId, "hosts"],
+ queryFn: async () => ({ hosts: getConfiguredWorkerUrls() }),
+ enabled: runtimeIsReady && !!conversationId,
initialData: { hosts: [] },
meta: {
disableToast: true,
},
});
- // Poll all hosts to find which one is active
const apps = useQueries({
queries: data.hosts.map((host) => ({
queryKey: [conversationId, "unified", "hosts", host],
@@ -72,9 +47,7 @@ export const useUnifiedActiveHost = () => {
setActiveHost(successfulApp || "");
}, [appsData]);
- // Calculate overall loading state including dependent queries for V1
- const isLoading =
- isLoadingConversation || sandboxesQuery.isLoading || hostsQueryLoading;
+ const isLoading = isLoadingConversation || hostsQueryLoading;
return { activeHost, isLoading };
};
diff --git a/src/hooks/query/use-unified-get-git-changes.ts b/src/hooks/query/use-unified-get-git-changes.ts
index 9acfe81b00..8e5ecce971 100644
--- a/src/hooks/query/use-unified-get-git-changes.ts
+++ b/src/hooks/query/use-unified-get-git-changes.ts
@@ -4,19 +4,12 @@ import V1GitService from "#/api/git-service/v1-git-service.api";
import { useConversationId } from "#/hooks/use-conversation-id";
import { useActiveConversation } from "#/hooks/query/use-active-conversation";
import { useRuntimeIsReady } from "#/hooks/use-runtime-is-ready";
-import { useSettings } from "#/hooks/query/use-settings";
import { getGitPath } from "#/utils/get-git-path";
import type { GitChange } from "#/api/open-hands.types";
-/**
- * Unified hook to get git changes for both legacy (V0) and V1 conversations
- * - V0: Uses the legacy GitService.getGitChanges API endpoint
- * - V1: Uses the V1GitService.getGitChanges API endpoint with runtime URL
- */
export const useUnifiedGetGitChanges = () => {
const { conversationId } = useConversationId();
const { data: conversation } = useActiveConversation();
- const { data: settings } = useSettings();
const [orderedChanges, setOrderedChanges] = React.useState<GitChange[]>([]);
const previousDataRef = React.useRef<GitChange[] | null>(null);
const runtimeIsReady = useRuntimeIsReady();
@@ -26,20 +19,9 @@ export const useUnifiedGetGitChanges = () => {
const selectedRepository = conversation?.selected_repository;
const workingDir = conversation?.workspace?.working_dir?.trim();
- // Sandbox grouping is enabled when strategy is not NO_GROUPING
- const useSandboxGrouping =
- settings?.sandbox_grouping_strategy !== "NO_GROUPING" &&
- settings?.sandbox_grouping_strategy !== undefined;
-
const gitPath = React.useMemo(
- () =>
- getGitPath(
- conversationId,
- selectedRepository,
- useSandboxGrouping,
- workingDir,
- ),
- [conversationId, selectedRepository, useSandboxGrouping, workingDir],
+ () => getGitPath(selectedRepository, workingDir),
+ [selectedRepository, workingDir],
);
const result = useQuery({
@@ -62,7 +44,7 @@ export const useUnifiedGetGitChanges = () => {
retry: false,
staleTime: 1000 * 60 * 5, // 5 minutes
gcTime: 1000 * 60 * 15, // 15 minutes
- refetchOnMount: "always", // Always refetch when mounting (e.g. navigating between conversations that share a sandbox)
+ refetchOnMount: "always",
enabled: runtimeIsReady && !!conversationId,
meta: {
disableToast: true,
diff --git a/src/hooks/query/use-unified-git-diff.ts b/src/hooks/query/use-unified-git-diff.ts
index cd35b191fe..affc19c336 100644
--- a/src/hooks/query/use-unified-git-diff.ts
+++ b/src/hooks/query/use-unified-git-diff.ts
@@ -3,7 +3,6 @@ import { useQuery } from "@tanstack/react-query";
import V1GitService from "#/api/git-service/v1-git-service.api";
import { useConversationId } from "#/hooks/use-conversation-id";
import { useActiveConversation } from "#/hooks/query/use-active-conversation";
-import { useSettings } from "#/hooks/query/use-settings";
import { getGitPath } from "#/utils/get-git-path";
import { GitChangeStatus } from "#/api/open-hands.types";
@@ -13,41 +12,19 @@ type UseUnifiedGitDiffConfig = {
enabled: boolean;
};
-/**
- * Unified hook to get git diff for both legacy (V0) and V1 conversations
- * - V0: Uses the legacy GitService.getGitChangeDiff API endpoint
- * - V1: Uses the V1GitService.getGitChangeDiff API endpoint with runtime URL
- */
export const useUnifiedGitDiff = (config: UseUnifiedGitDiffConfig) => {
const { conversationId } = useConversationId();
const { data: conversation } = useActiveConversation();
- const { data: settings } = useSettings();
const conversationUrl = conversation?.conversation_url;
const sessionApiKey = conversation?.session_api_key;
const selectedRepository = conversation?.selected_repository;
const workingDir = conversation?.workspace?.working_dir?.trim();
- // Sandbox grouping is enabled when strategy is not NO_GROUPING
- const useSandboxGrouping =
- settings?.sandbox_grouping_strategy !== "NO_GROUPING" &&
- settings?.sandbox_grouping_strategy !== undefined;
-
const absoluteFilePath = React.useMemo(() => {
- const gitPath = getGitPath(
- conversationId,
- selectedRepository,
- useSandboxGrouping,
- workingDir,
- );
+ const gitPath = getGitPath(selectedRepository, workingDir);
return `${gitPath}/${config.filePath}`;
- }, [
- conversationId,
- selectedRepository,
- useSandboxGrouping,
- config.filePath,
- workingDir,
- ]);
+ }, [selectedRepository, config.filePath, workingDir]);
return useQuery({
queryKey: [
diff --git a/src/hooks/query/use-unified-vscode-url.ts b/src/hooks/query/use-unified-vscode-url.ts
index 0eb6a8f81d..d605ff016c 100644
--- a/src/hooks/query/use-unified-vscode-url.ts
+++ b/src/hooks/query/use-unified-vscode-url.ts
@@ -12,13 +12,6 @@ interface VSCodeUrlResult {
error: string | null;
}
-/**
- * Unified hook to get a VSCode URL.
- *
- * In direct agent_server mode we ask `/api/vscode/url` directly instead of
- * relying on sandbox `exposed_urls`, because newer agent_server-compatible
- * clients expose VSCode as a dedicated API.
- */
export const useUnifiedVSCodeUrl = () => {
const { t } = useTranslation("openhands");
const { conversationId } = useConversationId();
diff --git a/src/hooks/use-conversation-name-context-menu.ts b/src/hooks/use-conversation-name-context-menu.ts
index 6af151050a..bc39d38d1b 100644
--- a/src/hooks/use-conversation-name-context-menu.ts
+++ b/src/hooks/use-conversation-name-context-menu.ts
@@ -2,7 +2,7 @@ import React from "react";
import { useNavigation } from "#/context/navigation-context";
import useMetricsStore from "#/stores/metrics-store";
import { useDeleteConversation } from "./mutation/use-delete-conversation";
-import { useUnifiedPauseConversationSandbox } from "./mutation/use-unified-stop-conversation";
+import { useUnifiedPauseConversation } from "./mutation/use-unified-stop-conversation";
import { useEventStore } from "#/stores/use-event-store";
import { useDownloadConversation } from "./use-download-conversation";
@@ -10,25 +10,26 @@ import {
adaptSystemMessage,
SystemMessageForModal,
} from "#/utils/system-message-adapter";
-import { V1SandboxStatus } from "#/api/sandbox-service/sandbox-service.types";
+import { V1ExecutionStatus } from "#/types/v1/core/base/common";
+import { isExecutionActive } from "#/utils/status";
interface UseConversationNameContextMenuProps {
conversationId?: string;
- sandboxStatus?: V1SandboxStatus;
+ executionStatus?: V1ExecutionStatus | null;
showOptions?: boolean;
onContextMenuToggle?: (isOpen: boolean) => void;
}
export function useConversationNameContextMenu({
conversationId,
- sandboxStatus = "MISSING",
+ executionStatus,
showOptions = false,
onContextMenuToggle,
}: UseConversationNameContextMenuProps) {
const { conversationId: currentConversationId, navigate } = useNavigation();
const events = useEventStore((state) => state.events);
const { mutate: deleteConversation } = useDeleteConversation();
- const { mutate: stopConversation } = useUnifiedPauseConversationSandbox();
+ const { mutate: stopConversation } = useUnifiedPauseConversation();
const metrics = useMetricsStore();
const [metricsModalVisible, setMetricsModalVisible] = React.useState(false);
@@ -154,14 +155,13 @@ export function useConversationNameContextMenu({
metrics,
systemMessage,
- // Computed values for conditional rendering
- shouldShowStop: sandboxStatus !== "MISSING",
+ shouldShowStop: isExecutionActive(executionStatus),
shouldShowDownloadConversation: Boolean(conversationId && showOptions),
shouldShowDisplayCost: showOptions,
shouldShowAgentTools: Boolean(showOptions && systemMessage),
shouldShowSkills: Boolean(showOptions && conversationId),
shouldShowHooks: Boolean(
- showOptions && conversationId && sandboxStatus === "RUNNING",
+ showOptions && conversationId && isExecutionActive(executionStatus),
),
};
}
diff --git a/src/hooks/use-runtime-is-ready.ts b/src/hooks/use-runtime-is-ready.ts
index 615e19455e..d6bfbde658 100644
--- a/src/hooks/use-runtime-is-ready.ts
+++ b/src/hooks/use-runtime-is-ready.ts
@@ -4,16 +4,12 @@ import {
RUNTIME_STARTING_STATES,
} from "#/types/agent-state";
import { useActiveConversation } from "./query/use-active-conversation";
+import { isExecutionActive } from "#/utils/status";
interface UseRuntimeIsReadyOptions {
allowAgentError?: boolean;
}
-/**
- * Hook to determine if the runtime is ready for operations
- *
- * @returns boolean indicating if the runtime is ready
- */
export const useRuntimeIsReady = ({
allowAgentError = false,
}: UseRuntimeIsReadyOptions = {}): boolean => {
@@ -24,7 +20,7 @@ export const useRuntimeIsReady = ({
: RUNTIME_INACTIVE_STATES;
return (
- conversation?.sandbox_status === "RUNNING" &&
+ isExecutionActive(conversation?.execution_status) &&
!inactiveStates.includes(curAgentState)
);
};
diff --git a/src/hooks/use-sandbox-recovery.ts b/src/hooks/use-sandbox-recovery.ts
deleted file mode 100644
index df621ebda9..0000000000
--- a/src/hooks/use-sandbox-recovery.ts
+++ /dev/null
@@ -1,133 +0,0 @@
-import React from "react";
-import { useTranslation } from "react-i18next";
-import { useUnifiedResumeConversationSandbox } from "./mutation/use-unified-start-conversation";
-import { useUserProviders } from "./use-user-providers";
-import { useVisibilityChange } from "./use-visibility-change";
-import { displayErrorToast } from "#/utils/custom-toast-handlers";
-import { I18nKey } from "#/i18n/declaration";
-import { V1SandboxStatus } from "#/api/sandbox-service/sandbox-service.types";
-import { V1AppConversation } from "#/api/conversation-service/v1-conversation-service.types";
-
-interface UseSandboxRecoveryOptions {
- conversationId: string | undefined;
- sandboxStatus: V1SandboxStatus | undefined;
- /** Function to refetch the conversation data - used to get fresh status on tab focus */
- refetchConversation?: () => Promise<{
- data: V1AppConversation | null | undefined;
- }>;
- onSuccess?: () => void;
- onError?: (error: Error) => void;
-}
-
-/**
- * Hook that handles sandbox recovery based on user intent.
- *
- * Recovery triggers:
- * - Page refresh: Resumes the sandbox on initial load if it was paused/stopped
- * - Tab gains focus: Resumes the sandbox if it was paused/stopped
- *
- * What does NOT trigger recovery:
- * - WebSocket disconnect: Does NOT automatically resume the sandbox
- * (The server pauses sandboxes after 20 minutes of inactivity,
- * and sandboxes should only be resumed when the user explicitly shows intent)
- *
- * @param options.conversationId - The conversation ID to recover
- * @param options.conversationStatus - The current conversation status
- * @param options.refetchConversation - Function to refetch conversation data on tab focus
- * @param options.onSuccess - Callback when recovery succeeds
- * @param options.onError - Callback when recovery fails
- * @returns isResuming - Whether a recovery is in progress
- */
-export function useSandboxRecovery({
- conversationId,
- sandboxStatus,
- refetchConversation,
- onSuccess,
- onError,
-}: UseSandboxRecoveryOptions) {
- const { t } = useTranslation("openhands");
- const { providers } = useUserProviders();
- const { mutate: resumeSandbox, isPending: isResuming } =
- useUnifiedResumeConversationSandbox();
-
- // Track which conversation ID we've already processed for initial load recovery
- const processedConversationIdRef = React.useRef<string | null>(null);
-
- const attemptRecovery = React.useCallback(
- (statusOverride?: V1SandboxStatus) => {
- const status = statusOverride ?? sandboxStatus;
- /**
- * Only recover if sandbox is paused
- */
- if (!conversationId || status !== "PAUSED" || isResuming) {
- return;
- }
- resumeSandbox(
- { conversationId, providers },
- {
- onSuccess: () => {
- onSuccess?.();
- },
- onError: (error) => {
- displayErrorToast(
- t(I18nKey.CONVERSATION$FAILED_TO_START_WITH_ERROR, {
- error: error.message,
- }),
- );
- onError?.(error);
- },
- },
- );
- },
- [
- conversationId,
- sandboxStatus,
- isResuming,
- providers,
- resumeSandbox,
- onSuccess,
- onError,
- t,
- ],
- );
-
- // Handle page refresh (initial load) and conversation navigation
- React.useEffect(() => {
- if (!conversationId || !sandboxStatus) return;
-
- // Only attempt recovery once per conversation (handles both initial load and navigation)
- if (processedConversationIdRef.current === conversationId) return;
-
- processedConversationIdRef.current = conversationId;
-
- if (sandboxStatus === "PAUSED") {
- attemptRecovery();
- }
- // eslint-disable-next-line react-hooks/exhaustive-deps
- }, [conversationId, sandboxStatus]);
-
- const handleVisible = React.useCallback(async () => {
- // Skip if no conversation or refetch function
- if (!conversationId || !refetchConversation) return;
-
- try {
- // Refetch to get fresh status - cached status may be stale if sandbox was paused while tab was inactive
- const { data } = await refetchConversation();
- attemptRecovery(data?.sandbox_status);
- } catch (error) {
- // eslint-disable-next-line no-console
- console.error(
- "Failed to refetch conversation on visibility change:",
- error,
- );
- }
- }, [conversationId, refetchConversation, isResuming, attemptRecovery]);
-
- // Handle tab focus (visibility change) - refetch conversation status and resume if needed
- useVisibilityChange({
- enabled: !!conversationId,
- onVisible: handleVisible,
- });
-
- return { isResuming };
-}
diff --git a/src/i18n/translation.json b/src/i18n/translation.json
index 8d078de06e..55739a8faf 100644
--- a/src/i18n/translation.json
+++ b/src/i18n/translation.json
@@ -6391,108 +6391,6 @@
"uk": "Увімкнути аналіз розв'язності",
"ca": "Activa l'anàlisi de resolubilitat"
},
- "SETTINGS$SANDBOX_GROUPING_STRATEGY": {
- "en": "Sandbox Grouping Strategy",
- "ja": "サンドボックスグループ化戦略",
- "zh-CN": "沙盒分组策略",
- "zh-TW": "沙盒分組策略",
- "ko-KR": "샌드박스 그룹화 전략",
- "de": "Sandbox-Gruppierungsstrategie",
- "no": "Sandkasse-grupperingsstrategi",
- "it": "Strategia di raggruppamento sandbox",
- "pt": "Estratégia de agrupamento de sandbox",
- "es": "Estrategia de agrupación de sandbox",
- "ar": "استراتيجية تجميع صندوق الرمل",
- "fr": "Stratégie de regroupement sandbox",
- "tr": "Sandbox Gruplama Stratejisi",
- "uk": "Стратегія групування пісочниці",
- "ca": "Estratègia d'agrupació de sandbox"
- },
- "SETTINGS$SANDBOX_GROUPING_NO_GROUPING": {
- "en": "No Grouping (new sandbox per conversation)",
- "ja": "グループ化なし (会話ごとに新しいサンドボックス)",
- "zh-CN": "不分组 (每个对话使用新沙盒)",
- "zh-TW": "不分組 (每個對話使用新沙盒)",
- "ko-KR": "그룹화 없음 (대화마다 새 샌드박스)",
- "de": "Keine Gruppierung (neue Sandbox pro Gespräch)",
- "no": "Ingen gruppering (ny sandkasse per samtale)",
- "it": "Nessun raggruppamento (nuova sandbox per conversazione)",
- "pt": "Sem agrupamento (novo sandbox por conversa)",
- "es": "Sin agrupación (nuevo sandbox por conversación)",
- "ar": "بدون تجميع (صندوق رمل جديد لكل محادثة)",
- "fr": "Pas de regroupement (nouveau sandbox par conversation)",
- "tr": "Gruplama Yok (konuşma başına yeni sandbox)",
- "uk": "Без групування (нова пісочниця для кожної розмови)",
- "ca": "Sense agrupació (nou sandbox per conversa)"
- },
- "SETTINGS$SANDBOX_GROUPING_GROUP_BY_NEWEST": {
- "en": "Group by Newest (add to most recent sandbox)",
- "ja": "最新でグループ化 (最新のサンドボックスに追加)",
- "zh-CN": "按最新分组 (添加到最近的沙盒)",
- "zh-TW": "按最新分組 (添加到最近的沙盒)",
- "ko-KR": "최신으로 그룹화 (가장 최근 샌드박스에 추가)",
- "de": "Nach neuester gruppieren (zur neuesten Sandbox hinzufügen)",
- "no": "Grupper etter nyeste (legg til i nyeste sandkasse)",
- "it": "Raggruppa per più recente (aggiungi alla sandbox più recente)",
- "pt": "Agrupar por mais recente (adicionar ao sandbox mais recente)",
- "es": "Agrupar por más reciente (agregar al sandbox más reciente)",
- "ar": "التجميع حسب الأحدث (إضافة إلى أحدث صندوق رمل)",
- "fr": "Regrouper par le plus récent (ajouter au sandbox le plus récent)",
- "tr": "En Yeniye Göre Grupla (en yeni sandbox'a ekle)",
- "uk": "Групувати за найновішим (додати до найновішої пісочниці)",
- "ca": "Agrupa pel més nou (afegeix al sandbox més recent)"
- },
- "SETTINGS$SANDBOX_GROUPING_LEAST_RECENTLY_USED": {
- "en": "Least Recently Used (add to oldest sandbox)",
- "ja": "最も古い (最も古いサンドボックスに追加)",
- "zh-CN": "最近最少使用 (添加到最旧的沙盒)",
- "zh-TW": "最近最少使用 (添加到最舊的沙盒)",
- "ko-KR": "가장 오래된 것 (가장 오래된 샌드박스에 추가)",
- "de": "Am ältesten (zur ältesten Sandbox hinzufügen)",
- "no": "Eldst (legg til i eldste sandkasse)",
- "it": "Meno usato di recente (aggiungi alla sandbox più vecchia)",
- "pt": "Menos usado recentemente (adicionar ao sandbox mais antigo)",
- "es": "Menos usado recientemente (agregar al sandbox más antiguo)",
- "ar": "الأقل استخدامًا مؤخرًا (إضافة إلى أقدم صندوق رمل)",
- "fr": "Le moins récemment utilisé (ajouter au sandbox le plus ancien)",
- "tr": "En Az Kullanılan (en eski sandbox'a ekle)",
- "uk": "Найменш нещодавно використана (додати до найстаршої пісочниці)",
- "ca": "Menys usat recentment (afegeix al sandbox més antic)"
- },
- "SETTINGS$SANDBOX_GROUPING_FEWEST_CONVERSATIONS": {
- "en": "Fewest Conversations (add to least busy sandbox)",
- "ja": "会話数が最少 (最も空いているサンドボックスに追加)",
- "zh-CN": "最少对话 (添加到最空闲的沙盒)",
- "zh-TW": "最少對話 (添加到最空閒的沙盒)",
- "ko-KR": "대화 수가 가장 적은 (가장 한가한 샌드박스에 추가)",
- "de": "Wenigste Gespräche (zur am wenigsten beschäftigten Sandbox hinzufügen)",
- "no": "Færrest samtaler (legg til i minst opptatt sandkasse)",
- "it": "Meno conversazioni (aggiungi alla sandbox meno occupata)",
- "pt": "Menos conversas (adicionar ao sandbox menos ocupado)",
- "es": "Menos conversaciones (agregar al sandbox menos ocupado)",
- "ar": "أقل محادثات (إضافة إلى صندوق الرمل الأقل انشغالاً)",
- "fr": "Moins de conversations (ajouter au sandbox le moins occupé)",
- "tr": "En Az Konuşma (en az meşgul sandbox'a ekle)",
- "uk": "Найменше розмов (додати до найменш зайнятої пісочниці)",
- "ca": "Menys converses (afegeix al sandbox menys ocupat)"
- },
- "SETTINGS$SANDBOX_GROUPING_ADD_TO_ANY": {
- "en": "Add to Any (use first available sandbox)",
- "ja": "任意に追加 (最初に利用可能なサンドボックスを使用)",
- "zh-CN": "添加到任意 (使用第一个可用的沙盒)",
- "zh-TW": "添加到任意 (使用第一個可用的沙盒)",
- "ko-KR": "아무 곳에나 추가 (첫 번째 사용 가능한 샌드박스 사용)",
- "de": "Zu beliebig hinzufügen (erste verfügbare Sandbox verwenden)",
- "no": "Legg til i hvilken som helst (bruk første tilgjengelige sandkasse)",
- "it": "Aggiungi a qualsiasi (usa la prima sandbox disponibile)",
- "pt": "Adicionar a qualquer (usar o primeiro sandbox disponível)",
- "es": "Agregar a cualquiera (usar el primer sandbox disponible)",
- "ar": "إضافة إلى أي (استخدام أول صندوق رمل متاح)",
- "fr": "Ajouter à n'importe lequel (utiliser le premier sandbox disponible)",
- "tr": "Herhangi Birine Ekle (ilk uygun sandbox'ı kullan)",
- "uk": "Додати до будь-якої (використовувати першу доступну пісочницю)",
- "ca": "Afegeix a qualsevol (usa el primer sandbox disponible)"
- },
"SETTINGS$SEARCH_API_KEY": {
"en": "Search API Key (Tavily)",
"ja": "検索APIキー (Tavily)",
@@ -9639,38 +9537,10 @@
"ca": "Esteu segur que voleu posar en pausa aquesta conversa?"
},
"CONVERSATION$CONFIRM_CLOSE_CONVERSATION": {
- "en": "Confirm Stop Sandbox",
- "ja": "サンドボックス停止の確認",
- "zh-CN": "确认停止沙盒",
- "zh-TW": "確認停止沙盒",
- "ko-KR": "샌드박스 중지 확인",
- "no": "Bekreft stopp sandkasse",
- "it": "Conferma arresto sandbox",
- "pt": "Confirmar parar sandbox",
- "es": "Confirmar detener sandbox",
- "ar": "تأكيد إيقاف صندوق الحماية",
- "fr": "Confirmer l'arrêt du sandbox",
- "tr": "Sandbox'ı Durdurmayı Onayla",
- "de": "Sandbox-Stopp bestätigen",
- "uk": "Підтвердити зупинку пісочниці",
- "ca": "Confirma l'aturada del sandbox"
+ "en": "Confirm Stop Conversation"
},
"CONVERSATION$CLOSE_CONVERSATION_WARNING": {
- "en": "This will stop the sandbox, and pause the following conversations:",
- "ja": "サンドボックスを停止し、以下の会話を一時停止します:",
- "zh-CN": "这将停止沙盒,并暂停以下对话:",
- "zh-TW": "這將停止沙盒,並暫停以下對話:",
- "ko-KR": "샌드박스를 중지하고 다음 대화를 일시 중지합니다:",
- "no": "Dette vil stoppe sandkassen og pause følgende samtaler:",
- "it": "Questo fermerà la sandbox e metterà in pausa le seguenti conversazioni:",
- "pt": "Isso irá parar o sandbox e pausar as seguintes conversas:",
- "es": "Esto detendrá el sandbox y pausará las siguientes conversaciones:",
- "ar": "سيؤدي هذا إلى إيقاف صندوق الحماية وإيقاف المحادثات التالية مؤقتًا:",
- "fr": "Cela arrêtera le sandbox et mettra en pause les conversations suivantes :",
- "tr": "Bu, sandbox'ı durduracak ve aşağıdaki konuşmaları duraklatacaktır:",
- "de": "Dies wird die Sandbox stoppen und die folgenden Gespräche pausieren:",
- "uk": "Це зупинить пісочницю та призупинить наступні розмови:",
- "ca": "Això aturarà el sandbox i posarà en pausa les converses següents:"
+ "en": "Are you sure you want to stop this conversation?"
},
"CONVERSATION$STOP_WARNING": {
"en": "Are you sure you want to pause this conversation?",
@@ -18343,21 +18213,7 @@
"ca": "Feu clic aquí"
},
"COMMON$CLOSE_CONVERSATION_STOP_RUNTIME": {
- "en": "Close Conversation (Stop Sandbox)",
- "ja": "会話を閉じる(サンドボックス停止)",
- "zh-CN": "关闭对话(停止沙盒)",
- "zh-TW": "關閉對話(停止沙盒)",
- "ko-KR": "대화 닫기(샌드박스 중지)",
- "no": "Lukk samtale (stopp sandkasse)",
- "it": "Chiudi conversazione (Interrompi sandbox)",
- "pt": "Fechar conversa (Parar sandbox)",
- "es": "Cerrar conversación (Detener sandbox)",
- "ar": "إغلاق المحادثة (إيقاف صندوق الحماية)",
- "fr": "Fermer la conversation (Arrêter le sandbox)",
- "tr": "Konuşmayı Kapat (Sandbox'ı Durdur)",
- "de": "Gespräch schließen (Sandbox beenden)",
- "uk": "Закрити розмову (зупинити пісочницю)",
- "ca": "Tanca la conversa (atura l'entorn d'execució)"
+ "en": "Close Conversation"
},
"COMMON$CODE": {
"en": "Code",
@@ -18801,23 +18657,6 @@
"uk": "Працює",
"ca": "En execució"
},
- "COMMON$WAITING_FOR_SANDBOX": {
- "en": "Waiting for sandbox",
- "ja": "サンドボックスを待機中",
- "zh-CN": "等待沙盒",
- "zh-TW": "等待沙盒",
- "ko-KR": "샌드박스를 기다리는 중",
- "no": "Venter på sandkasse",
- "it": "In attesa del sandbox",
- "pt": "Aguardando sandbox",
- "es": "Esperando el sandbox",
- "ar": "في انتظار البيئة المعزولة",
- "fr": "En attente du bac à sable",
- "tr": "Sandbox bekleniyor",
- "de": "Warten auf Sandbox",
- "uk": "Очікування пісочниці",
- "ca": "Esperant el sandbox"
- },
"COMMON$SELECT_GIT_PROVIDER": {
"en": "Select Git provider",
"ja": "Gitプロバイダーを選択",
@@ -21267,21 +21106,7 @@
"ca": "No s'ha pogut iniciar una nova conversa: {{error}}"
},
"CONVERSATION$CLEAR_SUCCESS": {
- "en": "Starting a new conversation in the same sandbox. These conversations share the same runtime.",
- "ja": "同じサンドボックスで新しい会話を開始します。これらの会話は同じランタイムを共有します。",
- "zh-CN": "正在同一沙箱中开始新对话。这些对话共享同一运行时。",
- "zh-TW": "正在同一沙盒中開始新對話。這些對話共享同一執行環境。",
- "ko-KR": "같은 샌드박스에서 새 대화를 시작합니다. 이 대화들은 같은 런타임을 공유합니다.",
- "no": "Starter ny samtale i samme sandbox. Disse samtalene deler samme kjøretid.",
- "it": "Avvio nuova conversazione nello stesso sandbox. Queste conversazioni condividono lo stesso runtime.",
- "pt": "Iniciando nova conversa no mesmo sandbox. Essas conversas compartilham o mesmo runtime.",
- "es": "Iniciando nueva conversación en el mismo sandbox. Estas conversaciones comparten el mismo runtime.",
- "ar": "بدء محادثة جديدة في نفس صندوق الحماية. هذه المحادثات تشارك نفس وقت التشغيل.",
- "fr": "Démarrage d'une nouvelle conversation dans le même bac à sable. Ces conversations partagent le même environnement d'exécution.",
- "tr": "Aynı korumalı alanda yeni konuşma başlatılıyor. Bu konuşmalar aynı çalışma ortamını paylaşır.",
- "de": "Starte neue Konversation in derselben Sandbox. Diese Konversationen teilen dieselbe Laufzeitumgebung.",
- "uk": "Починаю нову розмову в тому самому захищеному середовищі. Ці розмови використовують одне середовище виконання.",
- "ca": "S'està iniciant una nova conversa al mateix entorn aïllat. Aquestes converses comparteixen el mateix entorn d'execució."
+ "en": "Starting a new conversation."
},
"CONVERSATION$CLEARING": {
"en": "Creating new conversation...",
diff --git a/src/routes/app-settings.tsx b/src/routes/app-settings.tsx
index e002507c37..145b94157a 100644
--- a/src/routes/app-settings.tsx
+++ b/src/routes/app-settings.tsx
@@ -8,7 +8,6 @@ import { DEFAULT_SETTINGS } from "#/services/settings";
import { BrandButton } from "#/components/features/settings/brand-button";
import { SettingsSwitch } from "#/components/features/settings/settings-switch";
import { SettingsInput } from "#/components/features/settings/settings-input";
-import { SettingsDropdownInput } from "#/components/features/settings/settings-dropdown-input";
import { I18nKey } from "#/i18n/declaration";
import { LanguageInput } from "#/components/features/settings/app-settings/language-input";
import { handleCaptureConsent } from "#/utils/handle-capture-consent";
@@ -19,11 +18,6 @@ import {
import { retrieveAxiosErrorMessage } from "#/utils/retrieve-axios-error-message";
import { AppSettingsInputsSkeleton } from "#/components/features/settings/app-settings/app-settings-inputs-skeleton";
import { parseMaxBudgetPerTask } from "#/utils/settings-utils";
-import {
- SandboxGroupingStrategy,
- SandboxGroupingStrategyOptions,
-} from "#/types/settings";
-import { ENABLE_SANDBOX_GROUPING } from "#/utils/feature-flags";
export function AppSettingsScreen() {
const posthog = usePostHog();
@@ -40,12 +34,6 @@ export function AppSettingsScreen() {
soundNotificationsSwitchHasChanged,
setSoundNotificationsSwitchHasChanged,
] = React.useState(false);
- const [
- sandboxGroupingStrategyHasChanged,
- setSandboxGroupingStrategyHasChanged,
- ] = React.useState(false);
- const [selectedSandboxGroupingStrategy, setSelectedSandboxGroupingStrategy] =
- React.useState<SandboxGroupingStrategy | null>(null);
const [maxBudgetPerTaskHasChanged, setMaxBudgetPerTaskHasChanged] =
React.useState(false);
const [gitUserNameHasChanged, setGitUserNameHasChanged] =
@@ -65,11 +53,6 @@ export function AppSettingsScreen() {
const enableSoundNotifications =
formData.get("enable-sound-notifications-switch")?.toString() === "on";
- const sandboxGroupingStrategy =
- selectedSandboxGroupingStrategy ||
- settings?.sandbox_grouping_strategy ||
- DEFAULT_SETTINGS.sandbox_grouping_strategy;
-
const maxBudgetPerTaskValue = formData
.get("max-budget-per-task-input")
?.toString();
@@ -87,7 +70,6 @@ export function AppSettingsScreen() {
language,
user_consents_to_analytics: enableAnalytics,
enable_sound_notifications: enableSoundNotifications,
- sandbox_grouping_strategy: sandboxGroupingStrategy,
max_budget_per_task: maxBudgetPerTask,
git_user_name: gitUserName,
git_user_email: gitUserEmail,
@@ -105,8 +87,6 @@ export function AppSettingsScreen() {
setLanguageInputHasChanged(false);
setAnalyticsSwitchHasChanged(false);
setSoundNotificationsSwitchHasChanged(false);
- setSandboxGroupingStrategyHasChanged(false);
- setSelectedSandboxGroupingStrategy(null);
setMaxBudgetPerTaskHasChanged(false);
setGitUserNameHasChanged(false);
setGitUserEmailHasChanged(false);
@@ -139,15 +119,6 @@ export function AppSettingsScreen() {
);
};
- const handleSandboxGroupingStrategyChange = (key: React.Key | null) => {
- const newStrategy = key?.toString() as SandboxGroupingStrategy | undefined;
- setSelectedSandboxGroupingStrategy(newStrategy || null);
- const currentStrategy =
- settings?.sandbox_grouping_strategy ||
- DEFAULT_SETTINGS.sandbox_grouping_strategy;
- setSandboxGroupingStrategyHasChanged(newStrategy !== currentStrategy);
- };
-
const checkIfMaxBudgetPerTaskHasChanged = (value: string) => {
const newValue = parseMaxBudgetPerTask(value);
const currentValue = settings?.max_budget_per_task;
@@ -168,7 +139,6 @@ export function AppSettingsScreen() {
!languageInputHasChanged &&
!analyticsSwitchHasChanged &&
!soundNotificationsSwitchHasChanged &&
- !sandboxGroupingStrategyHasChanged &&
!maxBudgetPerTaskHasChanged &&
!gitUserNameHasChanged &&
!gitUserEmailHasChanged;
@@ -208,26 +178,6 @@ export function AppSettingsScreen() {
{t(I18nKey.SETTINGS$SOUND_NOTIFICATIONS)}
</SettingsSwitch>
- {ENABLE_SANDBOX_GROUPING() && (
- <SettingsDropdownInput
- testId="sandbox-grouping-strategy-input"
- name="sandbox-grouping-strategy-input"
- label={t(I18nKey.SETTINGS$SANDBOX_GROUPING_STRATEGY)}
- items={Object.keys(SandboxGroupingStrategyOptions).map((key) => ({
- key,
- label: t(`SETTINGS$SANDBOX_GROUPING_${key}` as I18nKey),
- }))}
- selectedKey={
- selectedSandboxGroupingStrategy ||
- settings.sandbox_grouping_strategy ||
- DEFAULT_SETTINGS.sandbox_grouping_strategy
- }
- isClearable={false}
- onSelectionChange={handleSandboxGroupingStrategyChange}
- wrapperClassName="w-full max-w-[680px]"
- />
- )}
-
{!settings?.v1_enabled && (
<SettingsInput
testId="max-budget-per-task-input"
diff --git a/src/routes/conversation.tsx b/src/routes/conversation.tsx
index 854b384dcb..e99369b869 100644
--- a/src/routes/conversation.tsx
+++ b/src/routes/conversation.tsx
@@ -77,8 +77,6 @@ function AppContent() {
}
}, [isTask, taskStatus, taskDetail, t]);
- // 3. Handle conversation not found
- // NOTE: Resuming STOPPED conversations is handled by useSandboxRecovery in WebSocketProviderWrapper
React.useEffect(() => {
// Wait for data to be fetched
if (!isFetched || !isAuthed) return;
diff --git a/src/services/settings.ts b/src/services/settings.ts
index 36e6313662..c03769bacb 100644
--- a/src/services/settings.ts
+++ b/src/services/settings.ts
@@ -35,7 +35,6 @@ export const DEFAULT_SETTINGS: Settings = {
git_user_name: "openhands",
git_user_email: "[email protected]",
v1_enabled: true,
- sandbox_grouping_strategy: "NO_GROUPING",
agent_settings_schema: null,
agent_settings: {
schema_version: 1,
diff --git a/src/types/settings.ts b/src/types/settings.ts
index 01776945c7..ea14d816cd 100644
--- a/src/types/settings.ts
+++ b/src/types/settings.ts
@@ -7,17 +7,6 @@ export const ProviderOptions = {
forgejo: "forgejo",
} as const;
-export const SandboxGroupingStrategyOptions = {
- NO_GROUPING: "NO_GROUPING",
- GROUP_BY_NEWEST: "GROUP_BY_NEWEST",
- LEAST_RECENTLY_USED: "LEAST_RECENTLY_USED",
- FEWEST_CONVERSATIONS: "FEWEST_CONVERSATIONS",
- ADD_TO_ANY: "ADD_TO_ANY",
-} as const;
-
-export type SandboxGroupingStrategy =
- keyof typeof SandboxGroupingStrategyOptions;
-
export type Provider = keyof typeof ProviderOptions;
export type ProviderToken = {
@@ -142,5 +131,4 @@ export type Settings = {
agent_settings?: Record<string, SettingsValue> | null;
conversation_settings_schema?: SettingsSchema | null;
conversation_settings?: Record<string, SettingsValue> | null;
- sandbox_grouping_strategy?: SandboxGroupingStrategy;
};
diff --git a/src/utils/feature-flags.ts b/src/utils/feature-flags.ts
index 969c421484..894d2f4112 100644
--- a/src/utils/feature-flags.ts
+++ b/src/utils/feature-flags.ts
@@ -16,6 +16,4 @@ export const HIDE_LLM_SETTINGS = () => loadFeatureFlag("HIDE_LLM_SETTINGS");
export const VSCODE_IN_NEW_TAB = () => loadFeatureFlag("VSCODE_IN_NEW_TAB");
export const ENABLE_TRAJECTORY_REPLAY = () =>
loadFeatureFlag("TRAJECTORY_REPLAY");
-export const ENABLE_SANDBOX_GROUPING = () =>
- loadFeatureFlag("SANDBOX_GROUPING");
export const ENABLE_AUTOMATIONS = () => loadFeatureFlag("AUTOMATIONS");
diff --git a/src/utils/get-git-path.ts b/src/utils/get-git-path.ts
index 3d02e7658f..a950a3b529 100644
--- a/src/utils/get-git-path.ts
+++ b/src/utils/get-git-path.ts
@@ -1,21 +1,7 @@
import { DEFAULT_WORKING_DIR } from "#/api/agent-server-config";
-/**
- * Get the git repository path for a conversation.
- *
- * If the backend provides an explicit workspace path for the conversation,
- * prefer that over frontend heuristics.
- *
- * Otherwise, when sandbox grouping is enabled (strategy != NO_GROUPING), each
- * conversation gets its own subdirectory: workspace/project/{conversationId}[/{repoName}]
- *
- * When sandbox grouping is disabled (NO_GROUPING), the path is simply:
- * workspace/project[/{repoName}]
- */
export function getGitPath(
- conversationId: string,
selectedRepository: string | null | undefined,
- useSandboxGrouping: boolean = false,
workingDir?: string | null,
): string {
const normalizedWorkingDir = workingDir?.trim();
@@ -23,16 +9,12 @@ export function getGitPath(
return normalizedWorkingDir;
}
- const basePath = useSandboxGrouping
- ? `${DEFAULT_WORKING_DIR}/${conversationId}`
- : DEFAULT_WORKING_DIR;
-
if (!selectedRepository) {
- return basePath;
+ return DEFAULT_WORKING_DIR;
}
const parts = selectedRepository.split("/");
const repoName = parts[parts.length - 1];
- return `${basePath}/${repoName}`;
+ return `${DEFAULT_WORKING_DIR}/${repoName}`;
}
diff --git a/src/utils/status.ts b/src/utils/status.ts
index b887af6c92..a97de3607c 100644
--- a/src/utils/status.ts
+++ b/src/utils/status.ts
@@ -3,10 +3,36 @@ import { AgentState } from "#/types/agent-state";
import { ConversationStatus } from "#/types/conversation-status";
import { RuntimeStatus } from "#/types/runtime-status";
import { V1AppConversationStartTaskStatus } from "#/api/conversation-service/v1-conversation-service.types";
-import { V1SandboxStatus } from "#/api/sandbox-service/sandbox-service.types";
import { V1ExecutionStatus } from "#/types/v1/core/base/common";
import { V1_WebSocketConnectionState } from "#/contexts/conversation-websocket-context";
+const ACTIVE_EXECUTION_STATUSES: ReadonlySet<V1ExecutionStatus> = new Set([
+ V1ExecutionStatus.IDLE,
+ V1ExecutionStatus.RUNNING,
+ V1ExecutionStatus.WAITING_FOR_CONFIRMATION,
+ V1ExecutionStatus.FINISHED,
+]);
+
+export function isExecutionActive(
+ status: V1ExecutionStatus | null | undefined,
+): boolean {
+ return !!status && ACTIVE_EXECUTION_STATUSES.has(status);
+}
+
+export function isExecutionPaused(
+ status: V1ExecutionStatus | null | undefined,
+): boolean {
+ return status === V1ExecutionStatus.PAUSED;
+}
+
+export function isExecutionErrored(
+ status: V1ExecutionStatus | null | undefined,
+): boolean {
+ return (
+ status === V1ExecutionStatus.ERROR || status === V1ExecutionStatus.STUCK
+ );
+}
+
export enum IndicatorColor {
BLUE = "bg-blue-500",
GREEN = "bg-green-500",
@@ -102,29 +128,19 @@ export function getIndicatorColor(
export function getStatusCode(
webSocketConnectionState: V1_WebSocketConnectionState,
executionStatus: V1ExecutionStatus | null,
- sandboxStatus: V1SandboxStatus | null,
taskStatus?: V1AppConversationStartTaskStatus | null,
subConversationTaskStatus?: V1AppConversationStartTaskStatus | null,
) {
- // TODO: The i18n keys in this method are scattered due to multiple iterations.
- // They should be unified under a single category
-
- // PRIORITY 1: Handle task error state (when start-tasks API returns ERROR)
- // This must come first to prevent "Connecting..." from showing when task has errored
if (
taskStatus === "ERROR" ||
subConversationTaskStatus === "ERROR" ||
- sandboxStatus === "ERROR" ||
executionStatus === "error"
) {
return I18nKey.AGENT_STATUS$ERROR_OCCURRED;
}
- // Priority 2 : Startup task.
if (taskStatus && taskStatus !== "READY") {
switch (taskStatus) {
- case "WAITING_FOR_SANDBOX":
- return I18nKey.COMMON$WAITING_FOR_SANDBOX;
case "SETTING_UP_GIT_HOOKS":
return I18nKey.STATUS$SETTING_UP_GIT_HOOKS;
case "SETTING_UP_SKILLS":
@@ -134,24 +150,14 @@ export function getStatusCode(
case "WORKING":
case "PREPARING_REPOSITORY":
case "RUNNING_SETUP_SCRIPT":
- // TODO: These don't have In8n labels.
return I18nKey.CONVERSATION$STARTING_CONVERSATION;
default:
throw new Error(`Unknown taskStatus: ${taskStatus}`);
}
}
- // Priority 3: SandboxStatus
- if (sandboxStatus && sandboxStatus !== "RUNNING") {
- switch (sandboxStatus) {
- case "STARTING":
- return I18nKey.CONVERSATION$STARTING_CONVERSATION;
- case "PAUSED":
- case "MISSING":
- return I18nKey.CHAT_INTERFACE$STOPPED;
- default:
- throw new Error(`Unknown sandboxStatus: ${sandboxStatus}`);
- }
+ if (executionStatus === V1ExecutionStatus.PAUSED) {
+ return I18nKey.CHAT_INTERFACE$STOPPED;
}
// Websocket has disconnected...
@@ -177,8 +183,6 @@ export function getStatusCode(
return I18nKey.AGENT_STATUS$RUNNING_TASK;
case V1ExecutionStatus.WAITING_FOR_CONFIRMATION:
return I18nKey.AGENT_STATUS$WAITING_FOR_USER_CONFIRMATION;
- case V1ExecutionStatus.PAUSED:
- return I18nKey.CHAT_INTERFACE$AGENT_PAUSED_MESSAGE;
case V1ExecutionStatus.FINISHED:
return I18nKey.CHAT_INTERFACE$AGENT_FINISHED_MESSAGE;
default:
@@ -186,6 +190,5 @@ export function getStatusCode(
}
}
- // Some unknown state...
return I18nKey.CHAT_INTERFACE$AGENT_ERROR_MESSAGE;
}
diff --git a/src/utils/utils.ts b/src/utils/utils.ts
index e6213bb883..7e02572d93 100644
--- a/src/utils/utils.ts
+++ b/src/utils/utils.ts
@@ -783,12 +783,12 @@ interface GetStatusTextArgs {
* getStatusText({
* isPausing: false,
* isTask: true,
- * taskStatus: "WAITING_FOR_SANDBOX",
+ * taskStatus: "STARTING_CONVERSATION",
* taskDetail: null,
* isStartingStatus: false,
* isStopStatus: false,
* curAgentState: AgentState.RUNNING
- * }) // Returns "Waiting for sandbox"
+ * }) // Returns "Starting conversation"
*/
export function getStatusText({
isPausing = false,
@@ -816,7 +816,6 @@ export function getStatusText({
return t(I18nKey.CONVERSATION$READY);
}
- // Format status text with sentence case: "WAITING_FOR_SANDBOX" -> "Waiting for sandbox"
return (
taskDetail ||
taskStatus