Skip to content

fix(networking): restore and normalize EXO_BOOTSTRAP_PEERS connection resolution - #2468

Open
presentyourlove wants to merge 1 commit into
exo-explore:mainfrom
presentyourlove:feature/fix-exo-bootstrap-peers
Open

presentyourlove wants to merge 1 commit into
exo-explore:mainfrom
presentyourlove:feature/fix-exo-bootstrap-peers

Conversation

@presentyourlove

Copy link
Copy Markdown

Description

This PR resolves item 1 in TODO.md: EXO_BOOTSTRAP_PEERS is currently broken, re-enabling manual bootstrap peer connection across subnets, firewalls, and public IP addresses.

Background & Root Cause

During the migration from libp2p to Zenoh, manual bootstrap peering was temporarily disabled with raise ValueError("Bootstrap peers has been temporarily removed") and help=argparse.SUPPRESS in src/exo/main.py. This occurred because users supplied diverse address formats (plain IPv4/IPv6, custom ports, hostnames, or legacy /ip4/.../tcp/.../p2p/... multiaddrs), while Zenoh requires standardized locator endpoints (e.g. tcp/<host>:<port>). Without normalized peer resolution, starting Exo with --bootstrap-peers or EXO_BOOTSTRAP_PEERS caused crashes or startup refusal.

Key Changes

  1. Peer Address Normalization (src/exo/routing/peer_resolver.py):

    • Implemented BootstrapPeerResolver: Parses, cleans, and standardizes multi-format peer strings:
      • Plain IP (192.168.1.100 -> tcp/192.168.1.100:52414).
      • IP with Port (10.0.0.5:6000 -> tcp/10.0.0.5:6000).
      • Bracketed & Bare IPv6 ([::1]:52414 / ::1 -> tcp/[::1]:52414).
      • DNS Hostnames (node1.cluster.local:52414 -> tcp/node1.cluster.local:52414).
      • Legacy Multiaddrs (/ip4/192.168.1.100/tcp/52414/p2p/... -> tcp/192.168.1.100:52414).
      • Raw Zenoh locators (tcp/192.168.1.100:52414 -> preserved).
    • Added delimiter-resilient parsing (comma, semicolon, whitespace) with automatic locator deduplication.
  2. Zenoh Connection Configuration & Probing (src/exo/routing/bootstrap_connector.py):

    • BootstrapConnector.apply_zenoh_env: Sets ZENOH_CONNECT_ENDPOINTS environment variable with normalized locators so the underlying Zenoh runtime dials bootstrap peers on startup.
    • BootstrapConnector.probe_peer_reachability: Non-blocking, asynchronous TCP probe for peer liveness with friendly logging.
  3. CLI & Main Entrypoint Restoration (src/exo/main.py):

    • Removed the temporary raise ValueError barrier in main_inner.
    • Restored user-facing help documentation for --bootstrap-peers.
    • Updated Args.bootstrap_peers to use robust delimiter splitting and Field(default_factory=list).
  4. Unit Tests (src/exo/shared/tests/test_bootstrap_peers.py):

    • 10 unit tests covering IPv4, IPv6, DNS, legacy multiaddr normalization, empty/invalid filtering, Zenoh environment injection, reachability probing, and CLI argument parsing.

Verification

  • Unit Tests:
    .venv/Scripts/pytest.exe src/exo/shared/tests/test_bootstrap_peers.py -v
    # 10 passed in 0.31s
  • Code Linting:
    .venv/Scripts/ruff.exe check src/exo/routing/peer_resolver.py src/exo/routing/bootstrap_connector.py src/exo/routing/__init__.py src/exo/main.py src/exo/shared/tests/test_bootstrap_peers.py
    # All checks passed!

Related Issues

  • Resolves: Item 1 in TODO.md (EXO_BOOTSTRAP_PEERS is currently broken)

… resolution

- Implement BootstrapPeerResolver to normalize IPv4, IPv6, DNS hostnames, and legacy libp2p multiaddrs into standard Zenoh locators

- Implement BootstrapConnector to configure ZENOH_CONNECT_ENDPOINTS and probe peer reachability without blocking

- Remove temporary ValueError block and restore CLI flag documentation for --bootstrap-peers

- Add 10 comprehensive unit tests in test_bootstrap_peers.py

- Resolves TODO.md item exo-explore#1 (EXO_BOOTSTRAP_PEERS is currently broken)
cdvankammen added a commit to cdvankammen/exo that referenced this pull request Oct 23, 2026
… (exo#2468)

Port of upstream PR exo-explore#2468 onto fork chain head b12c3a2.

Conflict resolution: src/exo/routing/__init__.py — upstream added
BootstrapConnector/BootstrapPeerResolver/ResolvedPeer exports; fork
already had DeviceAwareMoERouter. Kept both sides (additive merge).
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