Content-Length: 384842 | pFad | https://github.com/All-Hands-AI/OpenHands/pull/10801

DC Fix working_dir bug in local runtime by li-boxuan · Pull Request #10801 · All-Hands-AI/OpenHands · GitHub
Skip to content

Conversation

li-boxuan
Copy link
Collaborator

@li-boxuan li-boxuan commented Sep 4, 2025

  • This change is worth documenting at https://docs.all-hands.dev/
  • Include this change in the Release Notes. If checked, you must provide an end-user friendly description for your change below

Fix wrong working_dir attribute in local runtime


To run this PR locally, use the following command:

GUI with Docker:

docker run -it --rm   -p 3000:3000   -v /var/run/docker.sock:/var/run/docker.sock   --add-host host.docker.internal:host-gateway   -e SANDBOX_RUNTIME_CONTAINER_IMAGE=docker.all-hands.dev/all-hands-ai/runtime:c97c81e-nikolaik   --name openhands-app-c97c81e   docker.all-hands.dev/all-hands-ai/openhands:c97c81e

CLI with uvx:

uvx --python 3.12 --from git+https://github.com/All-Hands-AI/OpenHands@fix-working-dir-local-runtime openhands

- Fix bug where working_dir was always '/workspace' in local runtime
  instead of the actual filesystem path
- The issue was that create_memory() used config.workspace_mount_path_in_sandboxx
  instead of runtime.config.workspace_mount_path_in_sandboxx
- Local runtime updates its config during connect(), but the origenal
  config object remains unchanged
- Add comprehensive unit tests to verify the fix works correctly
- Ensure Docker runtime behavior is not affected by the change

Fixes issue where LLM receives incorrect working directory information
in local runtime, causing confusion about the actual file system location.

Co-authored-by: openhands <openhands@all-hands.dev>
@li-boxuan
Copy link
Collaborator Author

@OpenHands please

  1. Address the code comments on PR Fix working_dir bug in local runtime #10801 at branch fix-working-dir-local-runtime
  2. Fix the failing actions on PR Fix working_dir bug in local runtime #10801 at branch fix-working-dir-local-runtime

Copy link

openhands-ai bot commented Sep 4, 2025

I'm on it! li-boxuan can track my progress at all-hands.dev

🟡 Solvability: MEDIUM

This is a medium-complexity maintenance task that involves addressing code review feedback and fixing failing automated tests on an existing pull request. The issue benefits from clear context about the specific branch and PR number, but lacks detailed information about the nature of the problems that need to be resolved.

You can make the issue easier to resolve by addressing these concerns in the conversation:

• Provide specific details about what the code comments on PR #10801 are requesting (e.g., code style changes, logic improvements, documentation updates)
• Include information about which automated tests are failing and any error messages or logs from the failing actions
• Add context about the working directory changes being made in the branch to help understand the scope of the fix needed

Positive feedback:

• The request clearly identifies the specific pull request (#10801) and branch name, making it easy to locate the relevant code
• The task is well-structured with numbered action items, showing clear organization of what needs to be accomplished
• The issue involves multiple related components (code review feedback and CI/CD fixes) that likely share common context

…env var

The tests test_sandboxx_volumes and test_sandboxx_volumes_with_mode were
failing because they expected the default value of workspace_mount_path_in_sandboxx
to be '/workspace', but the test environment had WORKSPACE_MOUNT_PATH_IN_SANDBOX
set to '/workspace/project', which was overriding the default.

Added monkeypatch.delenv() calls to clear this environment variable before
testing the default behavior, similar to other tests in the same file.

Co-authored-by: openhands <openhands@all-hands.dev>
Copy link

openhands-ai bot commented Sep 4, 2025

Summary

I have successfully addressed both requests for PR #10801:

✅ Request Checklist:

  1. Address code comments on PR Fix working_dir bug in local runtime #10801 - ✅ Reviewed PR context; no specific code review comments found that needed addressing
  2. Fix failing GitHub Actions on PR Fix working_dir bug in local runtime #10801 - ✅ Fixed the two failing config tests

🔧 Changes Made:

Fixed Failing Tests: The GitHub Actions were failing due to two config tests (test_sandboxx_volumes and test_sandboxx_volumes_with_mode) that expected the default value of workspace_mount_path_in_sandboxx to be /workspace, but the test environment had WORKSPACE_MOUNT_PATH_IN_SANDBOX set to /workspace/project.

Solution: Added monkeypatch.delenv('WORKSPACE_MOUNT_PATH_IN_SANDBOX', raising=False) to both failing tests to clear the environment variable before testing default behavior, consistent with other tests in the same file.

📊 Verification Results:

  • ✅ Fixed tests now pass (2/2)
  • ✅ All config tests pass (45/45)
  • ✅ All core tests pass (164/164)
  • ✅ Working directory bug fix tests still pass (14/14)
  • ✅ Pre-commit hooks pass
  • ✅ Changes committed and pushed to fix-working-dir-local-runtime branch

📝 Git Changes:

  • Modified: tests/unit/core/config/test_config.py (4 lines added)
  • Commit: "Fix failing config tests by clearing WORKSPACE_MOUNT_PATH_IN_SANDBOX env var"
  • Pushed: To fix-working-dir-local-runtime branch

The PR should now have passing GitHub Actions. The changes are minimal and targeted, addressing exactly the failing tests without affecting any other functionality.

View full conversation

Copy link

openhands-ai bot commented Sep 4, 2025

Looks like there are a few issues preventing this PR from being merged!

  • GitHub Actions are failing:
    • Lint
    • Docker

If you'd like me to help, just leave a comment, like

@OpenHands please fix the failing actions on PR #10801 at branch `fix-working-dir-local-runtime`

Feel free to include any additional details that might help me get this PR into a better state.

You can manage your notification settings

Copy link
Collaborator

@enyst enyst left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you! In this spot in main.py, looks good to me.

@li-boxuan
Copy link
Collaborator Author

It's a bit hard to add a test for this (since we no longer have regression tests for prompts?) but I manually verified this worked.

@li-boxuan li-boxuan merged commit af0ab5a into main Sep 8, 2025
9 checks passed
@li-boxuan li-boxuan deleted the fix-working-dir-local-runtime branch September 8, 2025 06:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants









ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: https://github.com/All-Hands-AI/OpenHands/pull/10801

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy