magnificent-hairdresser-38202
09/13/2025, 1:34 AMstr_replace_editor_tool tool defines path parameter as: “Absolute path to file or directory, e.g. /workspace/file.py or /workspace.” When using CLI and local runtime, we would like to replace “/workspace” with working_dir as defined in SANDBOX_VOLUMES={working_dir}:/workspace:rw
For example, if my working_dir is /app, then the path parameter should use /app as an example rather than /workspace.nutritious-balloon-65098
09/13/2025, 1:34 AMnutritious-balloon-65098
09/13/2025, 1:47 AMworking_dir bug in RecallObservation for local runtime. Here's the final summary:
🔧 Problem Fixed
• Root Cause: agent_session.py line 162 was hardcoding working_dir to /workspace instead of using the actual runtime workspace root
• Impact: When using SANDBOX_VOLUMES={custom_dir}:/workspace:rw, RecallObservation would show incorrect working directory
✅ Solution Implemented
• Fixed openhands/server/session/agent_session.py to use runtime.workspace_root with proper fallback
• Added 4 comprehensive unit tests to reproduce the bug and verify the fix
• Verified all 112 existing memory tests still pass
📋 Changes Made
1. Core Fix: 3-line change in agent_session.py to use str(self.runtime.workspace_root) when available
2. Comprehensive Tests: 222-line test file with 4 test cases covering bug reproduction and fix verification
3. Backward Compatibility: Proper fallback to config default when runtime is unavailable
🚀 Pull Request Created
Link: https://github.com/All-Hands-AI/OpenHands/pull/10964
The PR is marked as draft and includes:
• Clear problem description and solution explanation
• Comprehensive testing details
• Proper co-authorship attribution
The fix ensures that RecallObservation.working_dir now correctly reflects the actual mounted directory path instead of always showing /workspace, resolving the issue with local runtime configurations.
<sub>View full conversation</sub>