Repository navigation
Studio cluster: pair and serve across networks with one code - #17763
danielhanchen wants to merge 39 commits into
Conversation
… (no-op without its helper)
…ch worker is reached in cluster list
… a 15 s dial timeout
…s tunnel closes, refuse workers without approval words, and list relayed workers as serving when relays are allowed
… through tailcat, and a relayed-only worker
…d a cross-platform build workflow
…test pins tailcat off, a longer pairing wait under load
…etwork path starts, LAN only if it cannot
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 23f93557ee
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| const { code: fresh, ...state } = await startPairing(); | ||
| setCode(fresh); | ||
| setPairing(state); |
There was a problem hiding this comment.
Cancel pairing windows returned after the dialog closes
If the dialog closes while startPairing() is pending—for example, while the backend downloads the helper on first use—the effect cleanup sees no pairing and cannot cancel it. These unconditional state updates then retain the newly opened window and start polling it even though the dialog is closed. The backend pairing listener and tunnel remain open until expiry instead of being cancelled when the user dismisses the dialog. Track the request's lifetime and cancel any pairing returned after its dialog has closed, rather than applying that late result.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in 951a3e1. Each start now takes a generation number, and closing the dialog (or starting again) bumps it. A start that comes back late cancels the window it opened and leaves the dialog state alone, so no listener or poll outlives a closed dialog. The frontend typecheck (tsc) passes.
|
@codex review |
1 similar comment
|
@codex review |
|
Codex Review: Didn't find any major issues. More of your lovely PRs please. Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
… workflow with the repo guards
…once the tunnel dial runs [skip ci]
|
@codex review |
1 similar comment
|
@codex review |
|
Codex Review: Didn't find any major issues. Already looking forward to the next diff. Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
|
@codex review |
1 similar comment
|
@codex review |
|
Codex Review: Didn't find any major issues. You're on a roll. Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
|
Superseded by #18279, which has the same changes rebuilt on a stack that no longer needs the DGX Spark PRs: #18276 (ships #10280 and #10323 stay open as optional Spark extras stacked on top. Closing this one so review continues on #18279; the discussion here stays for reference. |
Stacked on #14274 (home cluster pairing), which is stacked on #13726 and #10323. Part of #4858.
What this does
Pairing a machine now takes one code and one command on each side, and it also works when the two machines are on different networks or behind NAT. There is no port forwarding, no account and no admin rights involved.
Studio gets the same flow under Settings > Machines:
How it works
unsloth-link, built fromstudio/cluster_link/tailcat_helperwith tailcat pinned to e00cdde6.cluster remove) runs inside the tunnel, so it is still what decides who may connect. The tunnel only provides reachability.UNSLOTH_CLUSTER_ALLOW_RELAY=1overrides this, for example with your own relay set viaUNSLOTH_CLUSTER_DERP_MAP.--yesskips approval for scripted setups. Existing unattendedcluster pairscripts need it now.UNSLOTH_CLUSTER_TAILNET=0keeps pairing local-only and offline.studio/unsloth_link_pins.jsonbefore anything is extracted or run..github/workflows/unsloth-link.ymlbuilds byte-reproducible archives for Linux, macOS and Windows (amd64 and arm64) and fails unless they match the pins. It then smoke-tests each platform natively and publishes on theunsloth-link-v1tag.UNSLOTH_CLUSTER_TAILNET=0turns the whole thing off.Tests
tests/studio/test_cluster_link_tailnet_e2e.py, run whenUNSLOTH_LINK_BINis set):cluster removedrops the worker.Not proven yet
The workflow has not run on GitHub yet, so the pins come from local builds that were checked to be reproducible.
Speed across the internet is not measured yet. On a real gigabit LAN of 5 CPU machines, RPC through tailcat was compared with the same mutual-TLS RPC over the LAN, both with copies between workers going through the master:
Every tunnel reached a direct path at about 865 Mbit/s. At 4 and 5 machines, all worker-to-worker copies cross the master's tunnel endpoint. That is why the LAN stays first, and tailcat is only used for workers the LAN cannot reach.
The macOS and Windows helper binaries are cross-compiled but unsigned, and have not run on those platforms outside CI.
cluster removeon the master drops the worker at once: the master's TLS check refuses it and its tunnel is closed. The worker's own tunnel keeps admitting the master's key untilcluster leaveis run on the worker.Screenshots
These come from two separate
install.sh --local --no-torchinstalls: BEFORE is this PR's base, AFTER is this branch. The worker is a realunsloth worker --joinrun from a second cluster state directory on the same host. The code is blanked out.Settings gains Machines. Before,
/api/cluster/machinesanswered 404.Nothing paired yet:
Add a machine shows the command to run on the other machine and the one-time code:
Approval: the worker ran
unsloth worker --joinand its terminal showed the same three words.After Allow:
The paired worker is Ready:
Remove asks first: