feat: robot serve CLI command#199
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Adds a new physicalai robot CLI group to serve a SharedRobot owner in the foreground and to discover reachable shared-robot owners, while refactoring the existing owner worker into a reusable in-process run_owner() runtime that supports structured exit reasons and operator-facing events.
Changes:
- Introduces
physicalai robot serve(foreground owner) andphysicalai robot discover(sorted human table or JSON array) CLI commands. - Refactors the owner worker into
run_owner()with structuredOwnerResult/OwnerExitReasonandOwnerEventtelemetry (subscriber transitions + heartbeat). - Adds unit + process-level tests plus documentation and an SO101 serve example config.
Reviewed changes
Copilot reviewed 15 out of 15 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/unit/robot/transport/test_owner_worker.py | Adds tests for owner loop termination reasons, events, and disconnect/ready failure handling. |
| tests/unit/robot/transport/test_owner_config.py | Extends config validation tests (name/rate/idle_timeout) and JSON roundtrip for idle_timeout=None. |
| tests/unit/robot/transport/fake.py | Enhances FakeRobot to simulate delayed observation failures and disconnect failure/markers for process tests. |
| tests/unit/cli/test_robot_cli.py | Adds CLI behavior tests for serve/discover output, logging, validation, signals, and a process-level SIGTERM/lock-release test. |
| tests/unit/cli/test_cli.py | Updates builtin command list expectation to include robot. |
| src/physicalai/robot/transport/_owner.py | Retains owner subprocess exit code and adds wait() API for supervising the worker. |
| src/physicalai/robot/transport/_owner_worker.py | Adds run_owner() runtime, structured results/events, idle-timeout disabling, and heartbeat/subscriber event emission. |
| src/physicalai/robot/transport/_owner_config.py | Tightens config validation (finite numeric types, name validation, dotted-path robot class) and allows idle_timeout=None. |
| src/physicalai/robot/transport/init.py | Re-exports owner config/runtime/result/event types from physicalai.robot.transport. |
| src/physicalai/cli/robot.py | Implements physicalai robot serve/discover parsers, foreground serve lifecycle, logging, and discovery formatting. |
| src/physicalai/cli/main.py | Registers robot as a builtin command and adjusts fast-help routing for direct-help-only invocations. |
| examples/so101/serve.yaml | Adds a portable example serve config with placeholders and local-only defaults. |
| docs/reference/cli.md | Documents the new robot serve and robot discover commands and their flags/behavior. |
| docs/how-to/runtime/share-a-robot.md | Adds an operator-focused walkthrough for serving and discovering shared robots. |
| docs/explanation/cli.md | Updates the runtime command list to include robot serve/robot discover. |
| docs/development/robot-serve-plan.md | Adds/updates the design/contract document describing lifecycle invariants and CLI behavior. |
…stale PID false positives
AlexanderBarabanov
approved these changes
Jul 22, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Add CLI for serving and discovering
SharedRobotover IPC or LAN.Robot serve
Robot discover
Why
Allows to connect an use a robot over LAN.
Validation
Breaking changes
Related issues