π OpenHands: AI-Driven Development
fix: move TMUX_TMPDIR to /tmp to avoid socket errors on mounted volumes (#325)
Xingyao Wang18e51fa84d8b
diff --git a/.env.sample b/.env.sampleindex 258699c8a0..a073e58538 100644--- a/.env.sample+++ b/.env.sample@@ -23,7 +23,7 @@ VITE_MOCK_API="false" # Enable/disable API mocking with MSW# `npm run dev` (scripts/dev-safe.mjs) β isolated local backend via uvx# OH_CANVAS_SAFE_BACKEND_PORT="18000" # Port the spawned agent-server listens on# OH_CANVAS_SAFE_VSCODE_PORT="18001" # Port forwarded to the embedded VS Code (defaults to backend port + 1)-# OH_CANVAS_SAFE_STATE_DIR="$HOME/.openhands/agent-canvas" # Where conversations, tmux sockets, and bash events are stored+# OH_CANVAS_SAFE_STATE_DIR="$HOME/.openhands/agent-canvas" # Where conversations and bash events are stored (tmux sockets live under /tmp)# Agent server version selection (uvx) β listed in order of precedence (highest first)# OH_AGENT_SERVER_LOCAL_PATH="" # Absolute path to a local software-agent-sdk checkout. Runs the local checkout via uvx with editable openhands-sdk/tools/workspace installs so source edits are picked up on restart. Highest precedence.diff --git a/DEVELOPMENT.md b/DEVELOPMENT.mdindex 2eed1a5b2c..c3d139bfc9 100644--- a/DEVELOPMENT.md+++ b/DEVELOPMENT.md@@ -12,7 +12,7 @@ npm run devThis is an alias for `npm run dev:safe`.-It uses `uvx` to run a temporary `agent-server` installation for this checkout on `127.0.0.1:18000` and points the frontend at it. It isolates tmux state and conversation persistence by setting separate `TMUX_TMPDIR`, `OH_CONVERSATIONS_PATH`, `OH_BASH_EVENTS_DIR`, and `OH_VSCODE_PORT` values under `.openhands-dev/`, so it does not collide with other local or cloud-backed OpenHands sessions.+It uses `uvx` to run a temporary `agent-server` installation for this checkout on `127.0.0.1:18000` and points the frontend at it. It isolates conversation persistence by setting separate `OH_CONVERSATIONS_PATH`, `OH_BASH_EVENTS_DIR`, and `OH_VSCODE_PORT` values under `.openhands-dev/`, and places tmux sockets under `/tmp` (via `TMUX_TMPDIR`) to avoid filesystem-support issues with mounted volumes, so it does not collide with other local or cloud-backed OpenHands sessions.### Environment Variablesdiff --git a/__tests__/scripts/dev-safe.test.ts b/__tests__/scripts/dev-safe.test.tsindex d5f6c91298..076e46ab52 100644--- a/__tests__/scripts/dev-safe.test.ts+++ b/__tests__/scripts/dev-safe.test.ts@@ -442,7 +442,9 @@ describe("buildSafeDevConfig", () => {expect(config.stateDir).toBe(path.join(homedir(), ".openhands", "agent-canvas"),);- expect(config.tmuxTmpDir).toBe(path.join(config.stateDir, "tmux"));+ expect(config.tmuxTmpDir).toBe(+ path.join(tmpdir(), "openhands-agent-canvas-tmux"),+ );expect(config.conversationsPath).toBe(path.join(config.stateDir, "conversations"),);diff --git a/scripts/dev-docker.mjs b/scripts/dev-docker.mjsindex 3984608b52..96179f317f 100644--- a/scripts/dev-docker.mjs+++ b/scripts/dev-docker.mjs@@ -229,7 +229,6 @@ function startAgentServerDocker(config) {"/home/openhands/.openhands/agent-canvas/conversations",OH_PERSISTENCE_DIR: "/home/openhands/.openhands",OH_BASH_EVENTS_DIR: "/home/openhands/.openhands/agent-canvas/bash_events",- TMUX_TMPDIR: "/home/openhands/.openhands/agent-canvas/tmux",OH_SECRET_KEY: process.env.OH_SECRET_KEY || DEFAULT_SECRET_KEY,// Required so the secret-seeding PUT /api/settings/secrets call from// the host can authenticate against the agent-server in the container.diff --git a/scripts/dev-safe.mjs b/scripts/dev-safe.mjsindex a1fe2337d9..734db1f579 100644--- a/scripts/dev-safe.mjs+++ b/scripts/dev-safe.mjs@@ -10,7 +10,7 @@ import {writeFileSync,} from "node:fs";import net from "node:net";-import { homedir } from "node:os";+import { homedir, tmpdir } from "node:os";import path from "node:path";import process from "node:process";import { setTimeout as delay } from "node:timers/promises";@@ -497,7 +497,7 @@ function buildConfigFromPorts(ports, cwd, env) {backendPort,vscodePort,stateDir,- tmuxTmpDir: path.join(stateDir, "tmux"),+ tmuxTmpDir: path.join(tmpdir(), "openhands-agent-canvas-tmux"),conversationsPath,workspacesPath,bashEventsDir: path.join(stateDir, "bash_events"),diff --git a/scripts/dev-static.mjs b/scripts/dev-static.mjsindex 65f4892be3..5ca70e7e9b 100644--- a/scripts/dev-static.mjs+++ b/scripts/dev-static.mjs@@ -580,7 +580,6 @@ async function main() {const { mkdirSync } = await import("node:fs");for (const dir of [config.stateDir,- join(config.stateDir, "tmux"),join(config.stateDir, "conversations"),join(config.stateDir, "workspaces"),join(config.stateDir, "bash_events"),diff --git a/scripts/dev-with-automation.mjs b/scripts/dev-with-automation.mjsindex 277f6be2f9..798e4556c5 100644--- a/scripts/dev-with-automation.mjs+++ b/scripts/dev-with-automation.mjs@@ -332,7 +332,6 @@ function checkPrerequisites() {function ensureDirectories(config) {const dirs = [config.stateDir,- join(config.stateDir, "tmux"),join(config.stateDir, "conversations"),join(config.stateDir, "workspaces"),join(config.stateDir, "bash_events"),