Add Windows terminal backend support#1012
Add Windows terminal backend support#1012SmartManoj wants to merge 100 commits intoOpenHands:mainfrom
Conversation
Introduces WindowsTerminal for PowerShell-based command execution on Windows systems. Updates factory and init logic to conditionally import and use platform-specific terminal backends, ensuring compatibility across Windows and Unix-like platforms.
xingyaoww
left a comment
There was a problem hiding this comment.
I wonder if we should rename the tool execute_bash into execute_terminal because of the powershell here? 🤔
And we tell the agent if it is using powershell vs bash. But we can do this in subsequent pr
Simplifies the code by unconditionally importing fcntl and pty, removing the platform-specific logic and dummy assignments for Windows. This module is intended for Unix-like systems only.
Deleted scripts/demo.py as it is no longer needed. The demo script previously demonstrated basic usage of the OpenHands SDK and agent setup.
Eliminated an erroneous 'n' character from the import block in terminal_session.py to clean up the code and prevent potential syntax errors.
Changed assertions in test_windows_terminal_close_and_reopen to check 'obs.text' instead of 'obs.output' for command results. This aligns the test with the updated observation object structure.
|
@SmartManoj can you resolve merge conflicts/ |
Update the terminal module's __init__.py to conditionally import WindowsTerminal on Windows and SubprocessTerminal/TmuxTerminal on other platforms. This change ensures only relevant terminal classes are exposed based on the operating system.
Removed the deprecated execute_bash.terminal package and updated all relevant imports to use the new openhands.tools.terminal.terminal structure. This change consolidates terminal-related code under a single module for improved maintainability and clarity.
|
[Automatic Post]: This PR seems to be currently waiting for review. @ryanhoangt, could you please take a look when you have a chance? |
ryanhoangt
left a comment
There was a problem hiding this comment.
Thank you for the PR. When testing the PR on the examples/01_hello_world.py and adjusting the message to something like "Please check the current directory, list all files and then exit.", I saw it first attempted to run a bash command with &&, which failed in PowerShell. However, it didn't fail instantly, it got stuck in soft timeout observation loop and the agent decided to reset the terminal. Do you have any ideas why it happened?
Does this tool description need to be updated? |
Yes we should either phrase it so the description is general enough, OR we should implement a switch (i.e., only change the description if windows is selected as the terminal implementation) |
Introduces TOOL_DESCRIPTION_FOR_WINDOWS for PowerShell commands and updates TerminalTool to select the appropriate description based on the platform. This improves clarity and guidance for users on both Unix and Windows systems.
|
I'll take reviewing on this one since I'll have a windows machine soon. |
|
[Automatic Post]: It has been a while since there was any activity on this PR. @SmartManoj, are you still working on it? If so, please go ahead, if not then please request review, close it, or request that someone else follow up. |
|
I should get my windows laptop around today, will check once I do. |
|
[Automatic Post]: It has been a while since there was any activity on this PR. @SmartManoj, are you still working on it? If so, please go ahead, if not then please request review, close it, or request that someone else follow up. |
|
My laptop was delivered yesterday, will need to set it up and then will test. |
|
[Automatic Post]: It has been a while since there was any activity on this PR. @SmartManoj, are you still working on it? If so, please go ahead, if not then please request review, close it, or request that someone else follow up. |
|
[Automatic Post]: It has been a while since there was any activity on this PR. @SmartManoj, are you still working on it? If so, please go ahead, if not then please request review, close it, or request that someone else follow up. |
neubig
left a comment
There was a problem hiding this comment.
Overall this looks pretty good and well structured, thanks for this! I had a few comments, and one very big one is that the browser implementation for windows seems to be missing. I'll test it once I can get that.
It was added in a separate PR #1014 |
|
[Automatic Post]: It has been a while since there was any activity on this PR. @SmartManoj, are you still working on it? If so, please go ahead, if not then please request review, close it, or request that someone else follow up. |
1 similar comment
|
[Automatic Post]: It has been a while since there was any activity on this PR. @SmartManoj, are you still working on it? If so, please go ahead, if not then please request review, close it, or request that someone else follow up. |
|
Sorry, this is on me now, re-requesting review. |
|
[Automatic Post]: It has been a while since there was any activity on this PR. @SmartManoj, are you still working on it? If so, please go ahead, if not then please request review, close it, or request that someone else follow up. |
|
@OpenHands fix merge conflicts |
|
I'm on it! neubig can track my progress at all-hands.dev |
Resolve merge conflicts in: - openhands-agent-server/openhands/agent_server/agent-server.spec - openhands-tools/openhands/tools/browser_use/impl.py Kept both Windows terminal support changes and new main features (delegate templates, browser JS recording files, recording_aware decorator). Co-authored-by: openhands <openhands@all-hands.dev>
SummaryI successfully resolved the merge conflicts in PR #1012 "Add Windows terminal backend support". Conflicts Resolved1.
2.
Verification
CommitThe PR's |
The type annotation was using BrowserToolExecutor (a runtime variable from get_browser_executor_class()) instead of BrowserToolExecutorType (the type alias from TYPE_CHECKING block). Co-authored-by: openhands <openhands@all-hands.dev>


Introduces
WindowsTerminalfor PowerShell-based command execution on Windows systems. Updatesfactoryandinitlogic to conditionally import and use platform-specific terminal backends, ensuring compatibility across Windows and Unix-like platforms.