π OpenHands: AI-Driven Development
feat: forward Docker conversation runtime settings (#17462)
Graham Neubig3b29fd61d487
diff --git a/__tests__/scripts/dev-safe.test.ts b/__tests__/scripts/dev-safe.test.tsindex c356fbfd1d..a108ae51a6 100644--- a/__tests__/scripts/dev-safe.test.ts+++ b/__tests__/scripts/dev-safe.test.ts@@ -385,6 +385,24 @@ describe("formatMissingUvxGuidance", () => {});describe("buildAgentServerTelemetryEnv", () => {+ const agentServerConfig = {+ cwd: "/tmp/cwd",+ backendPort: 18000,+ tmuxTmpDir: "/tmp/tmux",+ stateDir: "/tmp/state",+ conversationsPath: "/tmp/conversations",+ workspacesPath: "/tmp/workspaces",+ bashEventsDir: "/tmp/bash-events",+ vscodePort: 19000,+ vscodeBasePath: "/vscode",+ secretKey: "secret",+ sessionApiKey: "session",+ backendBaseUrl: "http://127.0.0.1:18000",+ backendHost: "127.0.0.1:18000",+ workingDir: "/tmp/workspaces",+ canvasToolsDir: "/tmp/tools",+ };+it("configures PostHog telemetry by default without seeding consent", () => {expect(buildAgentServerTelemetryEnv({})).toEqual({OH_TELEMETRY_EXPORTER: "posthog",@@ -432,32 +450,38 @@ describe("buildAgentServerTelemetryEnv", () => {});it("includes telemetry defaults in the full agent-server environment", () => {- const env = buildAgentServerEnv(- {- cwd: "/tmp/cwd",- backendPort: 18000,- tmuxTmpDir: "/tmp/tmux",- stateDir: "/tmp/state",- conversationsPath: "/tmp/conversations",- workspacesPath: "/tmp/workspaces",- bashEventsDir: "/tmp/bash-events",- vscodePort: 19000,- vscodeBasePath: "/vscode",- secretKey: "secret",- sessionApiKey: "session",- backendBaseUrl: "http://127.0.0.1:18000",- backendHost: "127.0.0.1:18000",- workingDir: "/tmp/workspaces",- canvasToolsDir: "/tmp/tools",- },- { env: {} },- );+ const env = buildAgentServerEnv(agentServerConfig, { env: {} });expect(env).toMatchObject({OH_TELEMETRY_EXPORTER: "posthog",OH_SESSION_API_KEYS_0: "session",});});++ it("forwards configured Docker conversation runtime settings", () => {+ const configured = buildAgentServerEnv(agentServerConfig, {+ env: {+ OH_CONVERSATION_RUNTIME: "docker",+ OH_CONVERSATION_IMAGE: "agent-server:test",+ OH_CONVERSATION_CONTAINER_MEMORY: "2g",+ OH_CONVERSATION_CONTAINER_CPUS: "1",+ OH_CONVERSATION_CONTAINER_PIDS_LIMIT: "256",+ OH_CONVERSATION_CONTAINER_STARTUP_TIMEOUT: "180",+ },+ });++ expect(configured).toMatchObject({+ OH_CONVERSATION_RUNTIME: "docker",+ OH_CONVERSATION_IMAGE: "agent-server:test",+ OH_CONVERSATION_CONTAINER_MEMORY: "2g",+ OH_CONVERSATION_CONTAINER_CPUS: "1",+ OH_CONVERSATION_CONTAINER_PIDS_LIMIT: "256",+ OH_CONVERSATION_CONTAINER_STARTUP_TIMEOUT: "180",+ });+ expect(+ buildAgentServerEnv(agentServerConfig, { env: {} }),+ ).not.toHaveProperty("OH_CONVERSATION_RUNTIME");+ });});describe("buildAgentServerCommand", () => {diff --git a/scripts/dev-safe.mjs b/scripts/dev-safe.mjsindex c0e48bfbed..c78952da97 100644--- a/scripts/dev-safe.mjs+++ b/scripts/dev-safe.mjs@@ -789,8 +789,21 @@ export function buildAgentServerTelemetryEnv(env = process.env) {*/export function buildAgentServerEnv(config, options = {}) {const { vscodeBasePath = null, env = process.env } = options;+ const conversationRuntimeEnv = Object.fromEntries(+ [+ "OH_CONVERSATION_RUNTIME",+ "OH_CONVERSATION_IMAGE",+ "OH_CONVERSATION_CONTAINER_MEMORY",+ "OH_CONVERSATION_CONTAINER_CPUS",+ "OH_CONVERSATION_CONTAINER_PIDS_LIMIT",+ "OH_CONVERSATION_CONTAINER_STARTUP_TIMEOUT",+ ]+ .filter((key) => env[key] !== undefined)+ .map((key) => [key, env[key]]),+ );return {...buildAgentServerTelemetryEnv(env),+ ...conversationRuntimeEnv,// Force Python to use UTF-8 for all file I/O and streams.//// On Windows, Python defaults to the system ANSI codepage (e.g. cp1252).