-
Notifications
You must be signed in to change notification settings - Fork 3
Osworld support #5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: stable
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds OSWorld support by introducing OS-level interactions (computer_use tool) and updating the default base image from nikolaik/python-nodejs:python3.12-nodejs22 to ubuntu:24.04. The changes enable GUI automation capabilities through PyAutoGUI and Xvfb, along with supporting infrastructure for virtual display management.
Key changes:
- Added
OSInteractiveActionfor OS-level interactions via PyAutoGUI - Changed default base container image to
ubuntu:24.04across all runtime configurations - Implemented virtual display (Xvfb) support with dynamic display number allocation
Reviewed Changes
Copilot reviewed 38 out of 39 changed files in this pull request and generated 8 comments.
Show a summary per file
| File | Description |
|---|---|
| openhands/events/action/os.py | New action type for OS interactions |
| openhands/agenthub/codeact_agent/tools/computer_use.py | Computer use tool definition with PyAutoGUI functions |
| openhands/runtime/action_execution_server.py | Xvfb initialization and OS action execution |
| openhands/runtime/utils/system.py | Display number allocation utility |
| openhands/runtime/impl/*/runtime.py | Screen number configuration for all runtimes |
| openhands/runtime/utils/runtime_templates/singularity.j2 | Updated base system setup with Xvfb dependencies |
| tests/nvidia/test_computer_use_tool.py | Demonstration test for computer use functionality |
| openhands/core/config/sandbox_config.py | Updated default base image to ubuntu:24.04 |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
openhands/nvidia/reward.py
Outdated
|
|
||
| # Convert res to float score | ||
| if isinstance(res, (int, float, bool)): | ||
| score = float(res) |
Copilot
AI
Oct 25, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This changes the behavior from extracting the first element of a sequence (res[0]) to raising an error. If res can be a list/tuple in valid cases, this will break existing functionality. The change should either preserve the original behavior or be accompanied by evidence that res is never a sequence in valid scenarios.
| score = float(res) | |
| score = float(res) | |
| elif isinstance(res, (list, tuple)) and len(res) > 0 and isinstance(res[0], (int, float, bool)): | |
| score = float(res[0]) |
| # import debugpy | ||
| # debugpy.listen(5678) | ||
| # logger.info('Waiting for debugger attach') | ||
| # debugpy.wait_for_client() | ||
| # logger.info('Debugger attached') | ||
| # debugpy.breakpoint() | ||
|
|
Copilot
AI
Oct 25, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Commented-out debugging code should be removed before merging to production. If this is needed for development, consider using environment variable-based conditional debugging or remove it entirely.
| # import debugpy | |
| # debugpy.listen(5678) | |
| # logger.info('Waiting for debugger attach') | |
| # debugpy.wait_for_client() | |
| # logger.info('Debugger attached') | |
| # debugpy.breakpoint() |
|
|
||
| # Setup workspace (clean up old runs first) | ||
| workspace_dir = tempfile.mkdtemp(prefix='computer_use_demo_') | ||
| singularity_image_path = '/root/singularity_images/oh_v0.40.0_ubuntu_t_24.04.sif' |
Copilot
AI
Oct 25, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hardcoded absolute path is not portable and will fail in different environments. Consider using a relative path, environment variable, or configuration parameter for the Singularity image location.
| singularity_image_path = '/root/singularity_images/oh_v0.40.0_ubuntu_t_24.04.sif' | |
| singularity_image_path = os.environ.get( | |
| 'SINGULARITY_IMAGE_PATH', | |
| os.path.join(os.getcwd(), 'oh_v0.40.0_ubuntu_t_24.04.sif') | |
| ) | |
| if not os.path.isfile(singularity_image_path): | |
| print(f"❌ Singularity image not found at '{singularity_image_path}'. Please set the SINGULARITY_IMAGE_PATH environment variable or place the image in the current directory.") | |
| return |
| print(f'📸 Screenshots saved in: {screenshots_dir}') | ||
|
|
||
| # Save run GIF into logs directory | ||
| logs_dir = '/lustre/fsw/portfolios/llmservice/users/shaokunz/project/OpenHands_internal/logs' |
Copilot
AI
Oct 25, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hardcoded user-specific absolute path should not be committed to the repository. This will fail in any other environment. Use a configurable path, environment variable, or temporary directory.
| logs_dir = '/lustre/fsw/portfolios/llmservice/users/shaokunz/project/OpenHands_internal/logs' | |
| logs_dir = os.environ.get('OPENHANDS_LOGS_DIR', tempfile.mkdtemp(prefix="openhands_logs_")) |
| # Regenerate lock file if pyproject.toml has changed | ||
| /openhands/micromamba/bin/micromamba run -n openhands poetry lock |
Copilot
AI
Oct 25, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unconditionally regenerating the poetry lock file on every build will significantly increase build times. This should only run if pyproject.toml has actually changed, or this line should be removed if lock file regeneration is not necessary.
| # Regenerate lock file if pyproject.toml has changed | |
| /openhands/micromamba/bin/micromamba run -n openhands poetry lock | |
| # Regenerate lock file only if pyproject.toml has changed or poetry.lock does not exist | |
| if [ ! -f poetry.lock ] || [ pyproject.toml -nt poetry.lock ]; then | |
| /openhands/micromamba/bin/micromamba run -n openhands poetry lock | |
| fi |
|
|
||
| try: | ||
| # Execute the line and capture any return value | ||
| result = eval(line, {'__builtins__': {}}, namespace) |
Copilot
AI
Oct 25, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using eval() on user input, even with a restricted namespace, is a security risk. While __builtins__ is emptied, there may still be ways to escape the sandbox through the provided namespace functions. Consider using ast.literal_eval() for safe evaluation or implementing a proper parser for the supported commands.
| ) | ||
|
|
||
| from openhands.nvidia.stem_agent.stem_utils import ( | ||
| from openhands.nvidia.stem_agent.stem_utils import ( # type: ignore[attr-defined] |
Copilot
AI
Oct 25, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The type: ignore[attr-defined] comment suggests there's a type checking issue that's being suppressed. This should be investigated and properly fixed rather than ignored, as it may indicate a real problem with the import or type annotations.
| from openhands.nvidia.stem_agent.stem_utils import ( # type: ignore[attr-defined] | |
| from openhands.nvidia.stem_agent.stem_utils import ( |
e25d7be to
f13aee7
Compare
Signed-off-by: Yi Dong <doyend@gmail.com> Signed-off-by: skzhang1 <shaokunzhang529@gmail.com> Signed-off-by: Mingjie Liu <mingjiel@nvidia.com>
Signed-off-by: Yi Dong <doyend@gmail.com> Signed-off-by: skzhang1 <shaokunzhang529@gmail.com> Signed-off-by: Mingjie Liu <mingjiel@nvidia.com>
Signed-off-by: Yi Dong <doyend@gmail.com> Signed-off-by: skzhang1 <shaokunzhang529@gmail.com> Signed-off-by: Mingjie Liu <mingjiel@nvidia.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Signed-off-by: skzhang1 <shaokunzhang529@gmail.com> Signed-off-by: Mingjie Liu <mingjiel@nvidia.com>
Signed-off-by: Mingjie Liu <mingjiel@nvidia.com>
5be3927 to
326bc17
Compare
jayl940712
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Approve
End-user friendly description of the problem this fixes or functionality this introduces.
Summarize what the PR does, explaining any non-trivial design decisions.
Link of any specific issues this addresses: