-
Notifications
You must be signed in to change notification settings - Fork 37
Feat: support real-time cloud conversation in local TUI #369
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: main
Are you sure you want to change the base?
Conversation
- Add openhands-workspace==1.8.2 dependency to pyproject.toml - Add cloud and server_url parameters to OpenHandsApp - Modify entrypoint to launch TUI with cloud=True for 'openhands cloud' command - Create setup_cloud_conversation() that uses OpenHandsCloudWorkspace and RemoteConversation - Update ConversationRunner to accept and pass cloud parameters Co-authored-by: openhands <openhands@all-hands.dev>
Use cloud_api_url and cloud_api_key instead of server_url and conversation_id Co-authored-by: openhands <openhands@all-hands.dev>
- Merge main into branch - Add ConversationStateUpdateEvent to imports in richlog_visualizer.py - Add checks to ignore ConversationStateUpdateEvent in _create_event_widget and _create_event_collapsible - Fix setup.py to use TokenStorage directly instead of removed require_api_key Co-authored-by: openhands <openhands@all-hands.dev>
- Add on_conversation_ready callback to ConversationVisualizer - Detect ConversationStateUpdateEvent in visualizer to signal cloud conversation is ready - Show 'Setting up cloud conversation...' indicator when starting cloud mode - Replace indicator with 'Cloud conversation ready!' message when ready - Block user input until cloud conversation is ready with warning notification Co-authored-by: openhands <openhands@all-hands.dev>
- Add test_cloud_setup_indicator: Shows 'Setting up cloud conversation...' message - Add test_cloud_ready_indicator: Shows 'Cloud conversation ready!' message Co-authored-by: openhands <openhands@all-hands.dev>
- Add get_conversation_info method to OpenHandsApiClient to fetch sandbox_id - Add sandbox_id parameter throughout the cloud conversation setup chain - Add _ensure_workspace_alive method to ConversationRunner to check/restart workspace - Add resume argument (-r/--resume) to cloud command parser - Add _fetch_cloud_sandbox_id helper to entrypoint for fetching sandbox info - Pass sandbox_id to OpenHandsCloudWorkspace to reclaim existing sandbox Co-authored-by: openhands <openhands@all-hands.dev>
- Move _fetch_cloud_sandbox_id from entrypoint.py to textual_app.py - Rename to fetch_cloud_sandbox_id (public async function) - Use ensure_valid_auth from auth.utils to handle authentication (dedup) - Fetch sandbox_id inside main() instead of entrypoint - Handle None return from main() in entrypoint Co-authored-by: openhands <openhands@all-hands.dev>
- Create openhands_cli/cloud/utils.py with fetch_cloud_sandbox_id - Create openhands_cli/cloud/__init__.py to export the function - Simplify fetch_cloud_sandbox_id to return str | None (no exceptions) - Move imports to top of textual_app.py - Update main() to exit early when sandbox_id is None Co-authored-by: openhands <openhands@all-hands.dev>
- Create CloudSetupIndicator widget with Braille spinner animation - Update _show_cloud_setup_indicator to use the new widget - Spinner animates at 100ms intervals showing process is running Co-authored-by: openhands <openhands@all-hands.dev>
- Add CloudSetupIndicator import to test file - Use CloudSetupIndicator widget in test instead of Static - Yield indicator in compose instead of mounting in on_mount - Fix CloudSetupIndicator to use markup=True and height:auto - Initialize widget with visible text immediately Co-authored-by: openhands <openhands@all-hands.dev>
RemoteConversation gets its HTTP client from workspace.client, which is already configured with the correct host and api_key after the sandbox starts. Passing host and api_key directly was causing them to be ignored. Co-authored-by: openhands <openhands@all-hands.dev>
The cloud setup indicator was showing immediately on app launch when in cloud mode. Now it only appears after the user submits their first message, right before the conversation runner creates the cloud sandbox. Co-authored-by: openhands <openhands@all-hands.dev>
The conversation runner creation was blocking the UI, preventing notifications and the cloud setup indicator from appearing until after the cloud sandbox was already set up. Now the runner creation runs in a background worker using run_in_executor, allowing the UI to remain responsive and show the setup indicator animation. Co-authored-by: openhands <openhands@all-hands.dev>
Coverage Report •
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| If None, defaults to AlwaysConfirm. | ||
| cloud: If True, use OpenHands Cloud for remote execution. | ||
| server_url: The OpenHands Cloud server URL (used when cloud=True). | ||
| sandbox_id: Optional sandbox ID to reclaim an existing sandbox. |
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.
Just a quick thought in passing: I wonder if we'll be happier if we make separate classes for remote conversation runner, and maybe for some other classes too. Some things are not the same, and my quick guess is that maybe it'll be easier to read/maintain/debug/not-make-bugs(tm) 😅
Summary
This PR adds support for the
openhands-workspacepackage and enables cloud mode in the TUI when runningopenhands cloud.Changes
1. Added
openhands-workspacedependencyopenhands-workspace==1.8.2topyproject.tomlalongsideopenhands-sdkandopenhands-tools2. Added cloud parameters to
OpenHandsAppcloud: bool = Falseandserver_url: str | None = Noneparameters toOpenHandsApp.__init__main()function3. Modified entrypoint for cloud command
openhands cloudcommand to launch the TUI withcloud=Trueinstead of the previous headless behaviorserver_urlfrom args to the TUI4. Create
RemoteConversationin cloud modecloudandserver_urlparameters tosetup_conversation()setup_cloud_conversation()function that:OpenHandsCloudWorkspacefromopenhands.workspacerequire_api_key()from cloud conversation moduleOpenHandsCloudWorkspaceinstanceRemoteConversationinstead of localConversationFiles Changed
pyproject.toml- Added openhands-workspace dependencyopenhands_cli/entrypoint.py- Updated cloud command handlingopenhands_cli/setup.py- Added cloud conversation setupopenhands_cli/tui/core/conversation_runner.py- Added cloud parametersopenhands_cli/tui/textual_app.py- Added cloud parameters to app and main function@malhotra5 can click here to continue refining the PR
🚀 Try this PR