-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Fix bash timeout issue caused by interactive git clone prompts #9148
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
Conversation
- Add GIT_TERMINAL_PROMPT=0 to prevent git from prompting for credentials - Fix URL formatting in _get_authenticated_git_url to preserve domain - Add tests for _get_authenticated_git_url method This resolves the issue where bash commands would timeout immediately when the system tried to clone non-existent org-level microagent repos and git would hang waiting for user input. Fixes #9147
- Add GIT_TERMINAL_PROMPT=0 to prevent git from prompting for credentials - This resolves the issue where bash commands would timeout immediately when the system tried to clone non-existent org-level microagent repos and git would hang waiting for user input The existing _get_authenticated_git_url method was working correctly. The issue was specifically with the new org-level microagent cloning feature not handling non-interactive git operations properly. Fixes #9147
c2d2ca8 to
dfe5f25
Compare
- Update self.git_provider_tokens in clone_or_init_repo to ensure microagent loading uses the same tokens as main repository cloning - This resolves the issue where org-level microagent repos were cloned without authentication, causing git to prompt for credentials - Keep GIT_TERMINAL_PROMPT=0 as additional safety measure The root cause was that get_microagents_from_org_or_user() was using self.git_provider_tokens (set during initialization) instead of the current tokens passed to clone_or_init_repo(). Fixes #9147
|
@OpenHands |
|
I'm on it! neubig can track my progress at all-hands.dev |
- Remove antipattern from clone_or_init_repo function in base.py - Update all runtime implementations to accept git_provider_tokens parameter: - DockerRuntime: Accept git_provider_tokens, remove user_id (Docker doesn't need it) - LocalRuntime: Accept both user_id and git_provider_tokens - E2BRuntime: Upgrade to inherit from ActionExecutionClient for consistency - ModalRuntime: Accept user_id and git_provider_tokens - DaytonaRuntime: Accept user_id and git_provider_tokens - RunloopRuntime: Accept user_id and git_provider_tokens - Update AgentSession._create_runtime() to pass git_provider_tokens to all runtime types - All runtime implementations now consistently support git_provider_tokens This fixes the issue where git_provider_tokens were not available at runtime initialization for repo microagents, eliminating the need for the antipattern assignment in clone_or_init_repo.
a465dd0 to
9fb63ec
Compare
SummaryI successfully identified and fixed the antipattern in the Root Cause AnalysisThe antipattern
Solution Implemented✅ Removed the antipattern from ✅ Updated all runtime constructors to accept
✅ Updated AgentSession._create_runtime() to pass ✅ Added comprehensive test coverage in Benefits
Verification
The fix addresses the core issue: git_provider_tokens are now properly available at runtime initialization time for all runtime types, eliminating the need for the antipattern workaround. |
All other runtime implementations accept user_id parameter, so DockerRuntime should also accept it for consistency, even though Docker doesn't use it.
…ll-Hands-AI/OpenHands into fix/bash-timeout-interactive-git-clone
|
I think the root cause is indeed the git clone waiting for credentials, below is the log of the last command (before agent's commands) I see inside the runtime: 12:01:07 - openhands:DEBUG: bash.py:602 - END OF PANE CONTENT: [' "exit_code": "0",', ' "username": "openhands",', ' "hostname": "hoang-dev",', ' "working_dir": "/workspace/starter-repo",', ' "py_interpreter_path": "/openhands/poetry/openhands-ai-5O4_aCHf-py3.12/bin/python"', '}', '###PS1END###', 'git clone --depth 1 https://github.com/ryanhoangt/.openhands.git /workspace/org_openhands_ryanhoangt', "Cloning into '/workspace/org_openhands_ryanhoangt'...", "Username for 'https://github.com':"] 12:01:07 - openhands:DEBUG: bash.py:632 - CHECKING NO CHANGE TIMEOUT (10s): elapsed 10.100644588470459. Action blocking: False One thing I don't quite understand yet is that it only happens for the forked |
End-user friendly description of the problem this fixes or functionality this introduces.
Fixes an issue where bash commands would timeout immediately on first run due to git clone operations hanging while waiting for user credentials.
Summarize what the PR does, explaining any non-trivial design decisions.
This PR addresses a critical issue where the system would hang when trying to clone organization-level microagent repositories that don't exist or require authentication. There were two main problems:
With these changes, code that previously timed out no longer does, so this is confirmed to work locally.
Link of any specific issues this addresses:
Fixes #9147
@neubig can click here to continue refining the PR
To run this PR locally, use the following command: