Skip to content

Add Windows terminal backend support#1012

Open
SmartManoj wants to merge 100 commits intoOpenHands:mainfrom
SmartManoj:terminal
Open

Add Windows terminal backend support#1012
SmartManoj wants to merge 100 commits intoOpenHands:mainfrom
SmartManoj:terminal

Conversation

@SmartManoj
Copy link
Contributor

@SmartManoj SmartManoj commented Nov 4, 2025

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.

image

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 xingyaoww requested a review from ryanhoangt November 4, 2025 15:42
Copy link
Collaborator

@xingyaoww xingyaoww left a comment

Choose a reason for hiding this comment

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

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.
@SmartManoj
Copy link
Contributor Author

image

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.
@xingyaoww
Copy link
Collaborator

@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.
@blacksmith-sh
Copy link
Contributor

blacksmith-sh bot commented Nov 10, 2025

[Automatic Post]: This PR seems to be currently waiting for review. @ryanhoangt, could you please take a look when you have a chance?

@SmartManoj SmartManoj requested a review from xingyaoww November 15, 2025 11:12
Copy link
Collaborator

@ryanhoangt ryanhoangt 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 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?

@SmartManoj
Copy link
Contributor Author

SmartManoj commented Nov 17, 2025

I saw it first attempted to run a bash command

Does this tool description need to be updated?

TOOL_DESCRIPTION = """Execute a bash command in the terminal within a persistent shell session.

@xingyaoww
Copy link
Collaborator

@SmartManoj

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.
@SmartManoj
Copy link
Contributor Author

image

@ryanhoangt ryanhoangt self-requested a review November 18, 2025 14:36
@neubig neubig self-requested a review January 8, 2026 12:47
@neubig
Copy link
Contributor

neubig commented Jan 8, 2026

I'll take reviewing on this one since I'll have a windows machine soon.

@all-hands-bot
Copy link
Collaborator

[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
Copy link
Contributor

neubig commented Jan 15, 2026

I should get my windows laptop around today, will check once I do.

@all-hands-bot
Copy link
Collaborator

[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
Copy link
Contributor

neubig commented Jan 21, 2026

My laptop was delivered yesterday, will need to set it up and then will test.

@all-hands-bot
Copy link
Collaborator

[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.

@all-hands-bot
Copy link
Collaborator

[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.

Copy link
Contributor

@neubig neubig left a comment

Choose a reason for hiding this comment

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

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.

@SmartManoj
Copy link
Contributor Author

and one very big one is that the browser implementation for windows seems to be missing

It was added in a separate PR #1014

@all-hands-bot
Copy link
Collaborator

[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
@all-hands-bot
Copy link
Collaborator

[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
Copy link
Contributor

neubig commented Feb 10, 2026

Sorry, this is on me now, re-requesting review.

@neubig neubig self-requested a review February 10, 2026 16:06
@all-hands-bot
Copy link
Collaborator

[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
Copy link
Contributor

neubig commented Feb 16, 2026

@OpenHands fix merge conflicts

@openhands-ai
Copy link

openhands-ai bot commented Feb 16, 2026

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>
@openhands-ai
Copy link

openhands-ai bot commented Feb 16, 2026

Summary

I successfully resolved the merge conflicts in PR #1012 "Add Windows terminal backend support".

Conflicts Resolved

1. openhands-agent-server/openhands/agent_server/agent-server.spec

  • Combined Windows terminal templates from the PR with new additions from main (delegate templates and browser JS recording files)

2. openhands-tools/openhands/tools/browser_use/impl.py

  • Kept the sys import and get_browser_executor_class() factory function from the PR
  • Added the new imports (Callable, Coroutine) and recording_aware decorator from main

Verification

  • ✅ Pre-commit hooks pass (ruff format, ruff lint, pycodestyle, pyright, import dependency rules, tool registration check)
  • ✅ Changes pushed to SmartManoj's fork
  • ✅ PR is now MERGEABLE (no more conflicts)

Commit

Merge origin/main into terminal

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).

The PR's BLOCKED status is due to CI checks that need to run, not merge conflicts.

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>
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.

7 participants

Comments