Skip to content

feat(hosted-teleop): auto-select operator cockpit from robot kind#3120

Open
ruthwikdasyam wants to merge 5 commits into
mainfrom
ruthwik/hosted/fix/robot_type
Open

feat(hosted-teleop): auto-select operator cockpit from robot kind#3120
ruthwikdasyam wants to merge 5 commits into
mainfrom
ruthwik/hosted/fix/robot_type

Conversation

@ruthwikdasyam

@ruthwikdasyam ruthwikdasyam commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

Contribution path

  • Small, safe change that does not need a tracking issue
  • Linked issue or discussion: DIM-XXX / #XXX / URL

Problem

The hosted operator UI required a manual Go2/Arm toggle before connecting - nothing on the robot side told the broker which cockpit to open, so an operator could connect an arm and land on the Go2 view.

Solution

Each hosted command module declares its cockpit kind and pushes it to the broker at init

  • robot_type.py - a StrEnum of cockpit kinds (go2, arm); the value is the wire string. Kept in the app layer, not the transport (BrokerConfig stays a plain str), so the generic provider doesn't depend on this enum.

  • CommandModule declare ROBOT_TYPE and call BrokerProvider.set_robot_type() at init.

  • the session POST sends the declared kind; no silent default (raises if undeclared), and re-declaring a conflicting kind raises (two command modules in one process would open the wrong cockpit).

How to Test

dimos run teleop-hosted-go2-transport

Connect from the operator dashboard — the arm cockpit opens without the manual toggle. (teleop-hosted-xarm7 opens the arm cockpit the same way.)

AI assistance

Claude Code (Fable 5 / Opus 4.8) - used for research, refactoring, review

Checklist

  • I have read and approved the CLA.

Command modules declare ROBOT_TYPE and push it to the broker provider at init (set_robot_type); the session-create POST carries it so the operator dashboard opens the right cockpit. No core coordination changes.
@ruthwikdasyam
ruthwikdasyam force-pushed the ruthwik/hosted/fix/robot_type branch from 5292eb7 to 032e679 Compare July 21, 2026 20:53
@codecov

codecov Bot commented Jul 21, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ All tests successful. No failed tests found.

@@            Coverage Diff             @@
##             main    #3120      +/-   ##
==========================================
+ Coverage   73.23%   73.32%   +0.09%     
==========================================
  Files        1037     1037              
  Lines       93895    94281     +386     
  Branches     8528     8638     +110     
==========================================
+ Hits        68761    69132     +371     
- Misses      22792    22800       +8     
- Partials     2342     2349       +7     
Flag Coverage Δ
OS-ubuntu-24.04-arm 66.15% <100.00%> (-0.19%) ⬇️
OS-ubuntu-latest 68.72% <100.00%> (+0.10%) ⬆️
Py-3.10 68.72% <100.00%> (+0.11%) ⬆️
Py-3.11 68.72% <100.00%> (+0.11%) ⬆️
Py-3.12 68.72% <100.00%> (+0.10%) ⬆️
Py-3.13 68.71% <100.00%> (+0.10%) ⬆️
Py-3.14 68.72% <100.00%> (+0.10%) ⬆️
Py-3.14t 68.71% <100.00%> (+0.10%) ⬆️
SelfHosted-Large 30.04% <60.00%> (-0.06%) ⬇️
SelfHosted-Linux 37.08% <60.00%> (-0.08%) ⬇️
SelfHosted-macOS 35.99% <60.00%> (-0.07%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
...os/protocol/pubsub/impl/webrtc/providers/broker.py 36.03% <100.00%> (+0.19%) ⬆️
dimos/teleop/hosted/blueprints/cloudflare.py 100.00% <ø> (ø)
dimos/teleop/hosted/test_go2_command.py 99.46% <100.00%> (+0.01%) ⬆️

... and 8 files with indirect coverage changes

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@ruthwikdasyam ruthwikdasyam changed the title Ruthwik/hosted/fix/robot type feat(hosted-teleop): auto-select operator cockpit from robot kind Jul 21, 2026
@ruthwikdasyam ruthwikdasyam added the backport:skip Skip creating a backport to any release branches label Jul 21, 2026
@ruthwikdasyam
ruthwikdasyam marked this pull request as ready for review July 21, 2026 21:40
@ruthwikdasyam
ruthwikdasyam marked this pull request as draft July 21, 2026 21:40
@github-actions github-actions Bot added ready-to-merge Required CI checks have passed on this PR and removed ready-to-merge Required CI checks have passed on this PR labels Jul 21, 2026
@greptile-apps

greptile-apps Bot commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR adds broker-configured cockpit selection for hosted teleoperation. The main changes are:

  • Adds an optional robot_type field to broker configuration.
  • Includes the configured robot type in session requests.
  • Documents the environment setting for Go2 and arm cockpits.
  • Adds coverage for the new configuration field.

Confidence Score: 5/5

No additional blocking issue was found in this review.

  • The updated broker configuration keeps robot type optional for standalone transports.
  • No new distinct production failure remains to report.

Important Files Changed

Filename Overview
dimos/protocol/pubsub/impl/webrtc/providers/broker.py Adds optional robot-type configuration and conditionally includes it in broker session requests.
dimos/teleop/hosted/blueprints/cloudflare.py Documents how hosted teleop deployments select the Go2 or arm cockpit.
dimos/teleop/hosted/test_go2_command.py Verifies the default and explicitly configured robot-type values.
default.env Adds the optional broker robot-type environment setting.

Reviews (3): Last reviewed commit: "hosted teleop: robot_type as a BrokerCon..." | Re-trigger Greptile

Comment thread dimos/teleop/hosted/robot_type.py Outdated
Comment thread dimos/protocol/pubsub/impl/webrtc/providers/broker.py Outdated
Comment thread dimos/protocol/pubsub/impl/webrtc/providers/broker.py Outdated
@ruthwikdasyam
ruthwikdasyam marked this pull request as ready for review July 21, 2026 23:35
Comment thread dimos/teleop/hosted/test_arm_command.py Outdated
def test_init_declares_robot_type_to_broker(module: ArmCommandModule) -> None:
"""__init__ pushes ROBOT_TYPE to the shared broker provider, which sends it
in the session-create POST so the operator dashboard opens the arm cockpit."""
from dimos.protocol.pubsub.impl.webrtc.providers.broker import BrokerProvider

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

already imported.

@classmethod
def set_robot_type(cls, robot_type: str) -> None:
"""Declare the robot kind sent to the broker at session create, so the
operator UI auto-selects the cockpit. Called by the hosted command module

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Wait, you're calling it the cockpit too? I picked that name we don't confuse the two systems 😅 (hence why I renamed the broker to "relay")

Comment thread dimos/teleop/hosted/arm_command.py Outdated

def __init__(self, **kwargs: Any) -> None:
super().__init__(**kwargs)
BrokerProvider.set_robot_type(self.ROBOT_TYPE)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Hm, I don't like how initializing this class modifies a global in BrokerProvider.

# Robot kind for the create-session POST, declared by the command module at
# init (one session + one kind per process). No default: _require_robot_type
# raises rather than guess.
_robot_type: ClassVar[str | None] = None

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I don't like using class variables since they're essentially namespaced globals. They might be justifiable in normal Python, but with the way we use processes for Python modules it will probably lead to issues.

@github-actions github-actions Bot added the ready-to-merge Required CI checks have passed on this PR label Jul 22, 2026
@github-actions github-actions Bot added ready-to-merge Required CI checks have passed on this PR and removed ready-to-merge Required CI checks have passed on this PR labels Jul 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport:skip Skip creating a backport to any release branches ready-to-merge Required CI checks have passed on this PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants