Skip to content

fix: give a box vast's ssh proxy when its direct port refuses connections - #102

Merged
jaspermayone merged 3 commits into
mainfrom
jaspermayone/box-ssh-proxy-fallback
Nov 22, 2026
Merged

jaspermayone merged 3 commits into
mainfrom
jaspermayone/box-ssh-proxy-fallback

Conversation

@jaspermayone

Copy link
Copy Markdown
Member

Problem

On production (2026-11-22), every box a member rented on Vast machine 153597 gave a dead krater ssh with "connection refused". On the box sh45 2 (instance 62020475):

  • Vast mapped 22/tcp to host port 20056, and VAST_TCP_PORT_22=20056 was set in the container.
  • sshd listened on port 22 in the container, and Vast said the box was running.
  • 38.114.93.198:20056 refused every connection, from a laptop and from weft.
  • Vast's proxy (ssh5.vast.ai:12952) reached the same sshd and keys.

Krater always recorded the direct port when Vast listed one, so the job page, krater ssh and krater show gave the dead address.

Change

The worker tests a running box's direct port with one TCP connection (krater/compute/ssh_reach.py). A refusal moves the box to Vast's proxy address.

flowchart TD
  A[Scheduler pass sees the box] --> B{Direct port and proxy both listed?}
  B -- no --> C[Use the one listed]
  B -- yes --> D{Can the port be tested now?}
  D -- "no: paused, quiet runner, stopping, Krater's network down" --> E{Moved to proxy before?}
  E -- yes --> P[Keep the proxy]
  E -- no --> F[Use the direct port]
  D -- yes --> G{TCP connect}
  G -- accepted --> F
  G -- refused --> H[Use the proxy, write one ssh_proxy event]
  G -- "timeout or error" --> E
Loading
  • A test runs only when the box's runner reports from the current container. sshd starts before the runner, so a refusal then is the host's fault.
  • A working port is tested once per worker process. A refused port is tested again after 30 minutes. A pass runs at most 5 new tests, each with a 2 s timeout.
  • The worker never connects to a host-supplied address that is not public, or to a port out of range.
  • No migration. The ssh_proxy event marks that a box was moved to the proxy.

Docs: docs/compute/runner.md, the box SSH section.

Limits

  • The test runs from the worker. A member whose own network blocks Vast's direct ports still gets the direct address.
  • A host that drops packets, not refuses them, keeps its direct address.
  • Machine 153597 stays in the box search. With this change, its boxes work through the proxy.

Checks

  • uv run ruff check . and uv run ruff format --check . pass.
  • uv run pytest: 2130 passed, 1 skipped, against a local Postgres 16.

Council review

Size: full. Rounds: 2

Reviewer Round 1 Round 2
Opus 7/10 not run
Sonnet 7/10 8/10
Seat A (beam-free) 6/10 8/10
Seat B (hy4-flash-free, after ernie-5.5-flash-preview and iceman-free timed out) 6/10 not run

@jaspermayone
jaspermayone merged commit 72ebf78 into main Nov 22, 2026
10 of 12 checks passed
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