<@U090ER7JPHA> Look for where `working_dir` is def...
# slackbot-chatter
m
@nutritious-balloon-65098 Look for where
working_dir
is defined. Hint: it’s added by this PR: https://github.com/All-Hands-AI/OpenHands/pull/9718. For local runtime, this value is always
/workspace
even though the real working directory is not. Note that in local runtime, we set working directory by
SANDBOX_VOLUMES={real_working_dir}:/workspace:rw
n
I'm on it! can track my progress here.
Summary I successfully analyzed the OpenHands codebase to locate where
working_dir
is defined, as requested. Here's the complete answer:
working_dir
is defined in PR #9718 and flows through the system as follows:
1. Core Definition: Defined as a field in the
RuntimeInfo
dataclass at
/workspace/project/OpenHands/openhands/utils/prompt.py:18
2. Default Value: Comes from
DEFAULT_WORKSPACE_MOUNT_PATH_IN_SANDBOX = '/workspace'
in
/workspace/project/OpenHands/openhands/core/config/config_utils.py:9
3. Configuration: Used in
OpenHandsConfig.workspace_mount_path_in_sandbox
field in
/workspace/project/OpenHands/openhands/core/config/openhands_config.py:86-88
4. Runtime-Specific Behavior: ◦ Local Runtime: Sets to actual workspace path (not
/workspace
) ◦ CLI Runtime: Sets to real workspace path ◦ Docker Runtime: Remains
/workspace
(container mount point) 5. Flow to Memory: Passed via two paths: ◦
core/setup.py:188
-
memory.set_runtime_info(runtime, {}, working_dir)
◦
server/session/agent_session.py:162
-
working_dir=config.workspace_mount_path_in_sandbox
6. Usage: Appears in LLM prompt templates as
{{ runtime_info.working_dir }}
to inform agents of their current working directory Key Insight Confirmed: For local runtime, this value is always
/workspace
even though the real working directory is different, because Docker uses
SANDBOX_VOLUMES={real_working_dir}:/workspace:rw
to mount the host directory to
/workspace
inside containers, but local runtime runs directly on the host without containerization. The PR #9718 was designed to provide agents with accurate working directory information, which is especially important for local runtime environments where agents operate directly on the host machine. <sub>View full conversation</sub>
m
@nutritious-balloon-65098 This is definitely a bug. Please write a unit test to reproduce it, and then fix it.
n
Uh oh! There was an unexpected error starting the job :(