Skip to content

Add greeting conversation mode and state management#1868

Merged
openminddev merged 12 commits intomainfrom
greeting
Jan 27, 2026
Merged

Add greeting conversation mode and state management#1868
openminddev merged 12 commits intomainfrom
greeting

Conversation

@openminddev
Copy link
Copy Markdown
Contributor

@openminddev openminddev commented Jan 24, 2026

This pull request introduces a new greeting conversation system for the Unitree Go2 robot, including its configuration, interface, and connector logic. It also refactors the base action connector and all action connectors to support interruptible sleep via a stop event, improving responsiveness and graceful shutdown across the codebase.

Greeting Conversation System Implementation

  • Added a new configuration file config/greeting.json5 that defines modes, transition rules, and system prompts for the robot's greeting and approaching behaviors.
  • Implemented the GreetingConversationConnector in src/actions/greeting_conversation/connector/greeting_conversation.py, which manages conversation state, integrates ElevenLabs TTS, and updates context when conversations finish.
  • Added a dedicated interface and state enum for greeting conversations in src/actions/greeting_conversation/interface.py, supporting structured input/output and conversation state tracking.

Action Connector Refactor for Interruptible Sleep

  • Refactored ActionConnector in src/actions/base.py to support a thread-safe stop event, with new set_stop_event, should_stop, and sleep methods, allowing connectors to interrupt sleep when signaled. All tick methods now use self.sleep instead of time.sleep. [1] [2] [3]
  • Updated all action connectors to use the new interruptible sleep mechanism in their tick methods, improving shutdown responsiveness and consistency. [1] [2] [3] [4] [5] [6] [7] [8] [9]

Codebase Cleanup

  • Removed unused imports of time from files where sleep is now handled by the base connector. [1] [2] [3] [4] [5] [6] [7] [8]

Introduces a new 'greeting' mode with configuration, connector, and interface for robot-user greeting conversations. Adds a state machine provider for managing conversation states and confidence-based transitions. Updates orchestrator, background, and manager logic to support context-aware mode switching and background task interruption. Refactors function schema and IO provider for improved input handling.
Copilot AI review requested due to automatic review settings January 24, 2026 18:56
@openminddev openminddev requested review from a team as code owners January 24, 2026 18:56
@github-actions github-actions Bot added robotics Robotics code changes python Python code config Configuration files labels Jan 24, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR introduces a greeting conversation mode with state management capabilities to handle multi-stage human-robot interactions. The changes enable the robot to autonomously transition between approaching and greeting modes based on context, while managing conversation states (idle, approaching, engaging, conversing, concluding, finished) with confidence-based decision making.

Changes:

  • Added state machine provider for managing greeting conversation lifecycle with confidence-based transitions
  • Implemented context-aware mode transitions triggered by user context updates
  • Enhanced background task orchestration with proper stop event management and interruptible sleep
  • Refactored action parameter handling to support complex JSON objects and enum types

Reviewed changes

Copilot reviewed 15 out of 15 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
src/runtime/multi_mode/manager.py Added async context transition checking when user context updates
src/runtime/multi_mode/hook.py Updated lifecycle hooks to properly initialize TTS provider with configuration
src/runtime/multi_mode/cortex.py Added orchestrator cleanup and user context reset during mode initialization
src/providers/io_provider.py Added get_input method for retrieving input objects by key
src/providers/greeting_conversation_state_provider.py New state machine provider for managing conversation states and transitions
src/llm/function_schemas.py Refactored action value extraction logic for better parameter handling
src/backgrounds/plugins/rf_mapper.py Changed time.sleep to use interruptible self.sleep method
src/backgrounds/plugins/approaching_mock.py New mock background task simulating approach detection
src/backgrounds/plugins/agent_teleops_status.py Changed time.sleep to use interruptible self.sleep method
src/backgrounds/orchestrator.py Added stop event propagation to background tasks
src/backgrounds/base.py Added stop event support and interruptible sleep mechanism
src/actions/orchestrator.py Enhanced parameter parsing to handle JSON objects and type conversions
src/actions/greeting_conversation/interface.py New interface definition for greeting conversation action
src/actions/greeting_conversation/connector/greeting_conversation.py New connector implementing greeting conversation state management
config/greeting.json5 New configuration file defining approaching and greeting modes

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/providers/greeting_conversation_state_provider.py Outdated
Comment thread src/providers/greeting_conversation_state_provider.py Outdated
Comment thread src/providers/greeting_conversation_state_provider.py Outdated
Replaces print statements with logging in GreetingConversationStateMachineProvider and adds a warning log in ActionOrchestrator when parameters are not found in input type hints. Extends test coverage in test_orchestrator.py to verify LLM result parsing and parameter handling, including type conversions and ignored parameters.
@github-actions github-actions Bot added the tests Test files label Jan 24, 2026
Introduced a stop event mechanism to ActionConnector and Simulator classes, allowing for cooperative interruption of sleep and tick loops. Replaced direct time.sleep calls with a new sleep method that checks for stop signals, and updated orchestrators to set stop events for managed connectors and simulators. This improves graceful shutdown and responsiveness to stop requests across actions and simulators.
Copilot AI review requested due to automatic review settings January 24, 2026 19:21
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 28 out of 28 changed files in this pull request and generated 7 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/providers/greeting_conversation_state_provider.py Outdated
Comment thread src/providers/greeting_conversation_state_provider.py Outdated
Comment thread src/actions/greeting_conversation/connector/greeting_conversation.py Outdated
Comment thread src/providers/greeting_conversation_state_provider.py
Comment thread src/providers/greeting_conversation_state_provider.py
Comment thread src/providers/greeting_conversation_state_provider.py
Introduce comprehensive tests for sleep and stop event logic in actions, backgrounds, and simulators. These tests cover normal sleep, sleep interrupted by stop events, immediate return when already stopped, and should_stop behavior with and without events.
Comprehensive tests were added for the convert_function_calls_to_actions function, covering various scenarios such as single and multiple parameters, different parameter names, empty and invalid arguments, missing fields, numeric and boolean values, null handling, fallback priorities, exception handling, and complex nested structures.
Copilot AI review requested due to automatic review settings January 25, 2026 21:49
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 32 out of 32 changed files in this pull request and generated 5 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/providers/greeting_conversation_state_provider.py Outdated
Comment thread src/providers/greeting_conversation_state_provider.py Outdated
Comment thread src/providers/greeting_conversation_state_provider.py Outdated
Comment thread src/actions/greeting_conversation/connector/greeting_conversation.py Outdated
Introduces Pydantic-based configuration classes for all hook handlers, replacing generic dict configs with strongly-typed models. Updates handler constructors and test cases to use these config models, improving type safety and validation. The create_hook_handler factory now instantiates config models from dicts, and tests are updated for the new structure.
This commit adds comprehensive tests for the ModeManager's context-aware transition logic and context update handling. It covers scenarios for transition triggering, cooldowns, error handling, logging, merging context data, and end-to-end context update flows.
Copilot AI review requested due to automatic review settings January 25, 2026 22:13
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 34 out of 34 changed files in this pull request and generated 6 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/runtime/multi_mode/hook.py
Comment thread src/runtime/multi_mode/hook.py
Comment thread src/runtime/multi_mode/hook.py
Comment thread src/runtime/multi_mode/hook.py
Comment thread src/providers/greeting_conversation_state_provider.py Outdated
openminddev and others added 2 commits January 25, 2026 15:58
Replaced ApproachingMock with ApproachingPerson for approaching mode, updating config and background plugin. Enhanced conversation state transitions in GreetingConversationStateMachineProvider to better handle LLM-driven conclusions and engagement. Improved lifecycle hook parsing to inject API keys, adjusted sleep ticker error handling, and refined TTS duration estimation. Minor logging and test cleanups included.
Added comprehensive unit tests for MoveUnitreeSDKConnector, MoveUnitreeSDKAdvanceConnector, and GreetingConversationStateMachineProvider. These tests cover initialization, movement processing, error handling, and confidence calculation logic, improving test coverage and reliability of the movement and conversation state components.
Introduces an autouse pytest fixture to reset the GreetingConversationStateMachineProvider singleton before and after each test for isolation. Also updates an assertion to expect the CONCLUDING state instead of CONVERSING in the relevant test.
@openminddev openminddev merged commit 36a242a into main Jan 27, 2026
7 checks passed
@openminddev openminddev deleted the greeting branch January 27, 2026 01:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

config Configuration files python Python code robotics Robotics code changes tests Test files

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants