3.3 KiB
3.3 KiB
US-046 — Tracker .env awareness + first-node auto-join bootstrap
Status: in progress Priority: High (blocks the US-044 two-machine test; auto-join dead on fresh trackers)
Context
Reported 2026-07-06: a node auto-joining a fresh tracker prints
(auto-join unavailable: HTTP Error 503) and then cannot download the model
from the tracker. Two independent causes:
- Bootstrap chicken-and-egg.
_handle_network_assignhandles an empty registry by falling back to the first deployable recommended preset — but deployability is computed from the registered pool only (_deployment_summary(all_nodes, preset)), which is empty, so nothing is ever deployable and the first node always gets 503. The caller's ownvram_mb/ram_mb(already sent in the query) are ignored. - Tracker ignores
.env.meshnet-nodeloads.env(cwd) and~/.config/meshnet/secrets.envat startup;meshnet-trackerdoes not. The repo.envsetsMESHNET_DOWNLOAD_DIR=/run/media/popov/DATA/llm/safetensor/models, but the tracker only reads--models-dir/MESHNET_MODELS_DIR, somodels_dirstays unset →/v1/model-files/downloadreturns 404 "tracker model-file source is not enabled" and assignments carry nomodel_sources. - Symlink tars (found while verifying). HF cache snapshots are symlink
farms into
blobs/; both the tracker's/v1/model-files/downloadand the node'swrite_shard_archivetarred the symlinks themselves (tarfiledefaultdereference=False), so receivers extracted dangling links instead of weights.
Fix
- In the empty-registry branch of
_handle_network_assign, synthesize a candidate_NodeEntryfrom the caller'svram_mb/ram_mbquery params and include it in the pool used for the deployability gate (and the reporteddeploymentsummary), so a recommended preset that fits pool + caller bootstraps the network. - Tracker CLI loads env defaults the same way the node CLI does
(
.envin cwd, then~/.config/meshnet/secrets.env, never overriding already-set env vars). TrackerServermodels-dir resolution falls back--models-dir→MESHNET_MODELS_DIR→MESHNET_DOWNLOAD_DIR(the node store and tracker source are the same directory on a box running both).- Archive with
dereference=Truein both tar writers so model file contents ship instead of snapshot symlinks.
Acceptance criteria
- Fresh tracker (empty registry) + caller with enough memory for a
recommended preset →
/v1/network/assignreturns 200 with that preset,gap_found=true, andmodel_sourcespopulated when the tracker holds a local snapshot. (Verified live: 128 GB caller got qwen3.6-35b-a3b 0–39 with trackermodel_sources.) - Fresh tracker + caller too small for any recommended preset → still 503. (Verified live with a 4 GB caller.)
meshnet-tracker startin a directory with.envsettingMESHNET_DOWNLOAD_DIRserves/v1/model-files/downloadfrom that dir with no extra flags. (Verified live; tar entries are regular files, not symlinks.)- Explicit
--models-dirandMESHNET_MODELS_DIRstill take precedence, in that order. python -m pytestpasses from repo root (two known env-dependent failures occur only while a live meshnet-node holds port 7000).