1.6 KiB
2026-02-27 Session Notes
OpenClaw Temp Workspace Path Leak Fix
Implemented a plan to fix a production issue where the OpenClaw agent (mrclaude on buba's mac mini) had its workspace configuration pointing to a temporary directory (/tmp/signet-openclaw-test-58culC/agents) instead of the persistent ~/.agents/ location. This caused the agent to start with empty identity files and no persistent memory.
Identified and fixed two root causes:
Issue 1: Test Environment Variable Cleanup
The test cleanup in packages/connector-openclaw/test/index.test.ts was using process.env.OPENCLAW_CONFIG_PATH = undefined instead of delete process.env.OPENCLAW_CONFIG_PATH. In Node.js/Bun, assigning undefined to a process.env key converts it to the string "undefined" or leaves it in an ambiguous state, causing tests run in shared processes to potentially leak state.
Issue 2: Missing Workspace Path Validation
The real production problem: no validation existed to prevent writing temporary paths to the OpenClaw config. The fix added a validateWorkspacePath() guard method in OpenClawConnector that rejects any workspace path under /tmp/ or matching tmpdir(), throwing an error before the config is persisted.
Implementation
Modified two files:
packages/connector-openclaw/test/index.test.ts: Fixed env cleanup usingdeleteinstead of assignmentpackages/connector-openclaw/src/index.ts: AddedvalidateWorkspacePath()private method called during bothinstall()andconfigureWorkspace()
Added a new test case to verify the temp path guard fires correctly.