- Change KeyboardInterrupt handler to continue loop instead of exiting
- Let signal handler manage Ctrl+C behavior completely
- Only exit on explicit /exit command or outer KeyboardInterrupt
This ensures that Ctrl+C during agent processing returns to chat loop
instead of exiting the entire application.
Co-authored-by: openhands <openhands@all-hands.dev>
- Remove os._exit(1) from second Ctrl+C handler
- Reset Ctrl+C counter after force killing process
- Add graceful handling in SimpleProcessRunner for killed processes
- Show user-friendly message that they can continue sending messages
This allows users to stop a running agent and continue with new messages
instead of having to restart the entire CLI application.
Co-authored-by: openhands <openhands@all-hands.dev>
- Pass conversation_id and message_data instead of full objects to subprocess
- Recreate conversation and message objects in the subprocess
- Extract text content from Message objects for serialization
- Store conversation_id as string for subprocess recreation
This fixes the 'cannot pickle _asyncio.Future object' error by avoiding
passing non-serializable objects between processes.
Co-authored-by: openhands <openhands@all-hands.dev>
- Add role='user' to Message constructor in agent_chat.py
- This fixes the validation error when processing user messages
Co-authored-by: openhands <openhands@all-hands.dev>
- Replace incorrect openhands.core.main imports with openhands.sdk
- Use existing ConversationRunner from runner.py instead of run_controller
- Update SimpleProcessRunner to accept BaseConversation instead of setup function
- Update agent_chat.py to create conversation first, then pass to SimpleProcessRunner
- Fix process_message to use proper Message object with TextContent
This ensures the openhands-cli remains standalone and only uses the SDK library
as intended, without importing from the main OpenHands codebase.
Co-authored-by: openhands <openhands@all-hands.dev>
- Replace complex ProcessSignalHandler with SimpleSignalHandler
- Direct signal handling in main process instead of queue communication
- Simple Ctrl+C counting with immediate force kill on second press
- Reset functionality to clear count when starting new operations
- Replace ProcessBasedConversationRunner with SimpleProcessRunner
- Minimal multiprocessing - only process_message runs in subprocess
- Direct method calls for status, settings, and other operations
- No unnecessary queue communication
- Update agent_chat.py to use simplified components
- Reset Ctrl+C count when starting new message processing
- Direct method calls for commands that don't need process isolation
- Cleaner error handling and resource cleanup
- Update simple_main.py imports
Fixes issues where second Ctrl+C wouldn't register properly due to
complex queue-based communication and race conditions.
Co-authored-by: openhands <openhands@all-hands.dev>
- First Ctrl+C attempts graceful pause of agent
- Second Ctrl+C (within 3 seconds) kills process immediately
- Added SignalHandler and ProcessSignalHandler classes for signal management
- Implemented ProcessBasedConversationRunner for separate process execution
- Modified pause_listener to remove Ctrl+C handling (now handled by signal handler)
- Updated agent_chat.py to use process-based runner with new signal management
- Updated simple_main.py to install basic signal handler
- Added comprehensive test script and documentation
Co-authored-by: openhands <openhands@all-hands.dev>