Skip to content

feat: crew SSH-mesh (DRAFT, stacked on #129)#137

Closed
zozo123 wants to merge 2 commits into
openclaw:mainfrom
zozo123:feat/crew-ssh-mesh
Closed

feat: crew SSH-mesh (DRAFT, stacked on #129)#137
zozo123 wants to merge 2 commits into
openclaw:mainfrom
zozo123:feat/crew-ssh-mesh

Conversation

@zozo123
Copy link
Copy Markdown
Contributor

@zozo123 zozo123 commented May 21, 2026

Stacked on #openclaw/crabbox#129 — merge that first. The diff here will collapse to just the SSH-mesh additions once #129 lands.

TL;DR

Operator-orchestrated SSH-mesh: crabbox crew connect <name> opens local SSH -L tunnels from the operator's machine to each crew member's --expose'd port. Peers reachable by name at 127.0.0.1:<port> for the operator's shell. Works on every SSH-accessible provider. No Tailscale, no Headscale, no relay, no SaaS — just SSH.

How it works

  • --expose <port> on run/warmup: declares the lease wants this port reachable. Repeatable; multi-valued. Written into a reserved provider label.
  • crabbox crew connect <name>: reads crew members, opens ssh -L per (member, port), writes ~/.crabbox/crew/<name>/{hosts,env}, holds connections open with SSH ControlMaster reuse. --export prints shell exports; --json dumps the forward table.
  • crabbox doctor --crew <name>: reports the SSH-mesh plane alongside the Tailscale plane (crew-mesh sub-check).

What this is NOT

  • Lease-to-lease peer dial (true P2P) — future PR with operator-side hub + reverse tunnels.
  • UDP — SSH -L is TCP-only.
  • Auto-plane selection — manual for v1.

Tested

  • Unit tests with mocked SSH exec runner: --expose parsing, label rendering, hosts/env file rendering, doctor counts, ssh -L arg construction, and full launch + teardown over a recording runner. go test -race ./internal/cli/... clean.
  • Live validation: skipped — no funded SSH-lease provider available in this dev environment (RunPod balance $0; no live exedev credentials). Mocked-exec test exercises the orchestration end-to-end.

Open questions

Related

zozo123 added 2 commits May 21, 2026 12:13
Add a reserved label `crew=<name>` and a `--crew` flag on `run` /
`warmup`. `list`, `status`, `release` accept `--crew` as a selector.

For Tailscale-capable providers, the CLI mints the auth key tagged
`tag:cbx-crew-<owner>-<name>` in user context — broker never sees
Tailscale credentials. Cloud-init writes `/etc/hosts.cbx` so peers
are reachable as `<slug>.cbx` and `<role>.cbx`. The `.cbx` suffix
avoids collision with the real `.box` ICANN gTLD.

When `TS_API_KEY` is exported, the CLI also self-bootstraps the
concrete `tag:cbx-crew-*` rows on the operator tailnet on the first
lease in each new crew — GET the policy with ETag, merge the
missing tagOwners and self-peering grant, PUT back with If-Match
so concurrent edits fail fast. Doctor reports `auto-managed` in
that mode and falls back to a manual snippet hint without the key.

Non-Tailscale providers honor `--crew` as metadata; networking is
rejected with a clear message and surfaced by doctor.
Adds `crabbox crew connect <name>` and `--expose <port>` on
run/warmup. The connect command opens local SSH `-L` tunnels from
the operator machine to each crew member's exposed port, so the
operator can dial peers by name at `127.0.0.1:<port>`.

No daemon on the lease, no relay, no SaaS — just SSH, which every
crabbox SSH-lease provider already gives us. Open source by
construction; works on AWS / Azure / GCP / Hetzner / Proxmox /
exe.dev / RunPod / Sprites / Namespace / Semaphore / Daytona.

Lease-to-lease peer dial (true P2P mesh) is a future follow-up.

Stacked on openclaw#129 — merge after the crew foundation lands.
@zozo123
Copy link
Copy Markdown
Contributor Author

zozo123 commented May 22, 2026

Closing in favor of #129, which now consolidates all three transport planes. The SSH-mesh work (pond connect --export, --expose, operator-side ssh -L) is preserved in #129 with TOCTOU + reconnection improvements applied. The primitive was renamed crewpond to align with openclaw's crab-biology naming. Advanced flags (--watch, daemonization) deferred. Keeping the review thread in one place.

@zozo123 zozo123 closed this May 22, 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