Skip to content

feat(go2): add read-only local Wi-Fi diagnostics#2378

Open
kezaer wants to merge 2 commits into
dimensionalOS:mainfrom
kezaer:feat/go2-doctor
Open

feat(go2): add read-only local Wi-Fi diagnostics#2378
kezaer wants to merge 2 commits into
dimensionalOS:mainfrom
kezaer:feat/go2-doctor

Conversation

@kezaer

@kezaer kezaer commented Jun 6, 2026

Copy link
Copy Markdown

Summary

  • Add dimos go2tool doctor for read-only Go2 local Wi-Fi teleop diagnostics.
  • Report robot discovery, signal probe state, local interfaces, active DimOS run state, expected UI listeners, suggested LAN URLs, and optional passive color_image receipt.
  • Support JSON output, strict mode, custom UI ports, custom image topics, and signal/image timeouts.
  • Treat a failed signal-port probe as a warning when live image data proves the WebRTC data plane is active.

Why

Go2 local Wi-Fi failures often look the same from the browser: stale robot IPs, stale operator-machine IPs, loopback-only listeners, missing video, and dead WebRTC sessions all produce blank or unreachable UI states. The doctor gives operators a no-motion way to identify which layer is actually broken.

Safety

  • The doctor is read-only and sends no movement commands.
  • It is a troubleshooting helper, not part of benchmark success scoring or startup control flow.

Validation

  • uv run pytest dimos/robot/unitree/go2/cli/test_doctor.py -q
  • uv run ruff check dimos/robot/unitree/go2/cli/go2tool.py dimos/robot/unitree/go2/cli/doctor.py dimos/robot/unitree/go2/cli/test_doctor.py
  • Live smoke: dimos go2tool doctor --robot-ip <go2_ip> --no-discover --connect-timeout 0.8 --check-image --image-timeout 1.0 against a running teleop-phone-go2 stack.

No robot motion commands were sent during validation.

@greptile-apps

greptile-apps Bot commented Jun 6, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR adds dimos go2tool doctor, a read-only diagnostic command for local Wi-Fi Go2 teleop setups. It introduces doctor.py (robot signal probing, interface enumeration, TCP listener detection with psutil+lsof fallback, passive image receipt) and wires it into go2tool.py with flags for JSON output, strict mode, custom ports, and image topic overrides.

  • doctor.py: Two-tier TCP listener detection (psutil first, lsof fill-in for any missing required ports) with LAN-vs-loopback classification; signal-probe FAIL is downgraded to WARN when a live color_image frame proves the WebRTC data plane is active.
  • go2tool.py: New doctor sub-command that resolves robot IP from the CLI flag, parent context, or global_config, then delegates to collect_report and exits non-zero under --strict when any WARN/FAIL is present.
  • test_doctor.py: Ten unit tests covering discovery, port classification, lsof merge/skip logic, image-subscription cleanup, runtime-evidence adjustment, and URL suggestion.

Confidence Score: 5/5

Safe to merge — the change is entirely additive (new CLI sub-command + tests), sends no robot commands, and all execution paths terminate cleanly.

All three files are new additions with no modifications to existing logic. The diagnostics are read-only, the two-tier TCP listener fallback is well-guarded, and the runtime-evidence adjustment is straightforward. The one cosmetic message inaccuracy does not affect correctness or safety.

No files require special attention.

Important Files Changed

Filename Overview
dimos/robot/unitree/go2/cli/doctor.py New 670-line diagnostics module: robot probe, local-interface enumeration, TCP listener detection (psutil + lsof fallback with partial-results merge), port LAN-accessibility classification, passive image subscription check, and report formatting. One minor message accuracy issue when LAN discovery is explicitly disabled; all logic and edge-case handling is otherwise sound.
dimos/robot/unitree/go2/cli/go2tool.py Adds the doctor subcommand to the existing go2tool Typer app; wires CLI flags (robot-ip, discover/no-discover, timeouts, ui-port overrides, check-image, strict) to collect_report. IP/port resolution logic is correct and the strict/JSON output paths look clean.
dimos/robot/unitree/go2/cli/test_doctor.py Ten focused unit tests covering discovery, port classification, lsof merging/skipping, image subscription cleanup, robot-check adjustment, and URL suggestion. All patches target the correct module-level names and the assertion coverage matches the addressed review feedback.

Sequence Diagram

sequenceDiagram
    participant CLI as go2tool doctor (CLI)
    participant CR as collect_report
    participant RB as check_robot
    participant LD as LAN discover
    participant SP as signal probe (HTTP)
    participant IF as local_interfaces
    participant RN as check_run
    participant CP as check_ports
    participant PU as psutil.net_connections
    participant LO as lsof fallback
    participant IM as check_image
    participant PS as pubsub subscribe
    participant AD as _adjust_robot_check

    CLI->>CR: collect_report(robot_ip, ...)
    CR->>RB: check_robot(robot_ip)
    RB->>LD: discover(timeout)
    LD-->>RB: "[]|[Go2Device]"
    RB->>SP: GET /con_notify
    SP-->>RB: "ok|timeout"
    RB-->>CR: RobotCheck
    CR->>IF: local_interfaces(resolved_robot_ip)
    IF-->>CR: [LocalInterface]
    CR->>RN: check_run()
    RN-->>CR: RunCheck
    CR->>CP: check_ports(endpoints, probe_hosts)
    CP->>PU: "net_connections(kind=tcp)"
    PU-->>CP: connections
    alt required port missing
        CP->>LO: _lsof_tcp_listeners()
        LO-->>CP: "{port: [hosts]}"
    end
    CP-->>CR: [PortCheck]
    CR->>IM: check_image(topics, timeout)
    IM->>PS: subscribe_pubsub_uri(topic, cb)
    PS-->>IM: "frame | timeout"
    IM-->>CR: ImageCheck
    CR->>AD: _adjust_robot_check_with_runtime_evidence
    AD-->>CR: RobotCheck (possibly FAIL to WARN)
    CR-->>CLI: Go2DoctorReport
    CLI->>CLI: format_report / json.dumps
Loading

Reviews (3): Last reviewed commit: "Address Go2 doctor review comments" | Re-trigger Greptile

Comment thread dimos/robot/unitree/go2/cli/doctor.py
Comment thread dimos/robot/unitree/go2/cli/doctor.py
Comment thread dimos/robot/unitree/go2/cli/doctor.py
Comment thread dimos/robot/unitree/go2/cli/test_doctor.py Outdated

kezaer commented Jun 6, 2026

Copy link
Copy Markdown
Author

Follow-up stack for turning this doctor into startup automation:

  1. feat(core): add blueprint preflight hooks kezaer/dimos#1 - reusable blueprint/hardware preflight infrastructure
  2. feat(go2): validate startup IP with LAN discovery kezaer/dimos#2 - Go2 startup autodetect/fail-closed connectivity preflights
  3. feat(go2): harden LAN teleop startup and browser control kezaer/dimos#3 - Go2 LAN teleop/browser setup hardening and troubleshooting docs

I kept these as draft stacked PRs in the fork because I do not have permission to push upstream stack base branches to dimensionalOS/dimos. The review order is intended to be #2378 first, then the three follow-ups above.

@kezaer kezaer force-pushed the feat/go2-doctor branch from 2c4737d to 1b12482 Compare June 8, 2026 06:40
@kezaer kezaer changed the title Add Go2 local Wi-Fi doctor feat(go2): add read-only local Wi-Fi diagnostics Jun 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant